dedup

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

commit 93e2b902f983dd2475a9883f5cd338fb67257c5f
parent 1a978a0ee0986c6cd869dd94a47cf85b89f2474f
Author: sin <sin@2f30.org>
Date:   Wed,  6 Mar 2019 09:38:04 +0000

Remove cache message digest from snapshot header

Since the removal of the .cache file this field does not make sense
anymore.

Diffstat:
Mdedup.h | 5++---
Mtypes.c | 14++++----------
2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/dedup.h b/dedup.h @@ -6,7 +6,7 @@ * using the helpers from types.c. Any modification made to * the structs below will need to be reflected here and in types.c. */ -#define SNAP_HDR_SIZE 136 +#define SNAP_HDR_SIZE 104 #define BLK_HDR_SIZE 16 #define BLK_DESC_SIZE 48 #define SNAPSHOT_SIZE 304 @@ -15,7 +15,7 @@ #define MDSIZE 32 /* file format version */ -#define VER_MIN 3 +#define VER_MIN 2 #define VER_MAJ 0 #define VER_MIN_MASK 0xff @@ -42,7 +42,6 @@ struct snapshot_hdr { uint64_t flags; /* bottom 16 bits are maj/min version */ uint64_t size; /* size of snapshots file */ uint64_t nr_snapshots; - uint8_t cache_md[MDSIZE]; struct stats st; }; diff --git a/types.c b/types.c @@ -10,18 +10,15 @@ void read_snap_hdr(int fd, struct snapshot_hdr *hdr) { uint8_t buf[SNAP_HDR_SIZE]; - char fmt[BUFSIZ]; int n; if (xread(fd, buf, sizeof(buf)) == 0) errx(1, "read_snap_hdr: unexpected EOF"); - snprintf(fmt, sizeof(fmt), "qqq'%d", MDSIZE); - n = unpack(buf, fmt, + n = unpack(buf, "qqq", &hdr->flags, &hdr->size, - &hdr->nr_snapshots, - hdr->cache_md); + &hdr->nr_snapshots); n += unpack(&buf[n], "qqqqqq", &hdr->st.orig_size, @@ -44,15 +41,12 @@ void write_snap_hdr(int fd, struct snapshot_hdr *hdr) { uint8_t buf[SNAP_HDR_SIZE]; - char fmt[BUFSIZ]; int n; - snprintf(fmt, sizeof(fmt), "qqq'%d", MDSIZE); - n = pack(buf, fmt, + n = pack(buf, "qqq", hdr->flags, hdr->size, - hdr->nr_snapshots, - hdr->cache_md); + hdr->nr_snapshots); n += pack(&buf[n], "qqqqqq", hdr->st.orig_size,