*/
#include "config.h"
-#include "wimlib_tchar.h"
#include "wimlib.h"
+#include "wimlib_tchar.h"
#include <ctype.h>
#include <errno.h>
[OPTIMIZE] =
T(
IMAGEX_PROGNAME" optimize WIMFILE [--check] [--recompress]\n"
+" [--threads=NUM_THREADS]\n"
),
[SPLIT] =
T(
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},
};
{
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));
free(capture_sources);
out_free_source_list_contents:
free(source_list_contents);
-out:
return ret;
}
const tchar *wimfile;
off_t old_size;
off_t new_size;
+ unsigned num_threads = 0;
for_opt(c, optimize_options) {
switch (c) {
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;
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]);