dedup

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

commit 9b25474a50c4fddfcf59d518767cd8c0f3f868ff
parent d7d752d1f250ce41f0b9c63298c12375c86baf7f
Author: sin <sin@2f30.org>
Date:   Sun,  7 Apr 2019 10:50:20 +0100

Merge hash.h with dedup.h

Diffstat:
MMakefile | 1-
Mchunker.c | 1+
Mdedup.c | 1-
Mdedup.h | 20++++++++++++++++++++
Mhash.c | 2+-
Dhash.h | 18------------------
Micache.c | 1+
Mtypes.c | 1+
8 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/Makefile b/Makefile @@ -10,7 +10,6 @@ HDR = \ blake2.h \ config.h \ dedup.h \ - hash.h \ tree.h \ SRC = \ 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)))) 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" 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); 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); 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); 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" 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