From 957d974736bca519977af4f31e773e3b2dda4199 Mon Sep 17 00:00:00 2001 From: Jonathan Dieter Date: Wed, 11 Jul 2018 11:24:58 +0100 Subject: [PATCH] More work on buzhash integration in library Signed-off-by: Jonathan Dieter --- include/zck.h.in | 1 + src/lib/zck.c | 9 +++++++++ src/lib/zck_private.h | 1 + 3 files changed, 11 insertions(+) diff --git a/include/zck.h.in b/include/zck.h.in index 35847c1..59a3f2c 100644 --- a/include/zck.h.in +++ b/include/zck.h.in @@ -25,6 +25,7 @@ typedef enum zck_ioption { ZCK_HASH_CHUNK_TYPE, /* Set chunk hash type using zck_hash */ ZCK_VAL_HEADER_HASH_TYPE, /* Set what the header hash type *should* be */ ZCK_VAL_HEADER_LENGTH, /* Set what the header length *should* be */ + ZCK_MANUAL_CHUNK, /* Disable auto-chunking */ ZCK_COMP_TYPE = 100, /* Set compression type using zck_comp */ ZCK_ZSTD_COMP_LEVEL = 1000 /* Set zstd compression level */ } zck_ioption; diff --git a/src/lib/zck.c b/src/lib/zck.c index 09a356d..2a99e07 100644 --- a/src/lib/zck.c +++ b/src/lib/zck.c @@ -272,6 +272,15 @@ int PUBLIC zck_set_ioption(zckCtx *zck, zck_ioption option, ssize_t value) { return False; } zck->prep_hdr_size = value; + } else if(option == ZCK_MANUAL_CHUNK) { + VALIDATE_WRITE(zck); + if(value != 0) { + zck_log(ZCK_LOG_DEBUG, "Disabling automatic chunking\n"); + zck->manual_chunk = 1; + } else { + zck_log(ZCK_LOG_DEBUG, "Enabling automatic chunking\n"); + zck->manual_chunk = 0; + } /* Hash options */ } else if(option < 100) { diff --git a/src/lib/zck_private.h b/src/lib/zck_private.h index 61b6a6c..c68c505 100644 --- a/src/lib/zck_private.h +++ b/src/lib/zck_private.h @@ -210,6 +210,7 @@ typedef struct zckCtx { int buzhash_width; int buzhash_match_bits; + int manual_chunk; } zckCtx; int get_tmp_fd() -- 2.30.2