dedup

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

commit 94596df085ef611772b52d9d7e3ffe0e26db3fb8
parent 748b1ecb66e6c66d9fd18b84e58c1fbecb88839b
Author: sin <sin@2f30.org>
Date:   Thu, 18 Apr 2019 09:31:12 +0100

Print compress/hash info in dinfo(1)

Diffstat:
Mdinfo.c | 11+++++++++--
Mutils.c | 8--------
2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/dinfo.c b/dinfo.c @@ -28,8 +28,15 @@ int verbose; char *argv0; static void -print_info(struct stats *st) +print_info(void) { + struct stats *st = &snap_hdr.st; + + fprintf(stderr, "Compression algorithm: %s\n", + compr_type2name(compr_algo)); + fprintf(stderr, "Hash algorithm: %s\n", + hash_type2name(hash_algo)); + if (st->nr_blks == 0) return; @@ -113,7 +120,7 @@ main(int argc, char *argv[]) err(1, "chdir: %s", repo); init(); - print_info(&snap_hdr.st); + print_info(); term(); return 0; } diff --git a/utils.c b/utils.c @@ -114,20 +114,12 @@ load_blk_hdr(int fd, struct blk_hdr *hdr, int *compr_algo, int *hash_algo) if (*compr_algo < 0 || *compr_algo >= NR_COMPRS) errx(1, "unsupported compression algorithm: %d", *compr_algo); - if (verbose > 0) - fprintf(stderr, "Compression algorithm: %s\n", - compr_type2name(*compr_algo)); - v = hdr->flags >> HASH_ALGO_SHIFT; v &= HASH_ALGO_MASK; *hash_algo = v; if (*hash_algo < 0 || *hash_algo >= NR_HASHES) errx(1, "unsupported hash algorithm: %d", *hash_algo); - - if (verbose > 0) - fprintf(stderr, "Hash algorithm: %s\n", - hash_type2name(*hash_algo)); } void