X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=programs%2Fimagex.c;h=372e115b64509d8b6a85ba72061038160c353aef;hb=c79cf52fe557f2ee301914a28ad0a6a270d2fea5;hp=ffc841f680d16fd008995bcd0f8f7be90c4e44bf;hpb=7e7aeb2b91b492886ebdc28e5bac0b25462c154b;p=wimlib diff --git a/programs/imagex.c b/programs/imagex.c index ffc841f6..372e115b 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -23,8 +23,8 @@ */ #include "config.h" -#include "wimlib_tchar.h" #include "wimlib.h" +#include "wimlib_tchar.h" #include #include @@ -145,6 +145,7 @@ IMAGEX_PROGNAME" mountrw WIMFILE [IMAGE_NUM | IMAGE_NAME] DIRECTORY\n" [OPTIMIZE] = T( IMAGEX_PROGNAME" optimize WIMFILE [--check] [--recompress]\n" +" [--threads=NUM_THREADS]\n" ), [SPLIT] = T( @@ -262,6 +263,7 @@ static const struct option mount_options[] = { static const struct option optimize_options[] = { {T("check"), no_argument, NULL, IMAGEX_CHECK_OPTION}, {T("recompress"), no_argument, NULL, IMAGEX_RECOMPRESS_OPTION}, + {T("threads"), required_argument, NULL, IMAGEX_THREADS_OPTION}, {NULL, 0, NULL, 0}, }; @@ -712,8 +714,7 @@ parse_capture_config(tchar **contents_p, size_t nchars, { ssize_t nlines; tchar *p; - struct wimlib_capture_source *sources; - size_t i, j; + size_t i; enum capture_config_section cur_section; memset(config, 0, sizeof(*config)); @@ -1499,7 +1500,6 @@ out_free_capture_sources: free(capture_sources); out_free_source_list_contents: free(source_list_contents); -out: return ret; } @@ -2256,6 +2256,7 @@ imagex_optimize(int argc, tchar **argv) const tchar *wimfile; off_t old_size; off_t new_size; + unsigned num_threads = 0; for_opt(c, optimize_options) { switch (c) { @@ -2266,6 +2267,11 @@ imagex_optimize(int argc, tchar **argv) case IMAGEX_RECOMPRESS_OPTION: write_flags |= WIMLIB_WRITE_FLAG_RECOMPRESS; break; + case IMAGEX_THREADS_OPTION: + num_threads = parse_num_threads(optarg); + if (num_threads == UINT_MAX) + return -1; + break; default: usage(OPTIMIZE); return -1; @@ -2293,7 +2299,8 @@ imagex_optimize(int argc, tchar **argv) else tprintf(T("%"PRIu64" KiB\n"), old_size >> 10); - ret = wimlib_overwrite(w, write_flags, 0, imagex_progress_func); + ret = wimlib_overwrite(w, write_flags, num_threads, + imagex_progress_func); if (ret == 0) { new_size = file_get_size(argv[0]);