Lines Matching refs:fd
32 uint64_t PartitionUtils::GetBlockDeviceSize(int fd) const
35 return (ioctl(fd, BLKGETSIZE64, &size) == 0) ? size : 0;
40 auto fd = open(Updater::Utils::GetPartitionRealPath(devName_).c_str(), O_RDWR);
41 if (fd < 0) {
46 uint64_t size = GetBlockDeviceSize(fd);
48 if (ioctl(fd, BLKSECDISCARD, &range) >= 0) {
49 close(fd);
55 if (ioctl(fd, BLKDISCARD, &range) < 0) {
56 close(fd);
61 if (!Updater::Utils::WriteFully(fd, buffer.data(), buffer.size())) {
62 close(fd);
66 fsync(fd);
67 close(fd);