#include "wimlib/list.h"
struct wim_image_metadata;
-struct wim_info;
-struct wim_lookup_table;
+struct wim_xml_info;
+struct blob_table;
/*
* WIMStruct - represents a WIM, or a part of a non-standalone WIM
*
* Note 2: although this is the top-level data structure in wimlib, there do
* exist cases in which a WIMStruct is not standalone:
- * - streams have been referenced from another WIMStruct
+ * - blobs have been referenced from another WIMStruct
* - an image has been imported into this WIMStruct from another
* (as this references the metadata rather than copies it)
*
/* Information from the header of the WIM file.
*
- * This is also maintained for a WIMStruct not backed by a file, but the
- * 'reshdr' fields have no meaning. */
+ * This is also maintained for a WIMStruct not backed by a file, but in
+ * that case the 'reshdr' fields are left zeroed. */
struct wim_header hdr;
+ /* If the library is currently writing this WIMStruct out to a file,
+ * then this is the header being created for that file. */
+ struct wim_header out_hdr;
+
/* Array of image metadata, one for each image in the WIM (array length
* hdr.image_count). Or, this will be NULL if this WIM does not contain
* metadata, which implies that this WIMStruct either represents part of
/* Information from the XML data of the WIM file. This information is
* also maintained for a WIMStruct not backed by a file. */
- struct wim_info *wim_info;
+ struct wim_xml_info *xml_info;
+
+ /* The blob table for this WIMStruct. If this WIMStruct has a backing
+ * file, then this table will index the blobs contained in that file.
+ * In addition, this table may index blobs that were added by updates or
+ * referenced from other WIMStructs. */
+ struct blob_table *blob_table;
- /* The lookup table for this WIMStruct. If this WIMStruct has a backing
- * file, then this table will index the streams contained in that file.
- * In addition, this table may index streams that were added by updates
- * or referenced from other WIMStructs. */
- struct wim_lookup_table *lookup_table;
+ /* The number of references to this WIMStruct. This is equal to the
+ * number of resource descriptors that reference this WIMStruct, plus 1
+ * if wimlib_free() still needs to be called. */
+ ssize_t refcnt;
/*
* The 1-based index of the currently selected image in this WIMStruct,
* decompressor can be used for all data --- and that decompressor will
* be cached here. However, if we do encounter any data with a
* different compression type or chunk size (this is possible in solid
- * blocks), then this cached decompressor will be replaced with a new
+ * resources), then this cached decompressor will be replaced with a new
* one.
*/
struct wimlib_decompressor *decompressor;
u8 decompressor_ctype;
u32 decompressor_max_block_size;
- /*
- * 'subwims' is the list of dependent WIMStructs (linked by
- * 'subwim_node') that have been opened by calls to
- * wimlib_reference_resource_files(). These WIMStructs must be retained
- * so that resources from them can be used. They are internal to the
- * library and are not visible to API users.
- */
- struct list_head subwims;
- struct list_head subwim_node;
-
/* Temporary field; use sparingly */
void *private;
/* 1 if the WIM file has been locked for appending, otherwise 0 */
u8 locked_for_append : 1;
+ /* 1 if the WIM file is currently being compacted by wimlib_overwrite()
+ * with WIMLIB_WRITE_FLAG_UNSAFE_COMPACT */
+ u8 being_compacted : 1;
+
/* If this WIM is backed by a file, then this is the compression type
* for non-solid resources in that file. */
u8 compression_type;
* 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. */
* 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. */
/*
* Return true if and only if the WIM contains image metadata (actual directory
- * trees, not just a collection of streams and their checksums).
+ * trees, not just a collection of blobs and their checksums).
*
* See the description of the 'image_metadata' field. Note that we return true
* when the image count is 0 because it could be a WIM with 0 images. It's only
return (wim->hdr.magic == PWM_MAGIC);
}
-extern int
-set_wim_hdr_cflags(int ctype, struct wim_header *hdr);
+extern void
+wim_decrement_refcnt(WIMStruct *wim);
-extern int
-init_wim_header(struct wim_header *hdr, int ctype, u32 chunk_size);
+extern bool
+wim_has_solid_resources(const WIMStruct *wim);
extern int
read_wim_header(WIMStruct *wim, struct wim_header *hdr);
extern int
-write_wim_header(const struct wim_header *hdr, struct filedes *out_fd);
-
-extern int
-write_wim_header_at_offset(const struct wim_header *hdr, struct filedes *out_fd,
- off_t offset);
+write_wim_header(const struct wim_header *hdr, struct filedes *out_fd,
+ off_t offset);
extern int
write_wim_header_flags(u32 hdr_flags, struct filedes *out_fd);
extern int
select_wim_image(WIMStruct *wim, int image);
+extern void
+deselect_current_wim_image(WIMStruct *wim);
+
extern int
for_image(WIMStruct *wim, int image, int (*visitor)(WIMStruct *));
extern int
-wim_checksum_unhashed_streams(WIMStruct *wim);
+wim_checksum_unhashed_blobs(WIMStruct *wim);
extern int
delete_wim_image(WIMStruct *wim, int image);