From 58c5d7c933a714096ef0dd42bd1446a6e1a25a16 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 18 Aug 2019 18:57:11 +0200 Subject: Make data writer use block processor Signed-off-by: David Oberhollenzer --- tar/tar2sqfs.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tar') diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c index f583fd4..ed3aea1 100644 --- a/tar/tar2sqfs.c +++ b/tar/tar2sqfs.c @@ -30,6 +30,7 @@ static struct option long_opts[] = { { "block-size", required_argument, NULL, 'b' }, { "dev-block-size", required_argument, NULL, 'B' }, { "defaults", required_argument, NULL, 'd' }, + { "num-jobs", required_argument, NULL, 'j' }, { "comp-extra", required_argument, NULL, 'X' }, { "no-skip", no_argument, NULL, 's' }, { "no-xattr", no_argument, NULL, 'x' }, @@ -41,7 +42,7 @@ static struct option long_opts[] = { { "version", no_argument, NULL, 'V' }, }; -static const char *short_opts = "c:b:B:d:X:sxekfqhV"; +static const char *short_opts = "c:b:B:d:X:j:sxekfqhV"; static const char *usagestr = "Usage: tar2sqfs [OPTIONS...] \n" @@ -56,6 +57,7 @@ static const char *usagestr = " --comp-extra, -X A comma seperated list of extra options for\n" " the selected compressor. Specify 'help' to\n" " get a list of available options.\n" +" --num-jobs, -j Number of compressor jobs to create.\n" " --block-size, -b Block size to use for Squashfs image.\n" " Defaults to %u.\n" " --dev-block-size, -B Device block size to padd the image to.\n" @@ -92,6 +94,7 @@ static int block_size = SQFS_DEFAULT_BLOCK_SIZE; static size_t devblksize = SQFS_DEVBLK_SIZE; static bool quiet = false; static int outmode = O_WRONLY | O_CREAT | O_EXCL; +static unsigned int num_jobs = 1; static E_SQFS_COMPRESSOR comp_id; static char *comp_extra = NULL; static char *fs_defaults = NULL; @@ -139,6 +142,9 @@ static void process_args(int argc, char **argv) exit(EXIT_FAILURE); } break; + case 'j': + num_jobs = strtol(optarg, NULL, 0); + break; case 'X': comp_extra = optarg; break; @@ -387,7 +393,7 @@ int main(int argc, char **argv) super.bytes_used += ret; } - data = data_writer_create(&super, cmp, outfd, devblksize); + data = data_writer_create(&super, cmp, outfd, devblksize, num_jobs); if (data == NULL) goto out_cmp; -- cgit v1.2.3