From: Eric Biggers Date: Fri, 27 Dec 2013 00:10:21 +0000 (-0600) Subject: wimexport: Add --chunk-size, --pack-streams X-Git-Tag: v1.6.0~85 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=5f369c364f9ce91b4681d683e9eac8f8226f08ce wimexport: Add --chunk-size, --pack-streams --- diff --git a/programs/imagex.c b/programs/imagex.c index 9d68acc9..51db7174 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -231,6 +231,8 @@ static const struct option export_options[] = { {T("nocheck"), no_argument, NULL, IMAGEX_NOCHECK_OPTION}, {T("no-check"), no_argument, NULL, IMAGEX_NOCHECK_OPTION}, {T("compress"), required_argument, NULL, IMAGEX_COMPRESS_OPTION}, + {T("pack-streams"),no_argument, NULL, IMAGEX_PACK_STREAMS_OPTION}, + {T("chunk-size"), required_argument, NULL, IMAGEX_CHUNK_SIZE_OPTION}, {T("ref"), required_argument, NULL, IMAGEX_REF_OPTION}, {T("threads"), required_argument, NULL, IMAGEX_THREADS_OPTION}, {T("rebuild"), no_argument, NULL, IMAGEX_REBUILD_OPTION}, @@ -2410,6 +2412,7 @@ imagex_export(int argc, tchar **argv, int cmd) bool wim_is_new; STRING_SET(refglobs); unsigned num_threads = 0; + uint32_t chunk_size = UINT32_MAX; for_opt(c, export_options) { switch (c) { @@ -2428,6 +2431,14 @@ imagex_export(int argc, tchar **argv, int cmd) if (compression_type == WIMLIB_COMPRESSION_TYPE_INVALID) goto out_err; break; + case IMAGEX_PACK_STREAMS_OPTION: + write_flags |= WIMLIB_WRITE_FLAG_PACK_STREAMS; + break; + case IMAGEX_CHUNK_SIZE_OPTION: + chunk_size = parse_chunk_size(optarg); + if (chunk_size == UINT32_MAX) + goto out_err; + break; case IMAGEX_REF_OPTION: ret = string_set_append(&refglobs, optarg); if (ret) @@ -2546,10 +2557,18 @@ imagex_export(int argc, tchar **argv, int cmd) goto out_free_src_wim; /* Use same chunk size if compression type is the same. */ - if (compression_type == src_info.compression_type) + if (compression_type == src_info.compression_type && + chunk_size == UINT32_MAX) wimlib_set_output_chunk_size(dest_wim, src_info.chunk_size); } + if (chunk_size != UINT32_MAX) { + /* Set destination chunk size. */ + ret = wimlib_set_output_chunk_size(dest_wim, chunk_size); + if (ret) + goto out_free_dest_wim; + } + image = wimlib_resolve_image(src_wim, src_image_num_or_name); ret = verify_image_exists(image, src_image_num_or_name, src_wimfile); if (ret)