commit dc8ddd5cc99cba6f6a7919ebd9bc92b52cffc1a6
parent 4122001dbfb14b263965c955e865a6c04151fbbc
Author: sin <sin@2f30.org>
Date: Sun, 10 Mar 2019 11:04:48 +0000
Describe snapshot/blk len based on msgsize/mdsize
Diffstat:
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/dedup.c b/dedup.c
@@ -265,8 +265,6 @@ dedup(int fd, char *msg)
}
if (snap->nr_blk_descs > 0) {
- hash_snap(snap, snap->md);
-
if (msg != NULL) {
size_t size;
@@ -276,7 +274,7 @@ dedup(int fd, char *msg)
memcpy(snap->msg, msg, size);
snap->msg[size - 1] = '\0';
}
-
+ hash_snap(snap, snap->md);
append_snap(snap);
}
diff --git a/dedup.h b/dedup.h
@@ -6,13 +6,13 @@
* using the helpers from types.c. Any modification made to
* the structs below will need to be reflected here and in types.c.
*/
+#define MSGSIZE 256
+#define MDSIZE 32
+
#define SNAP_HDR_SIZE 104
#define BLK_HDR_SIZE 16
-#define BLK_DESC_SIZE 48
-#define SNAPSHOT_SIZE 304
-
-#define MSGSIZE 256
-#define MDSIZE 32
+#define BLK_DESC_SIZE (MDSIZE + 16)
+#define SNAPSHOT_SIZE (8 + MSGSIZE + MDSIZE + 8)
/* file format version */
#define VER_MIN 2