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