IMAGEX_NO_ACLS_OPTION,
IMAGEX_NO_WILDCARDS_OPTION,
IMAGEX_NOT_PIPABLE_OPTION,
+ IMAGEX_PACK_CHUNK_SIZE_OPTION,
IMAGEX_PACK_STREAMS_OPTION,
IMAGEX_PATH_OPTION,
IMAGEX_PIPABLE_OPTION,
{T("compress"), required_argument, NULL, IMAGEX_COMPRESS_OPTION},
{T("compress-slow"), no_argument, NULL, IMAGEX_COMPRESS_SLOW_OPTION},
{T("chunk-size"), required_argument, NULL, IMAGEX_CHUNK_SIZE_OPTION},
+ {T("pack-chunk-size"), required_argument, NULL, IMAGEX_PACK_CHUNK_SIZE_OPTION},
+ {T("solid-chunk-size"),required_argument, NULL, IMAGEX_PACK_CHUNK_SIZE_OPTION},
{T("pack-streams"), no_argument, NULL, IMAGEX_PACK_STREAMS_OPTION},
+ {T("solid"), no_argument, NULL, IMAGEX_PACK_STREAMS_OPTION},
{T("config"), required_argument, NULL, IMAGEX_CONFIG_OPTION},
{T("dereference"), no_argument, NULL, IMAGEX_DEREFERENCE_OPTION},
{T("flags"), required_argument, NULL, IMAGEX_FLAGS_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("solid"), no_argument, NULL, IMAGEX_PACK_STREAMS_OPTION},
{T("chunk-size"), required_argument, NULL, IMAGEX_CHUNK_SIZE_OPTION},
+ {T("pack-chunk-size"), required_argument, NULL, IMAGEX_PACK_CHUNK_SIZE_OPTION},
+ {T("solid-chunk-size"),required_argument, NULL, IMAGEX_PACK_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},
{T("compress-slow"), no_argument, NULL, IMAGEX_COMPRESS_SLOW_OPTION},
{T("recompress-slow"), no_argument, NULL, IMAGEX_COMPRESS_SLOW_OPTION},
{T("chunk-size"), required_argument, NULL, IMAGEX_CHUNK_SIZE_OPTION},
+ {T("pack-chunk-size"), required_argument, NULL, IMAGEX_PACK_CHUNK_SIZE_OPTION},
+ {T("solid-chunk-size"),required_argument, NULL, IMAGEX_PACK_CHUNK_SIZE_OPTION},
{T("pack-streams"),no_argument, NULL, IMAGEX_PACK_STREAMS_OPTION},
+ {T("solid"), no_argument, NULL, IMAGEX_PACK_STREAMS_OPTION},
{T("threads"), required_argument, NULL, IMAGEX_THREADS_OPTION},
{T("pipable"), no_argument, NULL, IMAGEX_PIPABLE_OPTION},
{T("not-pipable"), no_argument, NULL, IMAGEX_NOT_PIPABLE_OPTION},
}
}
-static int
+static void
set_compress_slow(void)
{
- int ret;
- static const struct wimlib_lzx_compressor_params slow_params = {
+ static const struct wimlib_lzx_compressor_params lzx_slow_params = {
.hdr = {
.size = sizeof(struct wimlib_lzx_compressor_params),
},
.alg_params = {
.slow = {
.use_len2_matches = 1,
- .num_fast_bytes = 96,
+ .nice_match_length = 96,
.num_optim_passes = 4,
.max_search_depth = 100,
.max_matches_per_pos = 10,
},
},
};
- ret = wimlib_set_default_compressor_params(WIMLIB_COMPRESSION_TYPE_LZX,
- &slow_params.hdr);
- if (ret)
- imagex_error(T("Couldn't set slow compression parameters.!"));
- return ret;
+
+ static const struct wimlib_lzms_compressor_params lzms_slow_params = {
+ .hdr = {
+ .size = sizeof(struct wimlib_lzms_compressor_params),
+ },
+ .min_match_length = 2,
+ .max_match_length = UINT32_MAX,
+ .nice_match_length = 96,
+ .max_search_depth = 100,
+ .max_matches_per_pos = 10,
+ .optim_array_length = 1024,
+ };
+
+ wimlib_set_default_compressor_params(WIMLIB_COMPRESSION_TYPE_LZX,
+ &lzx_slow_params.hdr);
+
+ wimlib_set_default_compressor_params(WIMLIB_COMPRESSION_TYPE_LZMS,
+ &lzms_slow_params.hdr);
}
struct string_set {
return 0;
switch (msg) {
case WIMLIB_PROGRESS_MSG_WRITE_STREAMS:
+ {
+ static bool first = true;
+ if (first) {
+ imagex_printf(T("Writing %"TS"-compressed data "
+ "using %u thread%"TS"\n"),
+ wimlib_get_compression_type_string(
+ info->write_streams.compression_type),
+ info->write_streams.num_threads,
+ (info->write_streams.num_threads == 1) ? T("") : T("s"));
+ first = false;
+ }
+ }
unit_shift = get_unit(info->write_streams.total_bytes, &unit_name);
percent_done = TO_PERCENT(info->write_streams.completed_bytes,
info->write_streams.total_bytes);
- if (info->write_streams.completed_streams == 0) {
- imagex_printf(T("Writing %"TS"-compressed data using %u thread%"TS"\n"),
- wimlib_get_compression_type_string(info->write_streams.compression_type),
- info->write_streams.num_threads,
- (info->write_streams.num_threads == 1) ? T("") : T("s"));
- }
if (info->write_streams.total_parts <= 1) {
imagex_printf(T("\r%"PRIu64" %"TS" of %"PRIu64" %"TS" (uncompressed) "
"written (%u%% done)"),
int write_flags = 0;
int compression_type = WIMLIB_COMPRESSION_TYPE_INVALID;
uint32_t chunk_size = UINT32_MAX;
+ uint32_t pack_chunk_size = UINT32_MAX;
const tchar *wimfile;
int wim_fd;
const tchar *name;
struct wimlib_capture_source *capture_sources;
size_t num_sources;
bool name_defaulted;
+ bool compress_slow = false;
for_opt(c, capture_or_append_options) {
switch (c) {
goto out_err;
break;
case IMAGEX_COMPRESS_SLOW_OPTION:
- ret = set_compress_slow();
- if (ret)
- goto out_err;
- compression_type = WIMLIB_COMPRESSION_TYPE_LZX;
+ compress_slow = true;
break;
case IMAGEX_CHUNK_SIZE_OPTION:
chunk_size = parse_chunk_size(optarg);
if (chunk_size == UINT32_MAX)
goto out_err;
break;
+ case IMAGEX_PACK_CHUNK_SIZE_OPTION:
+ pack_chunk_size = parse_chunk_size(optarg);
+ if (pack_chunk_size == UINT32_MAX)
+ goto out_err;
+ break;
case IMAGEX_PACK_STREAMS_OPTION:
write_flags |= WIMLIB_WRITE_FLAG_PACK_STREAMS;
break;
source = argv[0];
wimfile = argv[1];
- /* Set default compression type. */
+ /* Set default compression type and parameters. */
+
+
if (compression_type == WIMLIB_COMPRESSION_TYPE_INVALID) {
- struct wimlib_lzx_compressor_params params;
- memset(¶ms, 0, sizeof(params));
- params.hdr.size = sizeof(params);
- params.algorithm = WIMLIB_LZX_ALGORITHM_FAST;
- params.use_defaults = 1;
-
- wimlib_set_default_compressor_params(WIMLIB_COMPRESSION_TYPE_LZX,
- ¶ms.hdr);
compression_type = WIMLIB_COMPRESSION_TYPE_LZX;
+
+ if (!compress_slow) {
+ struct wimlib_lzx_compressor_params params = {
+ .hdr.size = sizeof(params),
+ .algorithm = WIMLIB_LZX_ALGORITHM_FAST,
+ .use_defaults = 1,
+ };
+ wimlib_set_default_compressor_params(WIMLIB_COMPRESSION_TYPE_LZX,
+ ¶ms.hdr);
+ }
}
+ if (compress_slow)
+ set_compress_slow();
+
if (!tstrcmp(wimfile, T("-"))) {
/* Writing captured WIM to standard output. */
#if 0
if (ret)
goto out_free_wim;
}
+ if (pack_chunk_size != UINT32_MAX) {
+ ret = wimlib_set_output_pack_chunk_size(wim, pack_chunk_size);
+ if (ret)
+ goto out_free_wim;
+ }
#ifndef __WIN32__
/* Detect if source is regular file or block device and set NTFS volume
STRING_SET(refglobs);
unsigned num_threads = 0;
uint32_t chunk_size = UINT32_MAX;
+ uint32_t pack_chunk_size = UINT32_MAX;
for_opt(c, export_options) {
switch (c) {
if (chunk_size == UINT32_MAX)
goto out_err;
break;
+ case IMAGEX_PACK_CHUNK_SIZE_OPTION:
+ pack_chunk_size = parse_chunk_size(optarg);
+ if (pack_chunk_size == UINT32_MAX)
+ goto out_err;
+ break;
case IMAGEX_REF_OPTION:
ret = string_set_append(&refglobs, optarg);
if (ret)
if (ret)
goto out_free_dest_wim;
}
+ if (pack_chunk_size != UINT32_MAX) {
+ ret = wimlib_set_output_pack_chunk_size(dest_wim, pack_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);
int write_flags = WIMLIB_WRITE_FLAG_REBUILD;
int compression_type = WIMLIB_COMPRESSION_TYPE_INVALID;
uint32_t chunk_size = UINT32_MAX;
+ uint32_t pack_chunk_size = UINT32_MAX;
int ret;
WIMStruct *wim;
const tchar *wimfile;
break;
case IMAGEX_COMPRESS_SLOW_OPTION:
write_flags |= WIMLIB_WRITE_FLAG_RECOMPRESS;
- compression_type = WIMLIB_COMPRESSION_TYPE_LZX;
- ret = set_compress_slow();
- if (ret)
- goto out_err;
+ set_compress_slow();
break;
case IMAGEX_CHUNK_SIZE_OPTION:
chunk_size = parse_chunk_size(optarg);
if (chunk_size == UINT32_MAX)
goto out_err;
break;
+ case IMAGEX_PACK_CHUNK_SIZE_OPTION:
+ pack_chunk_size = parse_chunk_size(optarg);
+ if (pack_chunk_size == UINT32_MAX)
+ goto out_err;
+ break;
case IMAGEX_PACK_STREAMS_OPTION:
write_flags |= WIMLIB_WRITE_FLAG_PACK_STREAMS;
write_flags |= WIMLIB_WRITE_FLAG_RECOMPRESS;
if (ret)
goto out_wimlib_free;
}
+ if (pack_chunk_size != UINT32_MAX) {
+ ret = wimlib_set_output_pack_chunk_size(wim, pack_chunk_size);
+ if (ret)
+ goto out_wimlib_free;
+ }
old_size = file_get_size(wimfile);
tprintf(T("\"%"TS"\" original size: "), wimfile);