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 --- mkfs/mkfs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'mkfs/mkfs.c') diff --git a/mkfs/mkfs.c b/mkfs/mkfs.c index 5759744..512b30b 100644 --- a/mkfs/mkfs.c +++ b/mkfs/mkfs.c @@ -93,6 +93,7 @@ static int read_fstree(fstree_t *fs, options_t *opt) int main(int argc, char **argv) { int status = EXIT_FAILURE, ret; + compressor_config_t cfg; data_writer_t *data; sqfs_super_t super; compressor_t *cmp; @@ -103,6 +104,11 @@ int main(int argc, char **argv) process_command_line(&opt, argc, argv); + if (compressor_cfg_init_options(&cfg, opt.compressor, + opt.blksz, opt.comp_extra)) { + return EXIT_FAILURE; + } + if (fstree_init(&fs, opt.blksz, opt.fs_defaults)) return EXIT_FAILURE; @@ -144,8 +150,7 @@ int main(int argc, char **argv) fstree_xattr_deduplicate(&fs); - cmp = compressor_create(super.compression_id, true, super.block_size, - opt.comp_extra); + cmp = compressor_create(&cfg); if (cmp == NULL) { fputs("Error creating compressor\n", stderr); goto out_outfd; -- cgit v1.2.3