aboutsummaryrefslogtreecommitdiff
path: root/src/xz/coder.h
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2023-04-18 20:29:09 +0800
committerJia Tan <jiat0218@gmail.com>2023-07-17 23:34:55 +0800
commitd6af7f347077b22403133239592e478931307759 (patch)
tree1f3783d66570c97add6fc39ea9d668d5659c1b91 /src/xz/coder.h
parentxz: Use lzma_filters_free() in forget_filter_chain(). (diff)
downloadxz-d6af7f347077b22403133239592e478931307759.tar.xz
xz: Create command line options for filters[1-9].
The new command line options are meant to be combined with --block-list. They work as an optional extension to --block-list to specify a custom filter chain for each block listed. The new options allow the creation of up to 9 reusable filter chains. For instance: xz --block-list=1:10MiB,3:5MiB,,2:5MiB,1:0 --filters1=delta--lzma2 \ --filters2=x86--lzma2 --filters3=arm64--lzma2 Will create the following blocks: 1. A block of size 10 MiB with filter chain delta, lzma2. 2. A block of size 5 MiB with filter chain arm64, lzma2. 3. A block of size 5 MiB with filter chain arm64, lzma2. 4. A block of size 5 MiB with filter chain x86, lzma2. 5. A block containing the rest of the file contents with filter chain delta, lzma2.
Diffstat (limited to '')
-rw-r--r--src/xz/coder.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/xz/coder.h b/src/xz/coder.h
index 997d2586..7a255939 100644
--- a/src/xz/coder.h
+++ b/src/xz/coder.h
@@ -30,6 +30,18 @@ enum format_type {
};
+/// Simple struct to track Block metadata specified through the
+/// --block-list option.
+typedef struct {
+ /// Uncompressed size of the Block
+ uint64_t size;
+
+ /// Index into the filters[] representing the filter chain to use
+ /// for this Block.
+ uint32_t filters_index;
+} block_list_entry;
+
+
/// Operation mode of the command line tool. This is set in args.c and read
/// in several files.
extern enum operation_mode opt_mode;
@@ -50,9 +62,8 @@ extern bool opt_single_stream;
/// of input. This has an effect only when compressing to the .xz format.
extern uint64_t opt_block_size;
-/// This is non-NULL if --block-list was used. This contains the Block sizes
-/// as an array that is terminated with 0.
-extern uint64_t *opt_block_list;
+/// List of block size and filter chain pointer pairs.
+extern block_list_entry *opt_block_list;
/// Set the integrity check type used when compressing
extern void coder_set_check(lzma_check check);
@@ -80,3 +91,6 @@ extern void coder_free(void);
/// Create filter chain from string
extern void coder_add_filters_from_str(const char *filter_str);
+
+/// Add or overwrite a filter that can be used by the block-list.
+extern void coder_add_block_filters(const char *str, size_t slot);