Lines Matching refs:fd
44 auto fd = open(Updater::Utils::GetPartitionRealPath(devName_).c_str(), O_RDWR); in DoErase() local
45 if (fd < 0) { in DoErase()
50 uint64_t size = GetBlockDeviceSize(fd); in DoErase()
52 if (ioctl(fd, BLKSECDISCARD, &range) >= 0) { in DoErase()
53 close(fd); in DoErase()
59 if (ioctl(fd, BLKDISCARD, &range) < 0) { in DoErase()
60 close(fd); in DoErase()
65 if (!Updater::Utils::WriteFully(fd, buffer.data(), buffer.size())) { in DoErase()
66 close(fd); in DoErase()
70 fsync(fd); in DoErase()
71 close(fd); in DoErase()
91 uint64_t Partition::GetBlockDeviceSize(int fd) const in GetBlockDeviceSize()
94 return (ioctl(fd, BLKGETSIZE64, &size) == 0) ? size : 0; in GetBlockDeviceSize()