diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-25 09:13:39 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-27 01:05:42 +0100 |
commit | 3c1a4c2548cbbae96f44469278b53046c8b48868 (patch) | |
tree | cf528c5338f850012744e3376eae502767bfdc21 /lib/sqfs/comp/lzma.c | |
parent | c9429aeece3b8642de637f7a21e68046bd690658 (diff) |
Add a function to the compressor interface to get the configuration
This allows getting the compressor configuration back after
creating it, for various purposes.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/comp/lzma.c')
-rw-r--r-- | lib/sqfs/comp/lzma.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/sqfs/comp/lzma.c b/lib/sqfs/comp/lzma.c index 900cc14..451a6ca 100644 --- a/lib/sqfs/comp/lzma.c +++ b/lib/sqfs/comp/lzma.c @@ -143,6 +143,19 @@ static sqfs_s32 lzma_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in, return hdrsize; } +static void lzma_get_configuration(const sqfs_compressor_t *base, + sqfs_compressor_config_t *cfg) +{ + const lzma_compressor_t *lzma = (const lzma_compressor_t *)base; + + memset(cfg, 0, sizeof(*cfg)); + cfg->id = SQFS_COMP_LZMA; + cfg->block_size = lzma->block_size; + + if (base->do_block == lzma_uncomp_block) + cfg->flags |= SQFS_COMP_FLAG_UNCOMPRESS; +} + static sqfs_compressor_t *lzma_create_copy(sqfs_compressor_t *cmp) { lzma_compressor_t *copy = malloc(sizeof(*copy)); @@ -176,6 +189,7 @@ sqfs_compressor_t *lzma_compressor_create(const sqfs_compressor_config_t *cfg) if (lzma->block_size < SQFS_META_BLOCK_SIZE) lzma->block_size = SQFS_META_BLOCK_SIZE; + base->get_configuration = lzma_get_configuration; base->do_block = (cfg->flags & SQFS_COMP_FLAG_UNCOMPRESS) ? lzma_uncomp_block : lzma_comp_block; base->write_options = lzma_write_options; |