Pass a block descriptor to store_blk() - dedup - deduplicating backup program HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit cba6f8ec8d69c9e19c63290d012e995b8f473cb6 DIR parent a7876bfd884b201019ba7d498347257d1869f340 HTML Author: sin <sin@2f30.org> Date: Sun, 17 Feb 2019 10:10:45 +0000 Pass a block descriptor to store_blk() Diffstat: M dedup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- DIR diff --git a/dedup.c b/dedup.c @@ -338,10 +338,10 @@ read_blk(uint8_t *buf, struct bdescr *bdescr) } void -append_blk(uint8_t *buf, size_t size) +store_blk(uint8_t *buf, struct bdescr *bdescr) { - lseek(sfd, 0, SEEK_END); - xwrite(sfd, buf, size); + lseek(sfd, bdescr->offset, SEEK_SET); + xwrite(sfd, buf, bdescr->size); } off_t @@ -405,7 +405,7 @@ dedup(int fd) ent->bdescr[ent->nblks++] = bdescr; /* Store block */ - append_blk(bp, bdescr.size); + store_blk(bp, &bdescr); /* Create a cache entry for this block */ cent = alloc_cent();