summaryrefslogtreecommitdiff
path: root/mkfs
diff options
context:
space:
mode:
Diffstat (limited to 'mkfs')
-rw-r--r--mkfs/mkfs.c9
-rw-r--r--mkfs/mkfs.h1
-rw-r--r--mkfs/options.c11
3 files changed, 18 insertions, 3 deletions
diff --git a/mkfs/mkfs.c b/mkfs/mkfs.c
index dac0a34..c958d73 100644
--- a/mkfs/mkfs.c
+++ b/mkfs/mkfs.c
@@ -47,6 +47,12 @@ int main(int argc, char **argv)
process_command_line(&info.opt, argc, argv);
+ if (info.opt.comp_extra != NULL &&
+ strcmp(info.opt.comp_extra, "help") == 0) {
+ compressor_print_help(info.opt.compressor);
+ return EXIT_SUCCESS;
+ }
+
if (sqfs_super_init(&info.super, info.opt.blksz, info.opt.def_mtime,
info.opt.compressor)) {
return EXIT_FAILURE;
@@ -85,7 +91,8 @@ int main(int argc, char **argv)
fstree_sort(&info.fs);
info.cmp = compressor_create(info.super.compression_id, true,
- info.super.block_size);
+ info.super.block_size,
+ info.opt.comp_extra);
if (info.cmp == NULL) {
fputs("Error creating compressor\n", stderr);
goto out_outfd;
diff --git a/mkfs/mkfs.h b/mkfs/mkfs.h
index a555500..ca998ac 100644
--- a/mkfs/mkfs.h
+++ b/mkfs/mkfs.h
@@ -29,6 +29,7 @@ typedef struct {
const char *infile;
const char *outfile;
const char *selinux;
+ char *comp_extra;
} options_t;
typedef struct {
diff --git a/mkfs/options.c b/mkfs/options.c
index d7bdf16..14c648d 100644
--- a/mkfs/options.c
+++ b/mkfs/options.c
@@ -16,6 +16,7 @@ static struct option long_opts[] = {
{ "block-size", required_argument, NULL, 'b' },
{ "dev-block-size", required_argument, NULL, 'B' },
{ "defaults", required_argument, NULL, 'd' },
+ { "comp-extra", required_argument, NULL, 'X' },
{ "force", no_argument, NULL, 'f' },
{ "quiet", no_argument, NULL, 'q' },
#ifdef WITH_SELINUX
@@ -26,9 +27,9 @@ static struct option long_opts[] = {
};
#ifdef WITH_SELINUX
-static const char *short_opts = "s:c:b:B:d:fqhV";
+static const char *short_opts = "s:X:c:b:B:d:fqhV";
#else
-static const char *short_opts = "c:b:B:d:fqhV";
+static const char *short_opts = "X:c:b:B:d:fqhV";
#endif
enum {
@@ -91,6 +92,9 @@ static const char *help_string =
"\n"
" --compressor, -c <name> Select the compressor to use.\n"
" directories (defaults to 'xz').\n"
+" --comp-extra, -X <options> A comma seperated list of extra options for\n"
+" the selected compressor. Specify 'help' to\n"
+" get a list of available options.\n"
" --block-size, -b <size> Block size to use for Squashfs image.\n"
" Defaults to %u.\n"
" --dev-block-size, -B <size> Device block size to padd the image to.\n"
@@ -276,6 +280,9 @@ void process_command_line(options_t *opt, int argc, char **argv)
case 'q':
opt->quiet = true;
break;
+ case 'X':
+ opt->comp_extra = optarg;
+ break;
#ifdef WITH_SELINUX
case 's':
opt->selinux = optarg;