Merge hash.h with dedup.h - 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 9b25474a50c4fddfcf59d518767cd8c0f3f868ff
 (DIR) parent d7d752d1f250ce41f0b9c63298c12375c86baf7f
 (HTM) Author: sin <sin@2f30.org>
       Date:   Sun,  7 Apr 2019 10:50:20 +0100
       
       Merge hash.h with dedup.h
       
       Diffstat:
         M Makefile                            |       1 -
         M chunker.c                           |       1 +
         M dedup.c                             |       1 -
         M dedup.h                             |      20 ++++++++++++++++++++
         M hash.c                              |       2 +-
         D hash.h                              |      18 ------------------
         M icache.c                            |       1 +
         M types.c                             |       1 +
       
       8 files changed, 24 insertions(+), 21 deletions(-)
       ---
 (DIR) diff --git a/Makefile b/Makefile
       @@ -10,7 +10,6 @@ HDR = \
                blake2.h \
                config.h \
                dedup.h \
       -        hash.h \
                tree.h \
        
        SRC = \
 (DIR) diff --git a/chunker.c b/chunker.c
       @@ -5,6 +5,7 @@
        #include <string.h>
        #include <unistd.h>
        
       +#include "blake2.h"
        #include "dedup.h"
        
        #define ROTL(x, y) (((x) << (y)) | ((x) >> (32 - (y))))
 (DIR) diff --git a/dedup.c b/dedup.c
       @@ -13,7 +13,6 @@
        #include "arg.h"
        #include "blake2.h"
        #include "dedup.h"
       -#include "hash.h"
        
        #define SNAPSF ".snapshots"
        #define STOREF ".store"
 (DIR) diff --git a/dedup.h b/dedup.h
       @@ -28,6 +28,12 @@
        #define HASH_ALGO_SHIFT        17
        #define HASH_ALGO_MASK        0x7        /* max 8 hash algos */
        
       +enum hash_algo {
       +        BLAKE2B_ALGO,
       +        BLAKE2BP_ALGO,
       +        NR_ALGOS,
       +};
       +
        struct chunker;
        struct icache;
        
       @@ -67,6 +73,14 @@ struct snap {
                struct blk_desc blk_desc[];
        };
        
       +struct hash_ctx {
       +        union {
       +                blake2b_state blake2b_ctx;
       +                blake2bp_state blake2bp_ctx;
       +        } u;
       +        struct hash_ops *ops;
       +};
       +
        /* compress.c */
        extern int compr_enabled;
        
       @@ -86,6 +100,12 @@ size_t compr_size(size_t size);
        size_t compr(uint8_t *in, uint8_t *out, size_t insize, size_t outsize);
        size_t decompr(uint8_t *in, uint8_t *out, size_t insize, size_t outsize);
        
       +/* hash.c */
       +int hash_init(struct hash_ctx *ctx, int type, size_t n);
       +int hash_update(struct hash_ctx *ctx, const void *buf, size_t n);
       +int hash_final(struct hash_ctx *ctx, void *buf, size_t n);
       +int hash_name2type(char *name);
       +
        /* icache.c */
        struct icache *alloc_icache(void);
        void free_icache(struct icache *icache);
 (DIR) diff --git a/hash.c b/hash.c
       @@ -3,7 +3,7 @@
        #include <string.h>
        
        #include "blake2.h"
       -#include "hash.h"
       +#include "dedup.h"
        
        static int blake2bi(struct hash_ctx *ctx, size_t n);
        static int blake2bu(struct hash_ctx *ctx, const void *buf, size_t n);
 (DIR) diff --git a/hash.h b/hash.h
       @@ -1,18 +0,0 @@
       -enum hash_algo {
       -        BLAKE2B_ALGO,
       -        BLAKE2BP_ALGO,
       -        NR_ALGOS,
       -};
       -
       -struct hash_ctx {
       -        union {
       -                blake2b_state blake2b_ctx;
       -                blake2bp_state blake2bp_ctx;
       -        } u;
       -        struct hash_ops *ops;
       -};
       -
       -int hash_init(struct hash_ctx *ctx, int type, size_t n);
       -int hash_update(struct hash_ctx *ctx, const void *buf, size_t n);
       -int hash_final(struct hash_ctx *ctx, void *buf, size_t n);
       -int hash_name2type(char *name);
 (DIR) diff --git a/icache.c b/icache.c
       @@ -5,6 +5,7 @@
        #include <stdlib.h>
        #include <string.h>
        
       +#include "blake2.h"
        #include "dedup.h"
        #include "tree.h"
        
 (DIR) diff --git a/types.c b/types.c
       @@ -6,6 +6,7 @@
        #include <stdint.h>
        #include <stdlib.h>
        
       +#include "blake2.h"
        #include "dedup.h"
        
        void