From 894f8dab7f174bf289e6b5e9ea54374d10d6e62f Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 13 Feb 2015 22:04:41 -0600 Subject: [PATCH] Consistently use the name "solid resource" --- README | 5 +- doc/man1/wimlib-imagex-apply.1 | 2 +- doc/man1/wimlib-imagex-capture.1 | 6 +- doc/man1/wimlib-imagex-export.1 | 6 +- doc/man1/wimlib-imagex-extract.1 | 2 +- doc/man1/wimlib-imagex-mount.1 | 2 +- doc/man1/wimlib-imagex-optimize.1 | 4 +- doc/man1/wimlib-imagex.1 | 2 +- include/wimlib.h | 40 ++--- include/wimlib/header.h | 23 ++- include/wimlib/lookup_table.h | 11 +- include/wimlib/resource.h | 46 +++--- include/wimlib/wim.h | 8 +- include/wimlib/write.h | 2 +- programs/imagex.c | 14 +- src/header.c | 4 +- src/lookup_table.c | 246 +++++++++++++++--------------- src/resource.c | 30 ++-- src/split.c | 4 +- src/wim.c | 24 +-- src/write.c | 185 +++++++++++----------- 21 files changed, 335 insertions(+), 331 deletions(-) diff --git a/README b/README index 281ad361..4baeedc0 100644 --- a/README +++ b/README @@ -116,7 +116,8 @@ Notes: [8] '--solid' for wimlib-imagex. Should be '/compress:recovery' for DISM, but only works for /Export-Image, not /Capture-Image. Compression chunk - size in solid blocks defaults to 33554432 for wimlib, 67108864 for DISM. + size in solid resources defaults to 33554432 for wimlib, 67108864 for + DISM. [9] '--wimboot' for wimlib-imagex; '/wimboot' for DISM. This is really XPRESS compression with 4096 byte chunks, so the same as @@ -327,7 +328,7 @@ extensions are used in the code. The WIM file format is partially specified in a document that can be found in the Microsoft Download Center. However, this document really only provides an overview of the format and is not a formal specification. It also does not -cover later extensions of the format, such as solid blocks. +cover later extensions of the format, such as solid resources. With regards to the supported compression formats: diff --git a/doc/man1/wimlib-imagex-apply.1 b/doc/man1/wimlib-imagex-apply.1 index 9667ff56..3fc51542 100644 --- a/doc/man1/wimlib-imagex-apply.1 +++ b/doc/man1/wimlib-imagex-apply.1 @@ -429,7 +429,7 @@ entire WIM file and is checked separately if the \fB--check\fR option is specified. .PP \fIESD files\fR: wimlib v1.6.0 and later can extract files from version 3584 -WIMs, which usually contain LZMS-compressed solid blocks and may carry the +WIMs, which usually contain LZMS-compressed solid resources and may carry the \fI.esd\fR file extension rather than \fI.wim\fR. However, \fI.esd\fR files downloaded directly by the Windows 8 web downloader have encrypted segments, and wimlib cannot extract such files until they are first decrypted. diff --git a/doc/man1/wimlib-imagex-capture.1 b/doc/man1/wimlib-imagex-capture.1 index a78b0b27..2506ee81 100644 --- a/doc/man1/wimlib-imagex-capture.1 +++ b/doc/man1/wimlib-imagex-capture.1 @@ -234,18 +234,18 @@ mounted with \fBwimlib-imagex mount\fR. Also, WIMs created using this option use a different version number in their header and are only compatible with WIMGAPI Windows 8 and later, and DISM Windows 8.1 and later. .IP "" -The default compression type and chunk size in solid blocks is LZMS with 2^25 +The default compression type and chunk size in solid resources is LZMS with 2^25 (33554432) byte chunks. This is independent of the WIM's main compression type and chunk size. .TP \fB--solid-chunk-size\fR=\fISIZE\fR -Like \fB--chunk-size\fR, but set the chunk size used in solid blocks. The +Like \fB--chunk-size\fR, but set the chunk size used in solid resources. The default is LZMS compression with 2^25 (33554432) byte chunks. This option only has an effect when \fB--solid\fR is also specified. For maximum compatibility with the Microsoft implementation, do not use either of these options. .TP \fB--solid-compress\fR=\fITYPE\fR[:\fILEVEL\fR] -Like \fB--compress\fR, but set the compression type used in solid blocks. The +Like \fB--compress\fR, but set the compression type used in solid resources. The default is LZMS compression with 2^25 (33554432) byte chunks. This option only has an effect when \fB--solid\fR is also specified. For maximum compatibility with the Microsoft implementation, do not use either of these options. diff --git a/doc/man1/wimlib-imagex-export.1 b/doc/man1/wimlib-imagex-export.1 index a4030a1b..3d0e621d 100644 --- a/doc/man1/wimlib-imagex-export.1 +++ b/doc/man1/wimlib-imagex-export.1 @@ -88,12 +88,12 @@ compatibility. See the documentation for this option to \fBwimlib-imagex capture\fR (1) for more details. .TP \fB--solid-chunk-size\fR=\fISIZE\fR -Like \fB--chunk-size\fR, but set the chunk size used in solid blocks. See the +Like \fB--chunk-size\fR, but set the chunk size used in solid resources. See the documentation for this option to \fBwimlib-imagex capture\fR (1) for more details. .TP \fB--solid-compress\fR=\fITYPE\fR[:\fILEVEL\fR] -Like \fB--compress\fR, but set the compression type used in solid blocks. See +Like \fB--compress\fR, but set the compression type used in solid resources. See the documentation for this option to \fBwimlib-imagex capture\fR (1) for more details. .TP @@ -170,7 +170,7 @@ image's metadata resource, which describes the full directory structure, will always be created. .PP \fIESD files\fR: wimlib v1.6.0 and later can export images from version 3584 -WIMs, which usually contain LZMS-compressed solid blocks and may carry the +WIMs, which usually contain LZMS-compressed solid resources and may carry the \fI.esd\fR file extension rather than \fI.wim\fR. However, \fI.esd\fR files downloaded directly by the Windows 8 web downloader have encrypted segments, and wimlib cannot export images from such files until they are first decrypted. In diff --git a/doc/man1/wimlib-imagex-extract.1 b/doc/man1/wimlib-imagex-extract.1 index f0379912..21c9535e 100644 --- a/doc/man1/wimlib-imagex-extract.1 +++ b/doc/man1/wimlib-imagex-extract.1 @@ -168,7 +168,7 @@ Unlike \fBwimlib-imagex apply\fR, \fBwimlib-imagex extract\fR does not support extracting files directly to an NTFS volume using libntfs-3g. .PP wimlib v1.6.0 and later can extract files from version 3584 WIMs, which usually -contain LZMS-compressed solid blocks and may carry the \fI.esd\fR file extension +contain LZMS-compressed solid resources and may carry the \fI.esd\fR file extension rather than \fI.wim\fR. However, \fI.esd\fR files downloaded directly by the Windows 8 web downloader have encrypted segments, and wimlib cannot extract such files until they are first decrypted. Furthermore, such files are not designed diff --git a/doc/man1/wimlib-imagex-mount.1 b/doc/man1/wimlib-imagex-mount.1 index 66ae7ad0..ba7bd533 100644 --- a/doc/man1/wimlib-imagex-mount.1 +++ b/doc/man1/wimlib-imagex-mount.1 @@ -74,7 +74,7 @@ the WIM to be rebuilt, or else run \fBwimlib-imagex optimize\fR on the WIM afterwards. .PP wimlib v1.6.0 and later can mount version 3584 WIMs, which usually contain -LZMS-compressed solid blocks and may carry the \fI.esd\fR file extension rather +LZMS-compressed solid resources and may carry the \fI.esd\fR file extension rather than \fI.wim\fR. However, such files are not designed for random access, so reading data from them when mounted may be very slow. In addition, \fI.esd\fR files downloaded directly by the Windows 8 web downloader have encrypted diff --git a/doc/man1/wimlib-imagex-optimize.1 b/doc/man1/wimlib-imagex-optimize.1 index 64fe9a95..2f82a739 100644 --- a/doc/man1/wimlib-imagex-optimize.1 +++ b/doc/man1/wimlib-imagex-optimize.1 @@ -53,12 +53,12 @@ compatibility. See the documentation for this option to \fBwimlib-imagex capture\fR (1) for more details. .TP \fB--solid-chunk-size\fR=\fISIZE\fR -Like \fB--chunk-size\fR, but set the chunk size used in solid blocks. See the +Like \fB--chunk-size\fR, but set the chunk size used in solid resources. See the documentation for this option to \fBwimlib-imagex capture\fR (1) for more details. .TP \fB--solid-compress\fR=\fITYPE\fR[:\fILEVEL\fR] -Like \fB--compress\fR, but set the compression type used in solid blocks. See +Like \fB--compress\fR, but set the compression type used in solid resources. See the documentation for this option to \fBwimlib-imagex capture\fR (1) for more details. .TP diff --git a/doc/man1/wimlib-imagex.1 b/doc/man1/wimlib-imagex.1 index af32704e..1e60509f 100644 --- a/doc/man1/wimlib-imagex.1 +++ b/doc/man1/wimlib-imagex.1 @@ -171,7 +171,7 @@ independent implementations of all these compression algorithms. Sometimes they can do better than the equivalent Microsoft implementations. .IP \[bu] "ESD file" support. As mentioned in \fBBACKGROUND INFORMATION\fR, "ESD files" -use a new WIM format that features solid blocks and LZMS compression. This +use a new WIM format that features solid resources and LZMS compression. This support was first present in wimlib v1.6.0, but v1.7.0 and later have improved compatibility. .IP \[bu] diff --git a/include/wimlib.h b/include/wimlib.h index 393787d1..26719cba 100644 --- a/include/wimlib.h +++ b/include/wimlib.h @@ -1392,7 +1392,7 @@ struct wimlib_wim_info { }; /** Information about a unique stream in the WIM file. (A stream is the same - * thing as a "resource", except in the case of packed resources.) */ + * thing as a "resource", except in the case of solid resources.) */ struct wimlib_resource_entry { /** Uncompressed size of the stream in bytes. */ uint64_t uncompressed_size; @@ -1404,7 +1404,7 @@ struct wimlib_resource_entry { /** Offset, in bytes, of this stream from the start of the WIM file. Or * if @p packed is 1, then this is actually the offset at which this - * stream begins in the uncompressed contents of the packed resource. + * stream begins in the uncompressed contents of the solid resource. */ uint64_t offset; @@ -1433,18 +1433,18 @@ struct wimlib_resource_entry { * */ uint32_t is_missing : 1; - /** 1 if this stream is located in a packed resource which may contain + /** 1 if this stream is located in a solid resource which may contain * other streams (all compressed together) as well. */ uint32_t packed : 1; uint32_t reserved_flags : 26; - /** If @p packed is 1, then this will specify the offset of the packed + /** If @p packed is 1, then this will specify the offset of the solid * resource in the WIM. */ uint64_t raw_resource_offset_in_wim; /** If @p packed is 1, then this will specify the compressed size of the - * packed resource in the WIM. */ + * solid resource in the WIM. */ uint64_t raw_resource_compressed_size; uint64_t reserved[2]; @@ -2119,10 +2119,10 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour * wimlib_set_default_compression_level() can be called beforehand to set an * even higher compression level than the default. * - * If the WIM contains solid blocks, then ::WIMLIB_WRITE_FLAG_RECOMPRESS can be - * used in combination with ::WIMLIB_WRITE_FLAG_PACK_STREAMS to prevent any - * solid blocks from being re-used. Otherwise, solid blocks are re-used - * somewhat more liberally than normal compressed blocks. + * If the WIM contains solid resources, then ::WIMLIB_WRITE_FLAG_RECOMPRESS can + * be used in combination with ::WIMLIB_WRITE_FLAG_SOLID to prevent any solid + * resources from being re-used. Otherwise, solid resources are re-used + * somewhat more liberally than normal compressed resources. * * ::WIMLIB_WRITE_FLAG_RECOMPRESS does not cause recompression of streams * that would not otherwise be written. For example, a call to @@ -2216,8 +2216,8 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour #define WIMLIB_WRITE_FLAG_RETAIN_GUID 0x00000800 /** - * When writing streams in the resulting WIM file, pack multiple streams into a - * single compressed resource instead of compressing them independently. This + * When writing streams in the resulting WIM file, combine multiple streams into + * a single compressed resource instead of compressing them independently. This * is also known as creating a "solid archive". This tends to produce a better * compression ratio at the cost of much slower random access. * @@ -2231,23 +2231,29 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour * ::WIMLIB_WRITE_FLAG_RECOMPRESS to force the entire WIM file be rebuilt with * all streams recompressed in solid mode. * - * Currently, new solid blocks will, by default, be written using LZMS + * Currently, new solid resources will, by default, be written using LZMS * compression with 32 MiB (33554432 byte) chunks. Use * wimlib_set_output_pack_compression_type() and/or * wimlib_set_output_pack_chunk_size() to change this. This is independent of * the WIM's main compression type and chunk size; you can have a WIM that * nominally uses LZX compression and 32768 byte chunks but actually contains - * LZMS-compressed solid blocks, for example. However, if including solid + * LZMS-compressed solid resources, for example. However, if including solid * blocks, I suggest that you set the WIM's main compression type to LZMS as * well, either by creating the WIM with * ::wimlib_create_new_wim(::WIMLIB_COMPRESSION_TYPE_LZMS, ...) or by calling * ::wimlib_set_output_compression_type(..., ::WIMLIB_COMPRESSION_TYPE_LZMS). * * This flag will be set by default when writing or overwriting a WIM file that - * either already contains packed streams, or has had packed streams exported + * either already contains solid resources, or has had solid resources exported * into it and the WIM's main compression type is LZMS. */ -#define WIMLIB_WRITE_FLAG_PACK_STREAMS 0x00001000 +#define WIMLIB_WRITE_FLAG_SOLID 0x00001000 + +/** + * Deprecated: this is the old name for ::WIMLIB_WRITE_FLAG_SOLID, retained for + * source compatibility. + */ +#define WIMLIB_WRITE_FLAG_PACK_STREAMS WIMLIB_WRITE_FLAG_SOLID /** * Send ::WIMLIB_PROGRESS_MSG_DONE_WITH_FILE messages while writing the WIM @@ -4031,7 +4037,7 @@ wimlib_set_output_chunk_size(WIMStruct *wim, uint32_t chunk_size); * @ingroup G_writing_and_overwriting_wims * * Similar to wimlib_set_output_chunk_size(), but set the chunk size for writing - * packed streams (solid blocks). + * solid resources. */ extern int wimlib_set_output_pack_chunk_size(WIMStruct *wim, uint32_t chunk_size); @@ -4062,7 +4068,7 @@ wimlib_set_output_compression_type(WIMStruct *wim, int ctype); * @ingroup G_writing_and_overwriting_wims * * Similar to wimlib_set_output_compression_type(), but set the compression type - * for writing packed streams (solid blocks). + * for writing solid resources. */ extern int wimlib_set_output_pack_compression_type(WIMStruct *wim, int ctype); diff --git a/include/wimlib/header.h b/include/wimlib/header.h index 2cd1abaf..35eb72c7 100644 --- a/include/wimlib/header.h +++ b/include/wimlib/header.h @@ -16,12 +16,12 @@ /* Default WIM version number. Streams are always compressed independently. */ #define WIM_VERSION_DEFAULT 0x10d00 -/* Version number used for WIMs that allow multiple streams packed into one - * resource ("solid blocks", marked by WIM_RESHDR_FLAG_PACKED_STREAMS) and also - * a new compression format (LZMS). This version is new as of Windows 8 - * WIMGAPI. Although it is used by Windows 8 web downloader, it is not yet - * properly documented by Microsoft. */ -#define WIM_VERSION_PACKED_STREAMS 0xe00 +/* Version number used for WIMs that allow multiple streams combined into one + * resource ("solid resources", marked by WIM_RESHDR_FLAG_SOLID) and also a new + * compression format (LZMS). This version is new as of Windows 8 WIMGAPI. + * Although it is used by Windows 8 web downloader, it is not yet properly + * documented by Microsoft. */ +#define WIM_VERSION_SOLID 0xe00 /* Note: there is another WIM version from Vista pre-releases, but it is not * supported by wimlib. */ @@ -66,10 +66,9 @@ struct wim_header_disk { /* +0x10: Flags for the WIM file (WIM_HDR_FLAG_*). */ u32 wim_flags; - /* +0x14: Uncompressed chunk size for compressed resources in the WIM - * other than packed resources, or 0 if the WIM is uncompressed. - * (However wimlib will currently accept any value here if the WIM is - * uncompressed.) */ + /* +0x14: Uncompressed chunk size for non-solid compressed resources in + * the WIM or 0 if the WIM is uncompressed. (However wimlib will accept + * any value here if the WIM is uncompressed.) */ u32 chunk_size; /* +0x18: Globally unique identifier for the WIM file. Basically a @@ -188,8 +187,8 @@ struct wim_header { /* Resources in the WIM with WIM_RESHDR_FLAG_COMPRESSED set in their headers are * compressed with LZMS compression. Note: this flag is only valid if the WIM - * version is WIM_VERSION_PACKED_STREAMS. Also, this flag is only supported in - * wimlib v1.6.0 and later and WIMGAPI Windows 8 and later. */ + * version is WIM_VERSION_SOLID. Also, this flag is only supported in wimlib + * v1.6.0 and later and WIMGAPI Windows 8 and later. */ #define WIM_HDR_FLAG_COMPRESS_LZMS 0x00080000 /* XPRESS, with small chunk size??? */ diff --git a/include/wimlib/lookup_table.h b/include/wimlib/lookup_table.h index 9f6e3ea3..9c727507 100644 --- a/include/wimlib/lookup_table.h +++ b/include/wimlib/lookup_table.h @@ -22,9 +22,8 @@ enum resource_location { /* The stream is located in a resource in a WIM file identified by the * `struct wim_resource_spec' pointed to by @rspec. @offset_in_res * identifies the offset at which this particular stream begins in the - * uncompressed data of the resource; this is normally 0, but in general - * a WIM resource may be "packed" and potentially contain multiple - * streams. */ + * uncompressed data of the resource; this is normally 0, but a WIM + * resource can be "solid" and contain multiple streams. */ RESOURCE_IN_WIM, /* The stream is located in the external file named by @file_on_disk. @@ -200,9 +199,9 @@ struct wim_lookup_table_entry { /* List node used for stream size table. */ struct hlist_node hash_list_2; - /* Metadata for the underlying packed resource - * in the WIM being written (only valid if - * WIM_RESHDR_FLAG_PACKED_STREAMS set in + /* Metadata for the underlying solid resource in + * the WIM being written (only valid if + * WIM_RESHDR_FLAG_SOLID set in * out_reshdr.flags). */ struct { u64 out_res_offset_in_wim; diff --git a/include/wimlib/resource.h b/include/wimlib/resource.h index 61ce69b5..5572f523 100644 --- a/include/wimlib/resource.h +++ b/include/wimlib/resource.h @@ -10,17 +10,17 @@ struct filedes; struct wim_lookup_table_entry; struct wim_image_metadata; -/* Specification of a resource in a WIM file. +/* + * Specification of a resource in a WIM file. * - * If a `struct wim_lookup_table_entry' lte has - * (lte->resource_location == RESOURCE_IN_WIM), then lte->wim_res_spec points to - * an instance of this structure. + * If a `struct wim_lookup_table_entry' lte has (lte->resource_location == + * RESOURCE_IN_WIM), then lte->rspec points to an instance of this structure. * - * Normally, there is a one-to-one correspondence between WIM lookup table - * entries ("streams", each of which may be the contents of a file, for example) - * and WIM resources. However, WIM resources with the - * WIM_RESHDR_FLAG_PACKED_STREAMS flag set may actually contain multiple streams - * compressed together. */ + * Normally, there is a one-to-one correspondence between lookup table entries + * ("streams", each of which may be the contents of a file, for example) and + * resources. However, a resource with the WIM_RESHDR_FLAG_SOLID flag set is a + * "solid" resource that may contain multiple streams compressed together. + */ struct wim_resource_spec { /* The WIM containing this resource. @wim->in_fd is expected to be a * file descriptor to the underlying WIM file, opened for reading. */ @@ -97,32 +97,30 @@ struct wim_reshdr { * or XML data for the WIM. */ #define WIM_RESHDR_FLAG_METADATA 0x02 -/* The resource is compressed using the WIM's default compression type and uses - * the regular chunk table format. */ +/* The resource is a non-solid resource compressed using the WIM's default + * compression type. */ #define WIM_RESHDR_FLAG_COMPRESSED 0x04 /* Unknown meaning; may be intended to indicate a partial stream. Currently * ignored by wimlib. */ #define WIM_RESHDR_FLAG_SPANNED 0x08 -/* The resource is packed in a special format that may contain multiple - * underlying streams, or this resource entry represents a stream packed into - * one such resource. When resources have this flag set, the WIM version number - * should be WIM_VERSION_PACKED_STREAMS. */ -#define WIM_RESHDR_FLAG_PACKED_STREAMS 0x10 +/* The resource is a solid compressed resource which may contain multiple + * streams. This flag is only allowed if the WIM version number is + * WIM_VERSION_SOLID. */ +#define WIM_RESHDR_FLAG_SOLID 0x10 /* Magic number in the 'uncompressed_size' field of the resource header that - * identifies the main entry for a pack. */ -#define WIM_PACK_MAGIC_NUMBER 0x100000000ULL + * identifies the main entry for a solid resource. */ +#define SOLID_RESOURCE_MAGIC_NUMBER 0x100000000ULL -/* Returns true if the specified WIM resource is compressed, using either the - * original chunk table layout or the alternate layout for resources that may - * contain multiple packed streams. */ +/* Returns true if the specified WIM resource is compressed (may be either solid + * or non-solid) */ static inline bool resource_is_compressed(const struct wim_resource_spec *rspec) { return (rspec->flags & (WIM_RESHDR_FLAG_COMPRESSED | - WIM_RESHDR_FLAG_PACKED_STREAMS)); + WIM_RESHDR_FLAG_SOLID)); } static inline void @@ -153,8 +151,8 @@ void put_wim_reshdr(const struct wim_reshdr *reshdr, struct wim_reshdr_disk *disk_reshdr); -/* Alternate chunk table format for resources with - * WIM_RESHDR_FLAG_PACKED_STREAMS set. */ +/* Alternate chunk table format for resources with WIM_RESHDR_FLAG_SOLID set. + */ struct alt_chunk_table_header_disk { /* Uncompressed size of the resource in bytes. */ le64 res_usize; diff --git a/include/wimlib/wim.h b/include/wimlib/wim.h index ec067569..f02bf8c7 100644 --- a/include/wimlib/wim.h +++ b/include/wimlib/wim.h @@ -129,9 +129,9 @@ struct WIMStruct { * the same as compression_type. */ u8 out_compression_type; - /* Compression type for writing packed streams; can be set with + /* Compression type for writing solid resources; can be set with * wimlib_set_output_pack_compression_type(). */ - u8 out_pack_compression_type; + u8 out_solid_compression_type; /* If this WIM is backed by a file, then this is the compression chunk * size for non-solid resources in that file. */ @@ -142,9 +142,9 @@ struct WIMStruct { * as chunk_size. */ u32 out_chunk_size; - /* Chunk size for writing packed streams; can be set with + /* Chunk size for writing solid resources; can be set with * wimlib_set_output_pack_chunk_size(). */ - u32 out_pack_chunk_size; + u32 out_solid_chunk_size; /* Currently registered progress function for this WIMStruct, or NULL if * no progress function is currently registered for this WIMStruct. */ diff --git a/include/wimlib/write.h b/include/wimlib/write.h index e3f2a217..93b92933 100644 --- a/include/wimlib/write.h +++ b/include/wimlib/write.h @@ -27,7 +27,7 @@ WIMLIB_WRITE_FLAG_SKIP_EXTERNAL_WIMS | \ WIMLIB_WRITE_FLAG_STREAMS_OK | \ WIMLIB_WRITE_FLAG_RETAIN_GUID | \ - WIMLIB_WRITE_FLAG_PACK_STREAMS | \ + WIMLIB_WRITE_FLAG_SOLID | \ WIMLIB_WRITE_FLAG_SEND_DONE_WITH_FILE_MESSAGES) #if defined(HAVE_SYS_FILE_H) && defined(HAVE_FLOCK) diff --git a/programs/imagex.c b/programs/imagex.c index d567371a..5a6182b2 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -1793,7 +1793,7 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd) goto out_err; break; case IMAGEX_SOLID_OPTION: - write_flags |= WIMLIB_WRITE_FLAG_PACK_STREAMS; + write_flags |= WIMLIB_WRITE_FLAG_SOLID; break; case IMAGEX_FLAGS_OPTION: flags_element = optarg; @@ -1891,9 +1891,9 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd) if (add_flags & WIMLIB_ADD_FLAG_WIMBOOT) { /* With --wimboot, default to XPRESS compression. */ compression_type = WIMLIB_COMPRESSION_TYPE_XPRESS; - } else if (write_flags & WIMLIB_WRITE_FLAG_PACK_STREAMS) { + } else if (write_flags & WIMLIB_WRITE_FLAG_SOLID) { /* With --solid, default to LZMS compression. (However, - * this will not affect solid blocks!) */ + * this will not affect solid resources!) */ compression_type = WIMLIB_COMPRESSION_TYPE_LZMS; } else { /* Otherwise, default to LZX compression. */ @@ -2449,7 +2449,7 @@ print_resource(const struct wimlib_resource_entry *resource, if (resource->is_spanned) tprintf(T("WIM_RESHDR_FLAG_SPANNED ")); if (resource->packed) - tprintf(T("WIM_RESHDR_FLAG_PACKED_STREAMS ")); + tprintf(T("WIM_RESHDR_FLAG_SOLID ")); tputchar(T('\n')); } tputchar(T('\n')); @@ -2667,7 +2667,7 @@ imagex_export(int argc, tchar **argv, int cmd) write_flags |= WIMLIB_WRITE_FLAG_RECOMPRESS; break; case IMAGEX_SOLID_OPTION: - write_flags |= WIMLIB_WRITE_FLAG_PACK_STREAMS; + write_flags |= WIMLIB_WRITE_FLAG_SOLID; break; case IMAGEX_CHUNK_SIZE_OPTION: chunk_size = parse_chunk_size(optarg); @@ -2802,7 +2802,7 @@ imagex_export(int argc, tchar **argv, int cmd) * to that of the source WIM, unless --solid or * --wimboot was specified. */ - if (write_flags & WIMLIB_WRITE_FLAG_PACK_STREAMS) + if (write_flags & WIMLIB_WRITE_FLAG_SOLID) compression_type = WIMLIB_COMPRESSION_TYPE_LZMS; else if (export_flags & WIMLIB_EXPORT_FLAG_WIMBOOT) compression_type = WIMLIB_COMPRESSION_TYPE_XPRESS; @@ -3571,7 +3571,7 @@ imagex_optimize(int argc, tchar **argv, int cmd) goto out_err; break; case IMAGEX_SOLID_OPTION: - write_flags |= WIMLIB_WRITE_FLAG_PACK_STREAMS; + write_flags |= WIMLIB_WRITE_FLAG_SOLID; write_flags |= WIMLIB_WRITE_FLAG_RECOMPRESS; break; case IMAGEX_THREADS_OPTION: diff --git a/src/header.c b/src/header.c index 613256fa..634f4dab 100644 --- a/src/header.c +++ b/src/header.c @@ -111,7 +111,7 @@ read_wim_header(WIMStruct *wim, struct wim_header *hdr) hdr->wim_version = le32_to_cpu(disk_hdr.wim_version); if (hdr->wim_version != WIM_VERSION_DEFAULT && - hdr->wim_version != WIM_VERSION_PACKED_STREAMS) + hdr->wim_version != WIM_VERSION_SOLID) { ERROR("\"%"TS"\": Unknown WIM version: %u", filename, hdr->wim_version); @@ -257,7 +257,7 @@ init_wim_header(struct wim_header *hdr, int ctype, u32 chunk_size) hdr->magic = WIM_MAGIC; if (ctype == WIMLIB_COMPRESSION_TYPE_LZMS) - hdr->wim_version = WIM_VERSION_PACKED_STREAMS; + hdr->wim_version = WIM_VERSION_SOLID; else hdr->wim_version = WIM_VERSION_DEFAULT; if (set_wim_hdr_cflags(ctype, hdr)) { diff --git a/src/lookup_table.c b/src/lookup_table.c index 65f52b55..ec793205 100644 --- a/src/lookup_table.c +++ b/src/lookup_table.c @@ -589,13 +589,13 @@ struct wim_lookup_table_entry_disk { #define WIM_LOOKUP_TABLE_ENTRY_DISK_SIZE 50 -/* Given a nonempty run of consecutive lookup table entries with the - * PACKED_STREAMS flag set, count how many specify resources (as opposed to - * streams within those resources). +/* Given a nonempty run of consecutive lookup table entries with the SOLID flag + * set, count how many specify resources (as opposed to streams within those + * resources). * * Returns the resulting count. */ static size_t -count_subpacks(const struct wim_lookup_table_entry_disk *entries, size_t max) +count_solid_resources(const struct wim_lookup_table_entry_disk *entries, size_t max) { size_t count = 0; do { @@ -603,12 +603,12 @@ count_subpacks(const struct wim_lookup_table_entry_disk *entries, size_t max) get_wim_reshdr(&(entries++)->reshdr, &reshdr); - if (!(reshdr.flags & WIM_RESHDR_FLAG_PACKED_STREAMS)) { + if (!(reshdr.flags & WIM_RESHDR_FLAG_SOLID)) { /* Run was terminated by a stand-alone stream entry. */ break; } - if (reshdr.uncompressed_size == WIM_PACK_MAGIC_NUMBER) { + if (reshdr.uncompressed_size == SOLID_RESOURCE_MAGIC_NUMBER) { /* This is a resource entry. */ count++; } @@ -616,17 +616,19 @@ count_subpacks(const struct wim_lookup_table_entry_disk *entries, size_t max) return count; } -/* Given a run of consecutive lookup table entries with the PACKED_STREAMS flag - * set and having @num_subpacks resource entries, load resource information from - * them into the resource specifications in the @subpacks array. +/* + * Given a run of consecutive lookup table entries with the SOLID flag set and + * having @num_rspecs resource entries, load resource information from them into + * the resource specifications in the @rspecs array. * - * Returns 0 on success, or a nonzero error code on failure. */ + * Returns 0 on success, or a nonzero error code on failure. + */ static int -do_load_subpack_info(WIMStruct *wim, struct wim_resource_spec **subpacks, - size_t num_subpacks, - const struct wim_lookup_table_entry_disk *entries) +do_load_solid_info(WIMStruct *wim, struct wim_resource_spec **rspecs, + size_t num_rspecs, + const struct wim_lookup_table_entry_disk *entries) { - for (size_t i = 0; i < num_subpacks; i++) { + for (size_t i = 0; i < num_rspecs; i++) { struct wim_reshdr reshdr; struct alt_chunk_table_header_disk hdr; struct wim_resource_spec *rspec; @@ -636,20 +638,20 @@ do_load_subpack_info(WIMStruct *wim, struct wim_resource_spec **subpacks, do { get_wim_reshdr(&(entries++)->reshdr, &reshdr); - } while (reshdr.uncompressed_size != WIM_PACK_MAGIC_NUMBER); + } while (reshdr.uncompressed_size != SOLID_RESOURCE_MAGIC_NUMBER); - rspec = subpacks[i]; + rspec = rspecs[i]; wim_res_hdr_to_spec(&reshdr, wim, rspec); - /* For packed resources, the uncompressed size, compression - * type, and chunk size are stored in the resource itself, not - * in the lookup table. */ + /* For solid resources, the uncompressed size, compression type, + * and chunk size are stored in the resource itself, not in the + * lookup table. */ ret = full_pread(&wim->in_fd, &hdr, sizeof(hdr), reshdr.offset_in_wim); if (ret) { - ERROR("Failed to read header of packed resource " + ERROR("Failed to read header of solid resource " "(offset_in_wim=%"PRIu64")", reshdr.offset_in_wim); return ret; @@ -667,9 +669,9 @@ do_load_subpack_info(WIMStruct *wim, struct wim_resource_spec **subpacks, rspec->chunk_size = le32_to_cpu(hdr.chunk_size); - DEBUG("Subpack %zu/%zu: %"PRIu64" => %"PRIu64" " + DEBUG("Solid resource %zu/%zu: %"PRIu64" => %"PRIu64" " "(%"TS"/%"PRIu32") @ +%"PRIu64"", - i + 1, num_subpacks, + i + 1, num_rspecs, rspec->uncompressed_size, rspec->size_in_wim, wimlib_get_compression_type_string(rspec->compression_type), @@ -680,88 +682,87 @@ do_load_subpack_info(WIMStruct *wim, struct wim_resource_spec **subpacks, return 0; } -/* Given a nonempty run of consecutive lookup table entries with the - * PACKED_STREAMS flag set, allocate a 'struct wim_resource_spec' for each - * resource within that run. +/* + * Given a nonempty run of consecutive lookup table entries with the SOLID flag + * set, allocate a 'struct wim_resource_spec' for each resource within that run. * * Returns 0 on success, or a nonzero error code on failure. - * Returns the pointers and count in *subpacks_ret and *num_subpacks_ret. + * Returns the pointers and count in *rspecs_ret and *num_rspecs_ret. */ static int -load_subpack_info(WIMStruct *wim, - const struct wim_lookup_table_entry_disk *entries, - size_t num_remaining_entries, - struct wim_resource_spec ***subpacks_ret, - size_t *num_subpacks_ret) +load_solid_info(WIMStruct *wim, + const struct wim_lookup_table_entry_disk *entries, + size_t num_remaining_entries, + struct wim_resource_spec ***rspecs_ret, + size_t *num_rspecs_ret) { - size_t num_subpacks; - struct wim_resource_spec **subpacks; + size_t num_rspecs; + struct wim_resource_spec **rspecs; size_t i; int ret; - num_subpacks = count_subpacks(entries, num_remaining_entries); - subpacks = CALLOC(num_subpacks, sizeof(subpacks[0])); - if (!subpacks) + num_rspecs = count_solid_resources(entries, num_remaining_entries); + rspecs = CALLOC(num_rspecs, sizeof(rspecs[0])); + if (!rspecs) return WIMLIB_ERR_NOMEM; - for (i = 0; i < num_subpacks; i++) { - subpacks[i] = MALLOC(sizeof(struct wim_resource_spec)); - if (!subpacks[i]) { + for (i = 0; i < num_rspecs; i++) { + rspecs[i] = MALLOC(sizeof(struct wim_resource_spec)); + if (!rspecs[i]) { ret = WIMLIB_ERR_NOMEM; - goto out_free_subpacks; + goto out_free_rspecs; } } - ret = do_load_subpack_info(wim, subpacks, num_subpacks, entries); + ret = do_load_solid_info(wim, rspecs, num_rspecs, entries); if (ret) - goto out_free_subpacks; + goto out_free_rspecs; - *subpacks_ret = subpacks; - *num_subpacks_ret = num_subpacks; + *rspecs_ret = rspecs; + *num_rspecs_ret = num_rspecs; return 0; -out_free_subpacks: - for (i = 0; i < num_subpacks; i++) - FREE(subpacks[i]); - FREE(subpacks); +out_free_rspecs: + for (i = 0; i < num_rspecs; i++) + FREE(rspecs[i]); + FREE(rspecs); return ret; } -/* Given a 'struct wim_lookup_table_entry' allocated for a stream entry with - * PACKED_STREAMS set, try to bind it to a subpack of the current PACKED_STREAMS - * run. */ +/* Given a 'struct wim_lookup_table_entry' allocated for a stream entry with the + * SOLID flag set, try to bind it to resource in the current solid run. */ static int -bind_stream_to_subpack(const struct wim_reshdr *reshdr, - struct wim_lookup_table_entry *stream, - struct wim_resource_spec **subpacks, - size_t num_subpacks) +bind_stream_to_solid_resource(const struct wim_reshdr *reshdr, + struct wim_lookup_table_entry *stream, + struct wim_resource_spec **rspecs, + size_t num_rspecs) { u64 offset = reshdr->offset_in_wim; /* XXX: This linear search will be slow in the degenerate case where the - * number of subpacks is huge. */ + * number of solid resources in the run is huge. */ stream->size = reshdr->size_in_wim; stream->flags = reshdr->flags; - for (size_t i = 0; i < num_subpacks; i++) { - if (offset + stream->size <= subpacks[i]->uncompressed_size) { + for (size_t i = 0; i < num_rspecs; i++) { + if (offset + stream->size <= rspecs[i]->uncompressed_size) { stream->offset_in_res = offset; - lte_bind_wim_resource_spec(stream, subpacks[i]); + lte_bind_wim_resource_spec(stream, rspecs[i]); return 0; } - offset -= subpacks[i]->uncompressed_size; + offset -= rspecs[i]->uncompressed_size; } - ERROR("Packed stream could not be assigned to any resource"); + ERROR("Stream could not be assigned to a solid resource"); return WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY; } static void -free_subpack_info(struct wim_resource_spec **subpacks, size_t num_subpacks) +free_solid_rspecs(struct wim_resource_spec **rspecs, size_t num_rspecs) { - if (subpacks) { - for (size_t i = 0; i < num_subpacks; i++) - if (list_empty(&subpacks[i]->stream_list)) - FREE(subpacks[i]); - FREE(subpacks); + if (rspecs) { + for (size_t i = 0; i < num_rspecs; i++) + if (list_empty(&rspecs[i]->stream_list)) + FREE(rspecs[i]); + FREE(rspecs); } } @@ -831,20 +832,20 @@ invalid_due_to_overflow: return WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY; invalid_due_to_overlap: - ERROR("Invalid resource entry (streams in packed resource overlap)"); + ERROR("Invalid resource entry (streams in solid resource overlap)"); return WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY; } static int -finish_subpacks(struct wim_resource_spec **subpacks, size_t num_subpacks) +finish_solid_rspecs(struct wim_resource_spec **rspecs, size_t num_rspecs) { int ret = 0; - for (size_t i = 0; i < num_subpacks; i++) { - ret = validate_resource(subpacks[i]); + for (size_t i = 0; i < num_rspecs; i++) { + ret = validate_resource(rspecs[i]); if (ret) break; } - free_subpack_info(subpacks, num_subpacks); + free_solid_rspecs(rspecs, num_rspecs); return ret; } @@ -858,16 +859,16 @@ finish_subpacks(struct wim_resource_spec **subpacks, size_t num_subpacks) * per-image location (the wim->image_metadata array). * * This works for both version WIM_VERSION_DEFAULT (68864) and version - * WIM_VERSION_PACKED_STREAMS (3584) WIMs. In the latter, a consecutive run of - * lookup table entries that all have flag WIM_RESHDR_FLAG_PACKED_STREAMS (0x10) - * set is a "packed run". A packed run logically contains zero or more - * resources, each of which logically contains zero or more streams. - * Physically, in such a run, a "lookup table entry" with uncompressed size - * WIM_PACK_MAGIC_NUMBER (0x100000000) specifies a resource, whereas any other - * entry specifies a stream. Within such a run, stream entries and resource - * entries need not be in any particular order, except that the order of the - * resource entries is important, as it affects how streams are assigned to - * resources. See the code for details. + * WIM_VERSION_SOLID (3584) WIMs. In the latter, a consecutive run of lookup + * table entries that all have flag WIM_RESHDR_FLAG_SOLID (0x10) set is a "solid + * run". A solid run logically contains zero or more resources, each of which + * logically contains zero or more streams. Physically, in such a run, a + * "lookup table entry" with uncompressed size SOLID_RESOURCE_MAGIC_NUMBER + * (0x100000000) specifies a resource, whereas any other entry specifies a + * stream. Within such a run, stream entries and resource entries need not be + * in any particular order, except that the order of the resource entries is + * important, as it affects how streams are assigned to resources. See the code + * for details. * * Possible return values: * WIMLIB_ERR_SUCCESS (0) @@ -888,8 +889,8 @@ read_wim_lookup_table(WIMStruct *wim) size_t num_duplicate_entries = 0; size_t num_wrong_part_entries = 0; u32 image_index = 0; - struct wim_resource_spec **cur_subpacks = NULL; - size_t cur_num_subpacks = 0; + struct wim_resource_spec **cur_solid_rspecs = NULL; + size_t cur_num_solid_rspecs = 0; DEBUG("Reading lookup table."); @@ -916,7 +917,7 @@ read_wim_lookup_table(WIMStruct *wim) * wim_lookup_table_entry's) from the raw lookup table buffer. Each of * these entries will point to a 'struct wim_resource_spec' that * describes the underlying resource. In WIMs with version number - * WIM_VERSION_PACKED_STREAMS, a resource may contain multiple streams. + * WIM_VERSION_SOLID, a resource may contain multiple streams. */ for (size_t i = 0; i < num_entries; i++) { const struct wim_lookup_table_entry_disk *disk_entry = @@ -934,10 +935,10 @@ read_wim_lookup_table(WIMStruct *wim) reshdr.size_in_wim, reshdr.uncompressed_size, reshdr.offset_in_wim, reshdr.flags); - /* Ignore PACKED_STREAMS flag if it isn't supposed to be used in - * this WIM version. */ + /* Ignore SOLID flag if it isn't supposed to be used in this WIM + * version. */ if (wim->hdr.wim_version == WIM_VERSION_DEFAULT) - reshdr.flags &= ~WIM_RESHDR_FLAG_PACKED_STREAMS; + reshdr.flags &= ~WIM_RESHDR_FLAG_SOLID; /* Allocate a new 'struct wim_lookup_table_entry'. */ cur_entry = new_lookup_table_entry(); @@ -949,45 +950,44 @@ read_wim_lookup_table(WIMStruct *wim) cur_entry->refcnt = le32_to_cpu(disk_entry->refcnt); copy_hash(cur_entry->hash, disk_entry->hash); - if (reshdr.flags & WIM_RESHDR_FLAG_PACKED_STREAMS) { + if (reshdr.flags & WIM_RESHDR_FLAG_SOLID) { - /* PACKED_STREAMS entry */ + /* SOLID entry */ - if (!cur_subpacks) { + if (!cur_solid_rspecs) { /* Starting new run */ - ret = load_subpack_info(wim, disk_entry, - num_entries - i, - &cur_subpacks, - &cur_num_subpacks); + ret = load_solid_info(wim, disk_entry, + num_entries - i, + &cur_solid_rspecs, + &cur_num_solid_rspecs); if (ret) goto out; } - if (reshdr.uncompressed_size == WIM_PACK_MAGIC_NUMBER) { + if (reshdr.uncompressed_size == SOLID_RESOURCE_MAGIC_NUMBER) { /* Resource entry, not stream entry */ goto free_cur_entry_and_continue; } /* Stream entry */ - ret = bind_stream_to_subpack(&reshdr, - cur_entry, - cur_subpacks, - cur_num_subpacks); + ret = bind_stream_to_solid_resource(&reshdr, + cur_entry, + cur_solid_rspecs, + cur_num_solid_rspecs); if (ret) goto out; } else { - /* Normal stream/resource entry; PACKED_STREAMS not set. - */ + /* Normal stream/resource entry; SOLID not set. */ struct wim_resource_spec *rspec; - if (unlikely(cur_subpacks)) { - /* This entry terminated a packed run. */ - ret = finish_subpacks(cur_subpacks, - cur_num_subpacks); - cur_subpacks = NULL; + if (unlikely(cur_solid_rspecs)) { + /* This entry terminated a solid run. */ + ret = finish_solid_rspecs(cur_solid_rspecs, + cur_num_solid_rspecs); + cur_solid_rspecs = NULL; if (ret) goto out; } @@ -1107,17 +1107,17 @@ read_wim_lookup_table(WIMStruct *wim) continue; free_cur_entry_and_continue: - if (cur_subpacks && + if (cur_solid_rspecs && cur_entry->resource_location == RESOURCE_IN_WIM) lte_unbind_wim_resource_spec(cur_entry); free_lookup_table_entry(cur_entry); } cur_entry = NULL; - if (cur_subpacks) { - /* End of lookup table terminated a packed run. */ - ret = finish_subpacks(cur_subpacks, cur_num_subpacks); - cur_subpacks = NULL; + if (cur_solid_rspecs) { + /* End of lookup table terminated a solid run. */ + ret = finish_solid_rspecs(cur_solid_rspecs, cur_num_solid_rspecs); + cur_solid_rspecs = NULL; if (ret) goto out; } @@ -1148,7 +1148,7 @@ oom: ERROR("Not enough memory to read lookup table!"); ret = WIMLIB_ERR_NOMEM; out: - free_subpack_info(cur_subpacks, cur_num_subpacks); + free_solid_rspecs(cur_solid_rspecs, cur_num_solid_rspecs); free_lookup_table_entry(cur_entry); free_lookup_table(table); out_free_buf: @@ -1168,7 +1168,7 @@ put_wim_lookup_table_entry(struct wim_lookup_table_entry_disk *disk_entry, } /* Note: the list of stream entries must be sorted so that all entries for the - * same packed resource are consecutive. In addition, entries with + * same solid resource are consecutive. In addition, entries with * WIM_RESHDR_FLAG_METADATA set must be in the same order as the indices of the * underlying images. */ int @@ -1191,7 +1191,7 @@ write_wim_lookup_table_from_stream_list(struct list_head *stream_list, list_for_each_entry(lte, stream_list, lookup_table_list) { table_size += sizeof(struct wim_lookup_table_entry_disk); - if (lte->out_reshdr.flags & WIM_RESHDR_FLAG_PACKED_STREAMS && + if (lte->out_reshdr.flags & WIM_RESHDR_FLAG_SOLID && lte->out_res_offset_in_wim != prev_res_offset_in_wim) { table_size += sizeof(struct wim_lookup_table_entry_disk); @@ -1214,19 +1214,19 @@ write_wim_lookup_table_from_stream_list(struct list_head *stream_list, prev_uncompressed_size = 0; logical_offset = 0; list_for_each_entry(lte, stream_list, lookup_table_list) { - if (lte->out_reshdr.flags & WIM_RESHDR_FLAG_PACKED_STREAMS) { + if (lte->out_reshdr.flags & WIM_RESHDR_FLAG_SOLID) { struct wim_reshdr tmp_reshdr; - /* Eww. When WIMGAPI sees multiple resource packs, it + /* Eww. When WIMGAPI sees multiple solid resources, it * expects the offsets to be adjusted as if there were - * really only one pack. */ + * really only one solid resource. */ if (lte->out_res_offset_in_wim != prev_res_offset_in_wim) { - /* Put the resource entry for pack */ + /* Put the resource entry for solid resource */ tmp_reshdr.offset_in_wim = lte->out_res_offset_in_wim; tmp_reshdr.size_in_wim = lte->out_res_size_in_wim; - tmp_reshdr.uncompressed_size = WIM_PACK_MAGIC_NUMBER; - tmp_reshdr.flags = WIM_RESHDR_FLAG_PACKED_STREAMS; + tmp_reshdr.uncompressed_size = SOLID_RESOURCE_MAGIC_NUMBER; + tmp_reshdr.flags = WIM_RESHDR_FLAG_SOLID; put_wim_lookup_table_entry(table_buf_ptr++, &tmp_reshdr, @@ -1373,7 +1373,7 @@ lte_to_wimlib_resource_entry(const struct wim_lookup_table_entry *lte, wentry->uncompressed_size = lte->size; if (lte->resource_location == RESOURCE_IN_WIM) { wentry->part_number = lte->rspec->wim->hdr.part_number; - if (lte->flags & WIM_RESHDR_FLAG_PACKED_STREAMS) { + if (lte->flags & WIM_RESHDR_FLAG_SOLID) { wentry->compressed_size = 0; wentry->offset = lte->offset_in_res; } else { @@ -1390,7 +1390,7 @@ lte_to_wimlib_resource_entry(const struct wim_lookup_table_entry *lte, wentry->is_metadata = (lte->flags & WIM_RESHDR_FLAG_METADATA) != 0; wentry->is_free = (lte->flags & WIM_RESHDR_FLAG_FREE) != 0; wentry->is_spanned = (lte->flags & WIM_RESHDR_FLAG_SPANNED) != 0; - wentry->packed = (lte->flags & WIM_RESHDR_FLAG_PACKED_STREAMS) != 0; + wentry->packed = (lte->flags & WIM_RESHDR_FLAG_SOLID) != 0; } struct iterate_lte_context { diff --git a/src/resource.c b/src/resource.c index d5c26b40..f6e30fc8 100644 --- a/src/resource.c +++ b/src/resource.c @@ -169,7 +169,7 @@ read_compressed_wim_resource(const struct wim_resource_spec * const rspec, const bool is_pipe_read = (rspec->is_pipable && !filedes_is_seekable(in_fd)); /* Determine if the chunk table is in an alternate format. */ - const bool alt_chunk_table = (rspec->flags & WIM_RESHDR_FLAG_PACKED_STREAMS) + const bool alt_chunk_table = (rspec->flags & WIM_RESHDR_FLAG_SOLID) && !is_pipe_read; /* Get the maximum size of uncompressed chunks in this resource, which @@ -742,7 +742,7 @@ int skip_wim_stream(struct wim_lookup_table_entry *lte) { wimlib_assert(lte->resource_location == RESOURCE_IN_WIM); - wimlib_assert(!(lte->flags & WIM_RESHDR_FLAG_PACKED_STREAMS)); + wimlib_assert(!(lte->flags & WIM_RESHDR_FLAG_SOLID)); DEBUG("Skipping stream (size=%"PRIu64")", lte->size); return read_partial_wim_resource(lte->rspec, 0, @@ -1187,11 +1187,11 @@ read_full_stream_with_sha1(struct wim_lookup_table_entry *lte, } static int -read_packed_streams(struct wim_lookup_table_entry *first_stream, - struct wim_lookup_table_entry *last_stream, - u64 stream_count, - size_t list_head_offset, - const struct read_stream_list_callbacks *sink_cbs) +read_streams_in_solid_resource(struct wim_lookup_table_entry *first_stream, + struct wim_lookup_table_entry *last_stream, + u64 stream_count, + size_t list_head_offset, + const struct read_stream_list_callbacks *sink_cbs) { struct data_range *ranges; bool ranges_malloced; @@ -1266,8 +1266,8 @@ read_packed_streams(struct wim_lookup_table_entry *first_stream, * Read a list of streams, each of which may be in any supported location (e.g. * in a WIM or in an external file). Unlike read_stream_prefix() or the * functions which call it, this function optimizes the case where multiple - * streams are packed into a single compressed WIM resource and reads them all - * consecutively, only decompressing the data one time. + * streams are combined into a single solid compressed WIM resource and reads + * them all consecutively, only decompressing the data one time. * * @stream_list * List of streams (represented as `struct wim_lookup_table_entry's) to @@ -1344,7 +1344,7 @@ read_stream_list(struct list_head *stream_list, { lte = (struct wim_lookup_table_entry*)((u8*)cur - list_head_offset); - if (lte->flags & WIM_RESHDR_FLAG_PACKED_STREAMS && + if (lte->flags & WIM_RESHDR_FLAG_SOLID && lte->size != lte->rspec->uncompressed_size) { @@ -1380,10 +1380,10 @@ read_stream_list(struct list_head *stream_list, * read and @lte_last specifies the last stream * in the resource that needs to be read. */ next = next2; - ret = read_packed_streams(lte, lte_last, - stream_count, - list_head_offset, - sink_cbs); + ret = read_streams_in_solid_resource(lte, lte_last, + stream_count, + list_head_offset, + sink_cbs); if (ret) return ret; continue; @@ -1469,7 +1469,7 @@ sha1_stream(struct wim_lookup_table_entry *lte) /* Convert a short WIM resource header to a stand-alone WIM resource * specification. * - * Note: for packed resources some fields still need to be overridden. + * Note: for solid resources some fields still need to be overridden. */ void wim_res_hdr_to_spec(const struct wim_reshdr *reshdr, WIMStruct *wim, diff --git a/src/split.c b/src/split.c index 24c2acf7..51c4a910 100644 --- a/src/split.c +++ b/src/split.c @@ -151,8 +151,8 @@ add_stream_to_swm(struct wim_lookup_table_entry *lte, void *_swm_info) u64 stream_size; if (lte_is_partial(lte)) { - ERROR("Splitting of WIM containing packed streams is not supported.\n" - " Export it in the default format first."); + ERROR("Splitting of WIM containing solid resources is not supported.\n" + " Export it in non-solid format first."); return WIMLIB_ERR_UNSUPPORTED; } if (lte->resource_location == RESOURCE_IN_WIM) diff --git a/src/wim.c b/src/wim.c index df555621..c9116dfb 100644 --- a/src/wim.c +++ b/src/wim.c @@ -51,13 +51,13 @@ #endif static int -wim_default_pack_compression_type(void) +wim_default_solid_compression_type(void) { return WIMLIB_COMPRESSION_TYPE_LZMS; } static u32 -wim_default_pack_chunk_size(int ctype) { +wim_default_solid_chunk_size(int ctype) { switch (ctype) { case WIMLIB_COMPRESSION_TYPE_LZMS: return 1U << 25; /* 33554432 */ @@ -75,9 +75,9 @@ new_wim_struct(void) filedes_invalidate(&wim->in_fd); filedes_invalidate(&wim->out_fd); - wim->out_pack_compression_type = wim_default_pack_compression_type(); - wim->out_pack_chunk_size = wim_default_pack_chunk_size( - wim->out_pack_compression_type); + wim->out_solid_compression_type = wim_default_solid_compression_type(); + wim->out_solid_chunk_size = wim_default_solid_chunk_size( + wim->out_solid_compression_type); INIT_LIST_HEAD(&wim->subwims); return wim; } @@ -535,13 +535,13 @@ wimlib_set_output_compression_type(WIMStruct *wim, int ctype) WIMLIBAPI int wimlib_set_output_pack_compression_type(WIMStruct *wim, int ctype) { - int ret = set_out_ctype(ctype, &wim->out_pack_compression_type); + int ret = set_out_ctype(ctype, &wim->out_solid_compression_type); if (ret) return ret; /* Reset the chunk size if it's no longer valid. */ - if (!wim_chunk_size_valid(wim->out_pack_chunk_size, ctype)) - wim->out_pack_chunk_size = wim_default_pack_chunk_size(ctype); + if (!wim_chunk_size_valid(wim->out_solid_chunk_size, ctype)) + wim->out_solid_chunk_size = wim_default_solid_chunk_size(ctype); return 0; } @@ -575,14 +575,14 @@ WIMLIBAPI int wimlib_set_output_pack_chunk_size(WIMStruct *wim, uint32_t chunk_size) { if (chunk_size == 0) { - wim->out_pack_chunk_size = - wim_default_pack_chunk_size(wim->out_pack_compression_type); + wim->out_solid_chunk_size = + wim_default_solid_chunk_size(wim->out_solid_compression_type); return 0; } return set_out_chunk_size(chunk_size, - wim->out_pack_compression_type, - &wim->out_pack_chunk_size); + wim->out_solid_compression_type, + &wim->out_solid_chunk_size); } WIMLIBAPI void diff --git a/src/write.c b/src/write.c index f3c12ffe..aab567f8 100644 --- a/src/write.c +++ b/src/write.c @@ -61,7 +61,7 @@ /* wimlib internal flags used when writing resources. */ #define WRITE_RESOURCE_FLAG_RECOMPRESS 0x00000001 #define WRITE_RESOURCE_FLAG_PIPABLE 0x00000002 -#define WRITE_RESOURCE_FLAG_PACK_STREAMS 0x00000004 +#define WRITE_RESOURCE_FLAG_SOLID 0x00000004 #define WRITE_RESOURCE_FLAG_SEND_DONE_WITH_FILE 0x00000008 static inline int @@ -73,8 +73,8 @@ write_flags_to_resource_flags(int write_flags) write_resource_flags |= WRITE_RESOURCE_FLAG_RECOMPRESS; if (write_flags & WIMLIB_WRITE_FLAG_PIPABLE) write_resource_flags |= WRITE_RESOURCE_FLAG_PIPABLE; - if (write_flags & WIMLIB_WRITE_FLAG_PACK_STREAMS) - write_resource_flags |= WRITE_RESOURCE_FLAG_PACK_STREAMS; + if (write_flags & WIMLIB_WRITE_FLAG_SOLID) + write_resource_flags |= WRITE_RESOURCE_FLAG_SOLID; if (write_flags & WIMLIB_WRITE_FLAG_SEND_DONE_WITH_FILE_MESSAGES) write_resource_flags |= WRITE_RESOURCE_FLAG_SEND_DONE_WITH_FILE; return write_resource_flags; @@ -181,15 +181,15 @@ can_raw_copy(const struct wim_lookup_table_entry *lte, rspec->chunk_size == out_chunk_size); } - if ((rspec->flags & WIM_RESHDR_FLAG_PACKED_STREAMS) && - (write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS)) + if ((rspec->flags & WIM_RESHDR_FLAG_SOLID) && + (write_resource_flags & WRITE_RESOURCE_FLAG_SOLID)) { - /* Packed resource: Such resources may contain multiple streams, + /* Solid resource: Such resources may contain multiple streams, * and in general only a subset of them need to be written. As * a heuristic, re-use the raw data if more than two-thirds the * uncompressed size is being written. */ - /* Note: packed resources contain a header that specifies the + /* Note: solid resources contain a header that specifies the * compression type and chunk size; therefore we don't need to * check if they are compatible with @out_ctype and * @out_chunk_size. */ @@ -210,7 +210,7 @@ can_raw_copy(const struct wim_lookup_table_entry *lte, static u8 filter_resource_flags(u8 flags) { - return (flags & ~(WIM_RESHDR_FLAG_PACKED_STREAMS | + return (flags & ~(WIM_RESHDR_FLAG_SOLID | WIM_RESHDR_FLAG_COMPRESSED | WIM_RESHDR_FLAG_SPANNED | WIM_RESHDR_FLAG_FREE)); @@ -224,9 +224,9 @@ stream_set_out_reshdr_for_reuse(struct wim_lookup_table_entry *lte) wimlib_assert(lte->resource_location == RESOURCE_IN_WIM); rspec = lte->rspec; - if (rspec->flags & WIM_RESHDR_FLAG_PACKED_STREAMS) { + if (rspec->flags & WIM_RESHDR_FLAG_SOLID) { - wimlib_assert(lte->flags & WIM_RESHDR_FLAG_PACKED_STREAMS); + wimlib_assert(lte->flags & WIM_RESHDR_FLAG_SOLID); lte->out_reshdr.offset_in_wim = lte->offset_in_res; lte->out_reshdr.uncompressed_size = 0; @@ -236,7 +236,7 @@ stream_set_out_reshdr_for_reuse(struct wim_lookup_table_entry *lte) lte->out_res_size_in_wim = rspec->size_in_wim; lte->out_res_uncompressed_size = rspec->uncompressed_size; } else { - wimlib_assert(!(lte->flags & WIM_RESHDR_FLAG_PACKED_STREAMS)); + wimlib_assert(!(lte->flags & WIM_RESHDR_FLAG_SOLID)); lte->out_reshdr.offset_in_wim = rspec->offset_in_wim; lte->out_reshdr.uncompressed_size = rspec->uncompressed_size; @@ -383,9 +383,9 @@ struct write_streams_ctx { /* List of streams that currently have chunks being compressed. */ struct list_head pending_streams; - /* List of streams in the resource pack. Streams are moved here after - * @pending_streams only when writing a packed resource. */ - struct list_head pack_streams; + /* List of streams in the solid resource. Streams are moved here after + * @pending_streams only when writing a solid resource. */ + struct list_head solid_streams; /* Current uncompressed offset in the stream being read. */ u64 cur_read_stream_offset; @@ -426,12 +426,12 @@ begin_chunk_table(struct write_streams_ctx *ctx, u64 res_expected_size) /* Calculate the number of chunks and chunk entries that should be * needed for the resource. These normally will be the final values, - * but in PACKED_STREAMS mode some of the streams we're planning to - * write into the resource may be duplicates, and therefore discarded, - * potentially decreasing the number of chunk entries needed. */ + * but in SOLID mode some of the streams we're planning to write into + * the resource may be duplicates, and therefore discarded, potentially + * decreasing the number of chunk entries needed. */ expected_num_chunks = DIV_ROUND_UP(res_expected_size, ctx->out_chunk_size); expected_num_chunk_entries = expected_num_chunks; - if (!(ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS)) + if (!(ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID)) expected_num_chunk_entries--; /* Make sure the chunk_csizes array is long enough to store the @@ -458,16 +458,16 @@ begin_chunk_table(struct write_streams_ctx *ctx, u64 res_expected_size) if (!(ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PIPABLE)) { /* Reserve space for the chunk table in the output file. In the - * case of packed resources this reserves the upper bound for - * the needed space, not necessarily the exact space which will + * case of solid resources this reserves the upper bound for the + * needed space, not necessarily the exact space which will * prove to be needed. At this point, we just use @chunk_csizes * for a buffer of 0's because the actual compressed chunk sizes * are unknown. */ reserve_size = expected_num_chunk_entries * get_chunk_entry_size(res_expected_size, 0 != (ctx->write_resource_flags & - WRITE_RESOURCE_FLAG_PACK_STREAMS)); - if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS) + WRITE_RESOURCE_FLAG_SOLID)); + if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID) reserve_size += sizeof(struct alt_chunk_table_header_disk); memset(ctx->chunk_csizes, 0, reserve_size); ret = full_write(ctx->out_fd, ctx->chunk_csizes, reserve_size); @@ -509,12 +509,12 @@ end_chunk_table(struct write_streams_ctx *ctx, u64 res_actual_size, actual_num_chunks = ctx->chunk_index; actual_num_chunk_entries = actual_num_chunks; - if (!(ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS)) + if (!(ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID)) actual_num_chunk_entries--; chunk_entry_size = get_chunk_entry_size(res_actual_size, 0 != (ctx->write_resource_flags & - WRITE_RESOURCE_FLAG_PACK_STREAMS)); + WRITE_RESOURCE_FLAG_SOLID)); typedef le64 _may_alias_attribute aliased_le64_t; typedef le32 _may_alias_attribute aliased_le32_t; @@ -522,7 +522,7 @@ end_chunk_table(struct write_streams_ctx *ctx, u64 res_actual_size, if (chunk_entry_size == 4) { aliased_le32_t *entries = (aliased_le32_t*)ctx->chunk_csizes; - if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS) { + if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID) { for (size_t i = 0; i < actual_num_chunk_entries; i++) entries[i] = cpu_to_le32(ctx->chunk_csizes[i]); } else { @@ -536,7 +536,7 @@ end_chunk_table(struct write_streams_ctx *ctx, u64 res_actual_size, } else { aliased_le64_t *entries = (aliased_le64_t*)ctx->chunk_csizes; - if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS) { + if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID) { for (size_t i = 0; i < actual_num_chunk_entries; i++) entries[i] = cpu_to_le64(ctx->chunk_csizes[i]); } else { @@ -566,7 +566,7 @@ end_chunk_table(struct write_streams_ctx *ctx, u64 res_actual_size, chunk_table_offset = ctx->chunks_start_offset - chunk_table_size; - if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS) { + if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID) { struct alt_chunk_table_header_disk hdr; hdr.res_usize = cpu_to_le64(res_actual_size); @@ -613,7 +613,7 @@ end_write_resource(struct write_streams_ctx *ctx, struct wim_reshdr *out_reshdr) u64 res_offset_in_wim; wimlib_assert(ctx->cur_write_stream_offset == ctx->cur_write_res_size || - (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS)); + (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID)); res_uncompressed_size = ctx->cur_write_res_size; if (ctx->compressor) { @@ -771,7 +771,7 @@ write_stream_begin_read(struct wim_lookup_table_entry *lte, void *_ctx) list_del(<e->lookup_table_list); if (lte_new->will_be_in_output_wim) lte_new->out_refcnt += lte->out_refcnt; - if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS) + if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID) ctx->cur_write_res_size -= lte->size; if (!ret) ret = done_with_stream(lte, ctx); @@ -848,7 +848,7 @@ write_stream_uncompressed(struct wim_lookup_table_entry *lte, lte->out_reshdr.size_in_wim = lte->size; lte->out_reshdr.flags &= ~(WIM_RESHDR_FLAG_COMPRESSED | - WIM_RESHDR_FLAG_PACKED_STREAMS); + WIM_RESHDR_FLAG_SOLID); return 0; } @@ -875,7 +875,7 @@ should_rewrite_stream_uncompressed(const struct write_streams_ctx *ctx, return false; /* If the stream that would need to be re-read is located in a solid - * block in another WIM file, then re-reading it would be costly. So + * resource in another WIM file, then re-reading it would be costly. So * don't do it. * * Exception: if the compressed size happens to be *exactly* the same as @@ -890,7 +890,7 @@ should_rewrite_stream_uncompressed(const struct write_streams_ctx *ctx, * obtain the uncompressed data by decompressing the compressed data we * wrote to the output file. */ - if ((lte->flags & WIM_RESHDR_FLAG_PACKED_STREAMS) && + if ((lte->flags & WIM_RESHDR_FLAG_SOLID) && (lte->out_reshdr.size_in_wim != lte->out_reshdr.uncompressed_size)) return false; @@ -935,9 +935,9 @@ write_chunk(struct write_streams_ctx *ctx, const void *cchunk, struct wim_lookup_table_entry, write_streams_list); if (ctx->cur_write_stream_offset == 0 && - !(ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS)) + !(ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID)) { - /* Starting to write a new stream in non-packed mode. */ + /* Starting to write a new stream in non-solid mode. */ if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PIPABLE) { int additional_reshdr_flags = 0; @@ -985,8 +985,8 @@ write_chunk(struct write_streams_ctx *ctx, const void *cchunk, completed_size = usize; completed_stream_count = 0; - if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS) { - /* Wrote chunk in packed mode. It may have finished multiple + if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID) { + /* Wrote chunk in solid mode. It may have finished multiple * streams. */ struct wim_lookup_table_entry *next_lte; @@ -1004,13 +1004,13 @@ write_chunk(struct write_streams_ctx *ctx, const void *cchunk, ret = done_with_stream(lte, ctx); if (ret) return ret; - list_move_tail(<e->write_streams_list, &ctx->pack_streams); + list_move_tail(<e->write_streams_list, &ctx->solid_streams); completed_stream_count++; lte = next_lte; } } else { - /* Wrote chunk in non-packed mode. It may have finished a + /* Wrote chunk in non-solid mode. It may have finished a * stream. */ if (ctx->cur_write_stream_offset == lte->size) { @@ -1104,7 +1104,7 @@ write_stream_process_chunk(const void *chunk, size_t size, void *_ctx) const u8 *resized_chunk; size_t needed_chunk_size; - if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS) { + if (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID) { needed_chunk_size = ctx->out_chunk_size; } else { u64 res_bytes_remaining; @@ -1316,7 +1316,7 @@ write_raw_copy_resource(struct wim_resource_spec *in_rspec, list_for_each_entry(lte, &in_rspec->stream_list, rspec_node) { if (lte->will_be_in_output_wim) { stream_set_out_reshdr_for_reuse(lte); - if (in_rspec->flags & WIM_RESHDR_FLAG_PACKED_STREAMS) + if (in_rspec->flags & WIM_RESHDR_FLAG_SOLID) lte->out_res_offset_in_wim = out_offset_in_wim; else lte->out_reshdr.offset_in_wim = out_offset_in_wim; @@ -1341,7 +1341,7 @@ write_raw_copy_resources(struct list_head *raw_copy_streams, list_for_each_entry(lte, raw_copy_streams, write_streams_list) { if (lte->rspec->raw_copy_ok) { - /* Write each packed resource only one time, no matter + /* Write each solid resource only one time, no matter * how many streams reference it. */ ret = write_raw_copy_resource(lte->rspec, out_fd); if (ret) @@ -1442,11 +1442,11 @@ init_done_with_file_info(struct list_head *stream_list) * furthermore do so in such a way that no seeking backwards in * @out_fd will be performed (so it may be a pipe). * - * WRITE_RESOURCE_FLAG_PACK_STREAMS: - * Pack all the streams into a single resource rather than writing - * them in separate resources. This flag is only valid if the WIM - * version number has been, or will be, set to - * WIM_VERSION_PACKED_STREAMS. This flag may not be combined with + * WRITE_RESOURCE_FLAG_SOLID: + * Combine all the streams into a single resource rather than + * writing them in separate resources. This flag is only valid if + * the WIM version number has been, or will be, set to + * WIM_VERSION_SOLID. This flag may not be combined with * WRITE_RESOURCE_FLAG_PIPABLE. * * @out_ctype @@ -1478,15 +1478,15 @@ init_done_with_file_info(struct list_head *stream_list) * can be NULL. * * This function will write the streams in @stream_list to resources in - * consecutive positions in the output WIM file, or to a single packed resource - * if WRITE_RESOURCE_FLAG_PACK_STREAMS was specified in @write_resource_flags. - * In both cases, the @out_reshdr of the `struct wim_lookup_table_entry' for - * each stream written will be updated to specify its location, size, and flags - * in the output WIM. In the packed resource case, - * WIM_RESHDR_FLAG_PACKED_STREAMS will be set in the @flags field of each - * @out_reshdr, and furthermore @out_res_offset_in_wim and @out_res_size_in_wim - * of each @out_reshdr will be set to the offset and size, respectively, in the - * output WIM of the packed resource containing the corresponding stream. + * consecutive positions in the output WIM file, or to a single solid resource + * if WRITE_RESOURCE_FLAG_SOLID was specified in @write_resource_flags. In both + * cases, the @out_reshdr of the `struct wim_lookup_table_entry' for each stream + * written will be updated to specify its location, size, and flags in the + * output WIM. In the solid resource case, WIM_RESHDR_FLAG_SOLID will be set in + * the @flags field of each @out_reshdr, and furthermore @out_res_offset_in_wim + * and @out_res_size_in_wim of each @out_reshdr will be set to the offset and + * size, respectively, in the output WIM of the solid resource containing the + * corresponding stream. * * Each of the streams to write may be in any location supported by the * resource-handling code (specifically, read_stream_list()), such as the @@ -1502,7 +1502,7 @@ init_done_with_file_info(struct list_head *stream_list) * @will_be_in_output_wim member be set to 1 on all streams in @stream_list as * well as any other streams not in @stream_list that will be in the output WIM * file, but set to 0 on any other streams in the output WIM's lookup table or - * sharing a packed resource with a stream in @stream_list. Still furthermore, + * sharing a solid resource with a stream in @stream_list. Still furthermore, * if on-the-fly deduplication of streams is possible, then all streams in * @stream_list must also be linked by @lookup_table_list along with any other * streams that have @will_be_in_output_wim set. @@ -1542,9 +1542,9 @@ write_stream_list(struct list_head *stream_list, struct list_head raw_copy_streams; wimlib_assert((write_resource_flags & - (WRITE_RESOURCE_FLAG_PACK_STREAMS | + (WRITE_RESOURCE_FLAG_SOLID | WRITE_RESOURCE_FLAG_PIPABLE)) != - (WRITE_RESOURCE_FLAG_PACK_STREAMS | + (WRITE_RESOURCE_FLAG_SOLID | WRITE_RESOURCE_FLAG_PIPABLE)); remove_zero_length_streams(stream_list); @@ -1653,7 +1653,7 @@ write_stream_list(struct list_head *stream_list, ctx.progress_data.progress.write_streams.num_threads); INIT_LIST_HEAD(&ctx.pending_streams); - INIT_LIST_HEAD(&ctx.pack_streams); + INIT_LIST_HEAD(&ctx.solid_streams); ret = call_progress(ctx.progress_data.progfunc, WIMLIB_PROGRESS_MSG_WRITE_STREAMS, @@ -1662,7 +1662,7 @@ write_stream_list(struct list_head *stream_list, if (ret) goto out_destroy_context; - if (write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS) { + if (write_resource_flags & WRITE_RESOURCE_FLAG_SOLID) { ret = begin_write_resource(&ctx, ctx.num_bytes_to_compress); if (ret) goto out_destroy_context; @@ -1694,7 +1694,7 @@ write_stream_list(struct list_head *stream_list, if (ret) goto out_destroy_context; - if (write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS) { + if (write_resource_flags & WRITE_RESOURCE_FLAG_SOLID) { struct wim_reshdr reshdr; struct wim_lookup_table_entry *lte; u64 offset_in_res; @@ -1703,16 +1703,16 @@ write_stream_list(struct list_head *stream_list, if (ret) goto out_destroy_context; - DEBUG("Ending packed resource: %lu %lu %lu.", + DEBUG("Ending solid resource: %lu %lu %lu.", reshdr.offset_in_wim, reshdr.size_in_wim, reshdr.uncompressed_size); offset_in_res = 0; - list_for_each_entry(lte, &ctx.pack_streams, write_streams_list) { + list_for_each_entry(lte, &ctx.solid_streams, write_streams_list) { lte->out_reshdr.size_in_wim = lte->size; lte->out_reshdr.flags = filter_resource_flags(lte->flags); - lte->out_reshdr.flags |= WIM_RESHDR_FLAG_PACKED_STREAMS; + lte->out_reshdr.flags |= WIM_RESHDR_FLAG_SOLID; lte->out_reshdr.uncompressed_size = 0; lte->out_reshdr.offset_in_wim = offset_in_res; lte->out_res_offset_in_wim = reshdr.offset_in_wim; @@ -1740,15 +1740,16 @@ out_destroy_context: } static int -is_stream_packed(struct wim_lookup_table_entry *lte, void *_ignore) +is_stream_in_solid_resource(struct wim_lookup_table_entry *lte, void *_ignore) { return lte_is_partial(lte); } static bool -wim_has_packed_streams(WIMStruct *wim) +wim_has_solid_resources(WIMStruct *wim) { - return for_lookup_table_entry(wim->lookup_table, is_stream_packed, NULL); + return for_lookup_table_entry(wim->lookup_table, + is_stream_in_solid_resource, NULL); } static int @@ -1764,19 +1765,19 @@ wim_write_stream_list(WIMStruct *wim, write_resource_flags = write_flags_to_resource_flags(write_flags); - /* wimlib v1.7.0: pack streams by default if the WIM version has been - * set to WIM_VERSION_PACKED_STREAMS and at least one stream in the - * WIM's lookup table is located in a packed resource (may be the same + /* wimlib v1.7.0: create a solid WIM file by default if the WIM version + * has been set to WIM_VERSION_SOLID and at least one stream in the + * WIM's lookup table is located in a solid resource (may be the same * WIM, or a different one in the case of export). */ - if (wim->hdr.wim_version == WIM_VERSION_PACKED_STREAMS && - wim_has_packed_streams(wim)) + if (wim->hdr.wim_version == WIM_VERSION_SOLID && + wim_has_solid_resources(wim)) { - write_resource_flags |= WRITE_RESOURCE_FLAG_PACK_STREAMS; + write_resource_flags |= WRITE_RESOURCE_FLAG_SOLID; } - if (write_resource_flags & WRITE_RESOURCE_FLAG_PACK_STREAMS) { - out_chunk_size = wim->out_pack_chunk_size; - out_ctype = wim->out_pack_compression_type; + if (write_resource_flags & WRITE_RESOURCE_FLAG_SOLID) { + out_chunk_size = wim->out_solid_chunk_size; + out_ctype = wim->out_solid_compression_type; } else { out_chunk_size = wim->out_chunk_size; out_ctype = wim->out_compression_type; @@ -1806,7 +1807,7 @@ write_wim_resource(struct wim_lookup_table_entry *lte, lte->will_be_in_output_wim = 1; return write_stream_list(&stream_list, out_fd, - write_resource_flags & ~WRITE_RESOURCE_FLAG_PACK_STREAMS, + write_resource_flags & ~WRITE_RESOURCE_FLAG_SOLID, out_ctype, out_chunk_size, 1, @@ -2268,7 +2269,7 @@ write_wim_metadata_resources(WIMStruct *wim, int image, int write_flags) write_resource_flags = write_flags_to_resource_flags(write_flags); - write_resource_flags &= ~WRITE_RESOURCE_FLAG_PACK_STREAMS; + write_resource_flags &= ~WRITE_RESOURCE_FLAG_SOLID; DEBUG("Writing metadata resources (offset=%"PRIu64")", wim->out_fd.offset); @@ -2360,8 +2361,8 @@ cmp_streams_by_out_rspec(const void *p1, const void *p2) lte1 = *(const struct wim_lookup_table_entry**)p1; lte2 = *(const struct wim_lookup_table_entry**)p2; - if (lte1->out_reshdr.flags & WIM_RESHDR_FLAG_PACKED_STREAMS) { - if (lte2->out_reshdr.flags & WIM_RESHDR_FLAG_PACKED_STREAMS) { + if (lte1->out_reshdr.flags & WIM_RESHDR_FLAG_SOLID) { + if (lte2->out_reshdr.flags & WIM_RESHDR_FLAG_SOLID) { if (lte1->out_res_offset_in_wim != lte2->out_res_offset_in_wim) return cmp_u64(lte1->out_res_offset_in_wim, lte2->out_res_offset_in_wim); @@ -2369,7 +2370,7 @@ cmp_streams_by_out_rspec(const void *p1, const void *p2) return 1; } } else { - if (lte2->out_reshdr.flags & WIM_RESHDR_FLAG_PACKED_STREAMS) + if (lte2->out_reshdr.flags & WIM_RESHDR_FLAG_SOLID) return -1; } return cmp_u64(lte1->out_reshdr.offset_in_wim, @@ -2841,8 +2842,8 @@ write_wim_part(WIMStruct *wim, if (write_flags & WIMLIB_WRITE_FLAG_RETAIN_GUID) DEBUG("\tRETAIN_GUID"); - if (write_flags & WIMLIB_WRITE_FLAG_PACK_STREAMS) - DEBUG("\tPACK_STREAMS"); + if (write_flags & WIMLIB_WRITE_FLAG_SOLID) + DEBUG("\tSOLID"); if (write_flags & WIMLIB_WRITE_FLAG_FILE_DESCRIPTOR) DEBUG("\tFILE_DESCRIPTOR"); @@ -2896,7 +2897,7 @@ write_wim_part(WIMStruct *wim, /* Save previous header, then start initializing the new one. */ memcpy(&hdr_save, &wim->hdr, sizeof(struct wim_header)); - /* Set default integrity, pipable, and packed stream flags. */ + /* Set default integrity, pipable, and solid flags. */ if (!(write_flags & (WIMLIB_WRITE_FLAG_PIPABLE | WIMLIB_WRITE_FLAG_NOT_PIPABLE))) if (wim_is_pipable(wim)) { @@ -2912,11 +2913,11 @@ write_wim_part(WIMStruct *wim, } if ((write_flags & (WIMLIB_WRITE_FLAG_PIPABLE | - WIMLIB_WRITE_FLAG_PACK_STREAMS)) + WIMLIB_WRITE_FLAG_SOLID)) == (WIMLIB_WRITE_FLAG_PIPABLE | - WIMLIB_WRITE_FLAG_PACK_STREAMS)) + WIMLIB_WRITE_FLAG_SOLID)) { - ERROR("Cannot specify both PIPABLE and PACK_STREAMS!"); + ERROR("Cannot specify both PIPABLE and SOLID!"); return WIMLIB_ERR_INVALID_PARAM; } @@ -2927,9 +2928,9 @@ write_wim_part(WIMStruct *wim, wim->hdr.magic = WIM_MAGIC; /* Set appropriate version number. */ - if ((write_flags & WIMLIB_WRITE_FLAG_PACK_STREAMS) || + if ((write_flags & WIMLIB_WRITE_FLAG_SOLID) || wim->out_compression_type == WIMLIB_COMPRESSION_TYPE_LZMS) - wim->hdr.wim_version = WIM_VERSION_PACKED_STREAMS; + wim->hdr.wim_version = WIM_VERSION_SOLID; else wim->hdr.wim_version = WIM_VERSION_DEFAULT; @@ -3214,9 +3215,9 @@ overwrite_wim_inplace(WIMStruct *wim, int write_flags, unsigned num_threads) if (wim_has_integrity_table(wim)) write_flags |= WIMLIB_WRITE_FLAG_CHECK_INTEGRITY; - /* Set WIM version if adding packed streams. */ - if (write_flags & WIMLIB_WRITE_FLAG_PACK_STREAMS) - wim->hdr.wim_version = WIM_VERSION_PACKED_STREAMS; + /* Set WIM version if writing solid resources. */ + if (write_flags & WIMLIB_WRITE_FLAG_SOLID) + wim->hdr.wim_version = WIM_VERSION_SOLID; /* Set additional flags for overwrite. */ write_flags |= WIMLIB_WRITE_FLAG_OVERWRITE | -- 2.43.0