iRename write_blk to append_blk - dedup - deduplicating backup program Err bitreich.org 70 hgit clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ URL:git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ bitreich.org 70 1Log /scm/dedup/log.gph bitreich.org 70 1Files /scm/dedup/files.gph bitreich.org 70 1Refs /scm/dedup/refs.gph bitreich.org 70 1Tags /scm/dedup/tag bitreich.org 70 1README /scm/dedup/file/README.gph bitreich.org 70 1LICENSE /scm/dedup/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit 90f2ff9fcf896060da4be75c70cd148f18be28e9 /scm/dedup/commit/90f2ff9fcf896060da4be75c70cd148f18be28e9.gph bitreich.org 70 1parent 7af43f80bce1e8a11967d0d83f1346e028a2f240 /scm/dedup/commit/7af43f80bce1e8a11967d0d83f1346e028a2f240.gph bitreich.org 70 hAuthor: sin URL:mailto:sin@2f30.org bitreich.org 70 iDate: Sun, 17 Feb 2019 11:52:38 +0000 Err bitreich.org 70 i Err bitreich.org 70 iRename write_blk to append_blk Err bitreich.org 70 i Err bitreich.org 70 iwrite_blk gave the impression that it could write anywhere (and it Err bitreich.org 70 icould) but the store is append only so we really don't want to write Err bitreich.org 70 ianywhere. Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M dedup.c | 14 ++++---------- Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 4 insertions(+), 10 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/dedup.c b/dedup.c /scm/dedup/file/dedup.c.gph bitreich.org 70 i@@ -341,19 +341,13 @@ read_blk(uint8_t *buf, struct bdescr *bdescr) Err bitreich.org 70 i } Err bitreich.org 70 i Err bitreich.org 70 i void Err bitreich.org 70 i-write_blk(uint8_t *buf, struct bdescr *bdescr) Err bitreich.org 70 i+append_blk(uint8_t *buf, struct bdescr *bdescr) Err bitreich.org 70 i { Err bitreich.org 70 i- lseek(sfd, bdescr->offset, SEEK_SET); Err bitreich.org 70 i+ lseek(sfd, enthdr.store_size, SEEK_SET); Err bitreich.org 70 i xwrite(sfd, buf, bdescr->size); Err bitreich.org 70 i enthdr.store_size += bdescr->size; Err bitreich.org 70 i } Err bitreich.org 70 i Err bitreich.org 70 i-off_t Err bitreich.org 70 i-store_size(void) Err bitreich.org 70 i-{ Err bitreich.org 70 i- return enthdr.store_size; Err bitreich.org 70 i-} Err bitreich.org 70 i- Err bitreich.org 70 i int Err bitreich.org 70 i lookup_blk(uint8_t *md) Err bitreich.org 70 i { Err bitreich.org 70 i@@ -392,7 +386,7 @@ dedup(int fd, char *msg) Err bitreich.org 70 i blksiz = n; Err bitreich.org 70 i Err bitreich.org 70 i memcpy(bdescr.md, md, sizeof(bdescr)); Err bitreich.org 70 i- bdescr.offset = store_size(); Err bitreich.org 70 i+ bdescr.offset = enthdr.store_size; Err bitreich.org 70 i bdescr.size = blksiz; Err bitreich.org 70 i Err bitreich.org 70 i hash_blk(bp, bdescr.size, bdescr.md); Err bitreich.org 70 i@@ -409,7 +403,7 @@ dedup(int fd, char *msg) Err bitreich.org 70 i ent->bdescr[ent->nblks++] = bdescr; Err bitreich.org 70 i Err bitreich.org 70 i /* Store block */ Err bitreich.org 70 i- write_blk(bp, &bdescr); Err bitreich.org 70 i+ append_blk(bp, &bdescr); Err bitreich.org 70 i Err bitreich.org 70 i /* Create a cache entry for this block */ Err bitreich.org 70 i cent = alloc_cent(); Err bitreich.org 70 .