dedup

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

commit 10be2e223fbcc4e05633db468d1807609348ebf7
parent 13bf2f947a35134d17043151e3a07f7aa86155b1
Author: sin <sin@2f30.org>
Date:   Sun,  3 Mar 2019 13:29:58 +0000

Add -Z to disable compression

Diffstat:
Mdedup.1 | 8++++++--
Mdedup.c | 13+++++++------
2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/dedup.1 b/dedup.1 @@ -1,4 +1,4 @@ -.Dd March 02, 2019 +.Dd March 03, 2019 .Dt DEDUP 1 .Os .Sh NAME @@ -6,7 +6,7 @@ .Nd data deduplication program .Sh SYNOPSIS .Nm dedup -.Op Fl cilv +.Op Fl Zcilv .Op Fl e Ar id .Op Fl r Ar root .Op Fl m Ar message @@ -18,6 +18,10 @@ is a simple data deduplication program. only handles a single file at a time, so using tar is advised. .Sh OPTIONS .Bl -tag -width "-r root" +.It Fl Z +Disable compression support for this repository. This flag +can be used when initializing the repository. By default +compression is enabled. .It Fl c Perform a consistency check on the deduplication storage. .It Fl i diff --git a/dedup.c b/dedup.c @@ -526,10 +526,7 @@ load_blk_hdr(void) v = blk_hdr.flags >> COMPR_ENABLED_SHIFT; v &= COMPR_ENABLED_MASK; - if (v != compr_enabled) - errx(1, "store is %s but dedup was invoked %s", - v ? "compressed" : "not compressed", - compr_enabled ? "with compression" : "without compression"); + compr_enabled = v; } static void @@ -628,7 +625,7 @@ term(void) static void usage(void) { - fprintf(stderr, "usage: %s [-cilv] [-e id] [-r root] [-m message] [file]\n", argv0); + fprintf(stderr, "usage: %s [-Zcilv] [-e id] [-r root] [-m message] [file]\n", argv0); exit(1); } @@ -637,9 +634,13 @@ main(int argc, char *argv[]) { uint8_t md[MDSIZE]; char *id = NULL, *root = NULL, *msg = NULL; - int fd = -1, iflag = 0, lflag = 0, cflag = 0; + int iflag = 0, lflag = 0, cflag = 0; + int fd = -1; ARGBEGIN { + case 'Z': + compr_enabled = 0; + break; case 'c': cflag = 1; break;