dedup

data deduplication program
git clone git://git.2f30.org/dedup.git
Log | Files | Refs | README | LICENSE

commit cba6f8ec8d69c9e19c63290d012e995b8f473cb6
parent a7876bfd884b201019ba7d498347257d1869f340
Author: sin <sin@2f30.org>
Date:   Sun, 17 Feb 2019 10:10:45 +0000

Pass a block descriptor to store_blk()

Diffstat:
Mdedup.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

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();