diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-23 10:38:08 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-23 10:38:08 +0200 |
commit | 8cc0ed034504b744e6b1dd1af5db86bb97968097 (patch) | |
tree | 368a7d46cce1854bd4ea7d08855a4a1ea6d07e6d /tar/tar2sqfs.c | |
parent | b7267b9552555d557ff7e42ed5373be769eef4bf (diff) |
Add block size and device block size options to tar2sqfs
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tar/tar2sqfs.c')
-rw-r--r-- | tar/tar2sqfs.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c index 8592fcb..8c55ea3 100644 --- a/tar/tar2sqfs.c +++ b/tar/tar2sqfs.c @@ -20,15 +20,17 @@ static struct option long_opts[] = { { "compressor", required_argument, NULL, 'c' }, - { "comp-extra", required_argument, NULL, 'X' }, + { "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' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, }; -static const char *short_opts = "c:X:d:fqhV"; +static const char *short_opts = "c:b:B:d:X:fqhV"; static const char *usagestr = "Usage: tar2sqfs [OPTIONS...] <sqfsfile>\n" @@ -43,6 +45,10 @@ static const char *usagestr = " --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" +" Defaults to %u.\n" " --defaults, -d <options> A comma seperated list of default values for\n" " implicitly created directories.\n" "\n" @@ -86,6 +92,17 @@ static void process_args(int argc, char **argv) break; switch (i) { + case 'b': + block_size = strtol(optarg, NULL, 0); + break; + case 'B': + devblksize = strtol(optarg, NULL, 0); + if (devblksize < 1024) { + fputs("Device block size must be at " + "least 1024\n", stderr); + exit(EXIT_FAILURE); + } + break; case 'c': have_compressor = true; @@ -114,7 +131,8 @@ static void process_args(int argc, char **argv) quiet = true; break; case 'h': - fputs(usagestr, stdout); + printf(help_string, SQFS_DEFAULT_BLOCK_SIZE, + SQFS_DEVBLK_SIZE); compressor_print_available(); exit(EXIT_SUCCESS); case 'V': |