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/gzip.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/gzip.c')
-rw-r--r-- | lib/sqfs/comp/gzip.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/sqfs/comp/gzip.c b/lib/sqfs/comp/gzip.c index 37491bb..34164a6 100644 --- a/lib/sqfs/comp/gzip.c +++ b/lib/sqfs/comp/gzip.c @@ -44,6 +44,22 @@ static void gzip_destroy(sqfs_object_t *base) free(gzip); } +static void gzip_get_configuration(const sqfs_compressor_t *base, + sqfs_compressor_config_t *cfg) +{ + const gzip_compressor_t *gzip = (const gzip_compressor_t *)base; + + memset(cfg, 0, sizeof(*cfg)); + cfg->id = SQFS_COMP_GZIP; + cfg->flags = gzip->opt.strategies; + cfg->block_size = gzip->block_size; + cfg->opt.gzip.level = gzip->opt.level; + cfg->opt.gzip.window_size = gzip->opt.window; + + if (!gzip->compress) + cfg->flags |= SQFS_COMP_FLAG_UNCOMPRESS; +} + static int gzip_write_options(sqfs_compressor_t *base, sqfs_file_t *file) { gzip_compressor_t *gzip = (gzip_compressor_t *)base; @@ -263,6 +279,7 @@ sqfs_compressor_t *gzip_compressor_create(const sqfs_compressor_config_t *cfg) gzip->opt.strategies = cfg->flags & SQFS_COMP_FLAG_GZIP_ALL; gzip->compress = (cfg->flags & SQFS_COMP_FLAG_UNCOMPRESS) == 0; gzip->block_size = cfg->block_size; + base->get_configuration = gzip_get_configuration; base->do_block = gzip_do_block; base->write_options = gzip_write_options; base->read_options = gzip_read_options; |