X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=programs%2Fimagex.c;h=9ebe277181dee6b7eb559f26131214f51b177c7d;hb=06c208689d042c215bb9882232aabb0d98c01875;hp=92e64ee775d0b815567e1eb99a566a55b45741c1;hpb=75ae4dea652f77afef63d073cbb882080621aea6;p=wimlib diff --git a/programs/imagex.c b/programs/imagex.c index 92e64ee7..9ebe2771 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -196,6 +196,7 @@ static const struct option capture_or_append_options[] = { {T("compress-slow"), no_argument, NULL, IMAGEX_COMPRESS_SLOW_OPTION}, {T("chunk-size"), required_argument, NULL, IMAGEX_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}, @@ -234,6 +235,7 @@ static const struct option export_options[] = { {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("ref"), required_argument, NULL, IMAGEX_REF_OPTION}, {T("threads"), required_argument, NULL, IMAGEX_THREADS_OPTION}, @@ -298,6 +300,7 @@ static const struct option optimize_options[] = { {T("recompress-slow"), no_argument, NULL, IMAGEX_COMPRESS_SLOW_OPTION}, {T("chunk-size"), required_argument, NULL, IMAGEX_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}, @@ -434,11 +437,10 @@ get_compression_type(const tchar *optarg) } } -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), }, @@ -446,7 +448,7 @@ set_compress_slow(void) .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, @@ -456,11 +458,24 @@ set_compress_slow(void) }, }, }; - 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 { @@ -1079,7 +1094,7 @@ report_scan_progress(const struct wimlib_progress_info_scan *scan, bool done) unit_shift = get_unit(scan->num_bytes_scanned, &unit_name); imagex_printf(T("\r%"PRIu64" %"TS" scanned (%"PRIu64" files, " - "%"PRIu64" directories)"), + "%"PRIu64" directories) "), scan->num_bytes_scanned >> unit_shift, unit_name, scan->num_nondirs_scanned, @@ -1101,16 +1116,22 @@ imagex_progress_func(enum wimlib_progress_msg msg, 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)"), @@ -1159,6 +1180,14 @@ imagex_progress_func(enum wimlib_progress_msg msg, imagex_printf(T("\nWARNING: Excluding unsupported file or directory\n" " \"%"TS"\" from capture\n"), info->scan.cur_path); break; + case WIMLIB_SCAN_DENTRY_EXCLUDED_SYMLINK: + imagex_printf(T("\nWARNING: Ignoring absolute symbolic link " + "with out-of-tree target:\n" + " \"%"TS"\" => \"%"TS"\"\n" + " (Use --norpfix to capture " + "absolute symbolic links as-is)\n"), + info->scan.cur_path, info->scan.symlink_target); + break; } break; case WIMLIB_PROGRESS_MSG_SCAN_END: @@ -1205,14 +1234,17 @@ imagex_progress_func(enum wimlib_progress_msg msg, info->extract.target); break; case WIMLIB_PROGRESS_MSG_EXTRACT_TREE_BEGIN: - imagex_printf(T("Extracting " - "\""WIMLIB_WIM_PATH_SEPARATOR_STRING"%"TS"\" from image %d (\"%"TS"\") " - "in \"%"TS"\" to \"%"TS"\"\n"), - info->extract.extract_root_wim_source_path, - info->extract.image, - info->extract.image_name, - info->extract.wimfile_name, - info->extract.target); + if (info->extract.extract_root_wim_source_path[0] != T('\0')) { + imagex_printf(T("Extracting " + "\""WIMLIB_WIM_PATH_SEPARATOR_STRING"%"TS"\" " + "from image %d (\"%"TS"\") " + "in \"%"TS"\" to \"%"TS"\"\n"), + info->extract.extract_root_wim_source_path, + info->extract.image, + info->extract.image_name, + info->extract.wimfile_name, + info->extract.target); + } break; case WIMLIB_PROGRESS_MSG_EXTRACT_STREAMS: percent_done = TO_PERCENT(info->extract.completed_bytes, @@ -1541,7 +1573,7 @@ imagex_apply(int argc, tchar **argv, int cmd) const tchar *wimfile; const tchar *target; const tchar *image_num_or_name = NULL; - int extract_flags = WIMLIB_EXTRACT_FLAG_SEQUENTIAL; + int extract_flags = 0; STRING_SET(refglobs); @@ -1751,6 +1783,7 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd) 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) { @@ -1774,10 +1807,7 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd) 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); @@ -1871,19 +1901,26 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd) 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 @@ -2703,7 +2740,7 @@ imagex_extract(int argc, tchar **argv, int cmd) const tchar *image_num_or_name; const tchar *pathlist; tchar *dest_dir = T("."); - int extract_flags = WIMLIB_EXTRACT_FLAG_SEQUENTIAL | WIMLIB_EXTRACT_FLAG_NORPFIX; + int extract_flags = WIMLIB_EXTRACT_FLAG_NORPFIX; int listfile_extract_flags = WIMLIB_EXTRACT_FLAG_GLOB_PATHS; STRING_SET(refglobs); @@ -3398,10 +3435,7 @@ imagex_optimize(int argc, tchar **argv, int cmd) 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);