From 307107ecd2fc3ffbf6fe91497daf767700f3572f Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 1 Sep 2019 22:42:49 +0200 Subject: Move command line processing stuff out of compressor code This commit moves stuff like printing help text, command line option processing and enumerating available processors on stdout out of the generic compressor code. The option string is replaced with a structure that directly exposese the tweakable parameters for all compressors. A function for parsing the command line arguments into this structure is added in sqfshelper. Signed-off-by: David Oberhollenzer --- lib/sqfshelper/sqfs_reader.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/sqfshelper/sqfs_reader.c') diff --git a/lib/sqfshelper/sqfs_reader.c b/lib/sqfshelper/sqfs_reader.c index 197e08f..49e91f5 100644 --- a/lib/sqfshelper/sqfs_reader.c +++ b/lib/sqfshelper/sqfs_reader.c @@ -14,6 +14,8 @@ int sqfs_reader_open(sqfs_reader_t *rd, const char *filename, int rdtree_flags) { + compressor_config_t cfg; + memset(rd, 0, sizeof(*rd)); rd->sqfsfd = open(filename, O_RDONLY); @@ -30,8 +32,11 @@ int sqfs_reader_open(sqfs_reader_t *rd, const char *filename, int rdtree_flags) goto fail_fd; } - rd->cmp = compressor_create(rd->super.compression_id, false, - rd->super.block_size, NULL); + compressor_config_init(&cfg, rd->super.compression_id, + rd->super.block_size, + SQFS_COMP_FLAG_UNCOMPRESS); + + rd->cmp = compressor_create(&cfg); if (rd->cmp == NULL) goto fail_fd; -- cgit v1.2.3