dedup

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

commit 20a85fa453b901904957822d2ab31165209852b4
parent 28320f9a798150281e7192fe79cc1d48bdf9a4ae
Author: sin <sin@2f30.org>
Date:   Wed, 27 Feb 2019 11:59:59 +0000

Make alloc_chunker() prototype consistent with other funcs

Pass fd as a first argument.

Diffstat:
Mchunker.c | 6+++---
Mdedup.c | 2+-
Mdedup.h | 2+-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/chunker.c b/chunker.c @@ -11,10 +11,10 @@ struct chunker { uint8_t *buf; + int fd; size_t cap; size_t rpos; size_t wpos; - int fd; }; /* @@ -123,7 +123,7 @@ get_chunk_size(struct chunker *chunker) } struct chunker * -alloc_chunker(size_t cap, int fd) +alloc_chunker(int fd, size_t cap) { struct chunker *chunker; @@ -134,8 +134,8 @@ alloc_chunker(size_t cap, int fd) chunker->buf = calloc(1, cap); if (chunker->buf == NULL) err(1, "calloc"); - chunker->cap = cap; chunker->fd = fd; + chunker->cap = cap; return chunker; } diff --git a/dedup.c b/dedup.c @@ -256,7 +256,7 @@ dedup(int fd, char *msg) ssize_t n; snap = alloc_snap(); - chunker = alloc_chunker(BLKSIZE_MAX, fd); + chunker = alloc_chunker(fd, BLKSIZE_MAX); SHA256_Init(&ctx); while ((n = fill_chunker(chunker)) > 0) { diff --git a/dedup.h b/dedup.h @@ -67,7 +67,7 @@ int lookup_cache_entry(struct cache *cache, struct cache_entry *ent); void walk_cache(struct cache *cache, int (*fn)(struct cache_entry *)); /* chunker.c */ -struct chunker *alloc_chunker(size_t cap, int fd); +struct chunker *alloc_chunker(int fd, size_t cap); void free_chunker(struct chunker *chunker); ssize_t fill_chunker(struct chunker *chunker); uint8_t *get_chunk(struct chunker *chunker, size_t *chunk_size);