Lines Matching refs:fd
35 uint64_t get_block_device_size(int fd)
40 ret = ioctl(fd, BLKGETSIZE64, &size);
48 int wipe_block_device(int fd)
52 uint64_t len = get_block_device_size(fd);
60 ret = ioctl(fd, BLKSECDISCARD, &range);
65 ret = ioctl(fd, BLKDISCARD, &range);
82 int fd = open(path.c_str(), O_RDONLY);
84 if (fd < 0)
87 const uint64_t size = get_block_device_size(fd);
89 close(fd);
96 int fd = open(path.c_str(), O_WRONLY);
98 if (fd < 0)
101 const int ret = wipe_block_device(fd);
103 close(fd);