Lines Matching refs:blocks
444 const size_t blocks, bool printerror) { in VerifyBlocks() argument
448 SHA1(data, blocks * BLOCKSIZE, digest); in VerifyBlocks()
560 bool verify, size_t* blocks, std::vector<uint8_t>& buffer, bool printnoent) { in LoadStash() argument
587 if (!blocks) { in LoadStash()
588 blocks = &blockcount; in LoadStash()
625 *blocks = sb.st_size / BLOCKSIZE; in LoadStash()
627 if (verify && VerifyBlocks(id, buffer, *blocks, true) != 0) { in LoadStash()
636 static int WriteStash(const std::string& base, const std::string& id, int blocks, in WriteStash() argument
642 if (checkspace && CacheSizeCheck(blocks * BLOCKSIZE) != 0) { in WriteStash()
658 fprintf(stderr, " skipping %d existing blocks in %s\n", blocks, cn.c_str()); in WriteStash()
666 fprintf(stderr, " writing %d blocks to %s\n", blocks, cn.c_str()); in WriteStash()
676 if (write_all(fd, buffer, blocks * BLOCKSIZE) == -1) { in WriteStash()
784 size_t blocks = 0; in SaveStash() local
785 if (usehash && LoadStash(params, base, id, true, &blocks, buffer, false) == 0) { in SaveStash()
799 blocks = src.size; in SaveStash()
801 if (usehash && VerifyBlocks(id, buffer, blocks, true) != 0) { in SaveStash()
816 fprintf(stderr, "stashing %zu blocks to %s\n", blocks, id.c_str()); in SaveStash()
817 params.stashed += blocks; in SaveStash()
818 return WriteStash(base, id, blocks, buffer, false, nullptr); in SaveStash()
842 size_t blocks = locs.pos[i*2+1] - locs.pos[i*2]; in MoveRange() local
843 start -= blocks; in MoveRange()
845 blocks * BLOCKSIZE); in MoveRange()
1041 size_t blocks = 0; in PerformCommandMove() local
1047 status = LoadSrcTgtVersion1(params, tgt, blocks, params.buffer, params.fd); in PerformCommandMove()
1049 status = LoadSrcTgtVersion2(params, tgt, blocks, params.buffer, params.fd, in PerformCommandMove()
1052 status = LoadSrcTgtVersion3(params, tgt, blocks, true, overlap); in PerformCommandMove()
1068 fprintf(stderr, " moving %zu blocks\n", blocks); in PerformCommandMove()
1074 fprintf(stderr, "skipping %zu already moved blocks\n", blocks); in PerformCommandMove()
1223 size_t blocks = 0; in PerformCommandDiff() local
1227 status = LoadSrcTgtVersion1(params, tgt, blocks, params.buffer, params.fd); in PerformCommandDiff()
1229 status = LoadSrcTgtVersion2(params, tgt, blocks, params.buffer, params.fd, in PerformCommandDiff()
1232 status = LoadSrcTgtVersion3(params, tgt, blocks, false, overlap); in PerformCommandDiff()
1248 fprintf(stderr, "patching %zu blocks to %zu\n", blocks, tgt.size); in PerformCommandDiff()
1270 if (ApplyImagePatch(params.buffer.data(), blocks * BLOCKSIZE, &patch_value, in PerformCommandDiff()
1276 if (ApplyBSDiffPatch(params.buffer.data(), blocks * BLOCKSIZE, &patch_value, in PerformCommandDiff()
1289 blocks, tgt.size, params.cmdline); in PerformCommandDiff()
1331 uint64_t blocks[2]; in PerformCommandErase() local
1333 blocks[0] = tgt.pos[i * 2] * (uint64_t) BLOCKSIZE; in PerformCommandErase()
1335 blocks[1] = (tgt.pos[i * 2 + 1] - tgt.pos[i * 2]) * (uint64_t) BLOCKSIZE; in PerformCommandErase()
1337 if (ioctl(params.fd, BLKDISCARD, &blocks) == -1) { in PerformCommandErase()