• Home
  • Raw
  • Download

Lines Matching refs:fd

90   android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(last_command_file.c_str(), O_RDONLY)));  in ParseLastCommandFile()  local
91 if (fd == -1) { in ParseLastCommandFile()
103 if (!android::base::ReadFdToString(fd.get(), &content)) { in ParseLastCommandFile()
190 static bool discard_blocks(int fd, off64_t offset, uint64_t size, bool force = false) { in discard_blocks() argument
197 if (ioctl(fd, BLKDISCARD, &args) == -1) { in discard_blocks()
208 static bool check_lseek(int fd, off64_t offset, int whence) { in check_lseek() argument
209 off64_t rc = TEMP_FAILURE_RETRY(lseek64(fd, offset, whence)); in check_lseek()
230 RangeSinkWriter(int fd, const RangeSet& tgt) in RangeSinkWriter() argument
231 : fd_(fd), in RangeSinkWriter()
477 static int ReadBlocks(const RangeSet& src, std::vector<uint8_t>* buffer, int fd) { in ReadBlocks() argument
480 if (!check_lseek(fd, static_cast<off64_t>(begin) * BLOCKSIZE, SEEK_SET)) { in ReadBlocks()
485 if (!android::base::ReadFully(fd, buffer->data() + p, size)) { in ReadBlocks()
497 static int WriteBlocks(const RangeSet& tgt, const std::vector<uint8_t>& buffer, int fd) { in WriteBlocks() argument
502 if (!discard_blocks(fd, offset, size)) { in WriteBlocks()
506 if (!check_lseek(fd, offset, SEEK_SET)) { in WriteBlocks()
510 if (!android::base::WriteFully(fd, buffer.data() + written, size)) { in WriteBlocks()
532 android::base::unique_fd fd; member
632 static void PrintHashForMissingStashedBlocks(const std::string& id, int fd) { in PrintHashForMissingStashedBlocks() argument
641 if (ReadBlocks(src, &buffer, fd) == -1) { in PrintHashForMissingStashedBlocks()
739 if (ReadBlocks(src, buffer, params.fd) == -1) { in LoadStash()
760 PrintHashForMissingStashedBlocks(id, params.fd); in LoadStash()
772 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(fn.c_str(), O_RDONLY))); in LoadStash() local
773 if (fd == -1) { in LoadStash()
781 if (!android::base::ReadFully(fd, buffer->data(), sb.st_size)) { in LoadStash()
836 android::base::unique_fd fd( in WriteStash() local
838 if (fd == -1) { in WriteStash()
844 if (fchown(fd, AID_SYSTEM, AID_SYSTEM) != 0) { // system user in WriteStash()
849 if (!android::base::WriteFully(fd, buffer.data(), blocks * BLOCKSIZE)) { in WriteStash()
855 if (fsync(fd) == -1) { in WriteStash()
1011 if (ReadBlocks(src, &params.buffer, params.fd) == -1) { in LoadSourceBlocks()
1111 if (ReadBlocks(*tgt, &tgtbuffer, params.fd) == -1) { in LoadSrcTgtVersion3()
1190 if (WriteBlocks(tgt, params.buffer, params.fd) == -1) { in PerformCommandMove()
1227 if (ReadBlocks(src, &params.buffer, params.fd) == -1) { in PerformCommandStash()
1288 if (!discard_blocks(params.fd, offset, size)) { in PerformCommandZero()
1292 if (!check_lseek(params.fd, offset, SEEK_SET)) { in PerformCommandZero()
1297 if (!android::base::WriteFully(params.fd, params.buffer.data(), BLOCKSIZE)) { in PerformCommandZero()
1328 params.nti.writer = std::make_unique<RangeSinkWriter>(params.fd, tgt); in PerformCommandNew()
1393 RangeSinkWriter writer(params.fd, tgt); in PerformCommandDiff()
1442 if (fstat(params.fd, &sb) == -1) { in PerformCommandErase()
1466 if (!discard_blocks(params.fd, offset, size, true /* force */)) { in PerformCommandErase()
1538 if (!check_lseek(params.fd, static_cast<off64_t>(begin) * BLOCKSIZE, SEEK_SET)) { in PerformCommandComputeHashTree()
1544 if (!android::base::ReadFully(params.fd, buffer, BLOCKSIZE)) { in PerformCommandComputeHashTree()
1570 if (params.canwrite && !builder.WriteHashTreeToFd(params.fd, write_offset)) { in PerformCommandComputeHashTree()
1698 params.fd.reset(TEMP_FAILURE_RETRY(open(blockdev_filename->data.c_str(), O_RDWR))); in PerformBlockImageUpdate()
1699 if (params.fd == -1) { in PerformBlockImageUpdate()
1880 if (fsync(params.fd) == -1) { in PerformBlockImageUpdate()
1943 if (fsync(params.fd) == -1) { in PerformBlockImageUpdate()
2082 android::base::unique_fd fd(open(blockdev_filename->data.c_str(), O_RDWR)); in RangeSha1Fn() local
2083 if (fd == -1) { in RangeSha1Fn()
2098 if (!check_lseek(fd, static_cast<off64_t>(begin) * BLOCKSIZE, SEEK_SET)) { in RangeSha1Fn()
2105 if (!android::base::ReadFully(fd, buffer.data(), BLOCKSIZE)) { in RangeSha1Fn()
2146 android::base::unique_fd fd(open(arg_filename->data.c_str(), O_RDONLY)); in CheckFirstBlockFn() local
2147 if (fd == -1) { in CheckFirstBlockFn()
2157 if (ReadBlocks(blk0, &block0_buffer, fd) == -1) { in CheckFirstBlockFn()