]> wimlib.net Git - wimlib/blobdiff - include/wimlib/lookup_table.h
Heuristic sorting of streams for solid compression
[wimlib] / include / wimlib / lookup_table.h
index bfd219c85434b627cd2023a07899927052a59a01..4158f1578f1a9f79289d26eccb311803b3356c7d 100644 (file)
@@ -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.
@@ -108,6 +107,9 @@ struct wim_lookup_table_entry {
 
        u32 may_send_done_with_file : 1;
 
+       /* Only used by wimlib_export_image() */
+       u32 was_exported : 1;
+
        union {
                /* (On-disk field) SHA1 message digest of the stream referenced
                 * by this lookup table entry.  */
@@ -197,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;
@@ -211,9 +213,19 @@ struct wim_lookup_table_entry {
                        /* Links streams being written to the WIM.  */
                        struct list_head write_streams_list;
 
-                       /* Metadata for this stream in the WIM being written.
-                        */
-                       struct wim_reshdr out_reshdr;
+                       union {
+                               /* Metadata for this stream in the WIM being
+                                * written.  */
+                               struct wim_reshdr out_reshdr;
+
+                               struct {
+                                       /* Name under which this stream is being
+                                        * sorted; used only when sorting
+                                        * streams for solid compression.  */
+                                       utf16lechar *solid_sort_name;
+                                       size_t solid_sort_name_nbytes;
+                               };
+                       };
                };
 
                /* Used temporarily during extraction.  This is an array of
@@ -337,6 +349,9 @@ extern int
 sort_stream_list_by_sequential_order(struct list_head *stream_list,
                                     size_t list_head_offset);
 
+extern int
+cmp_streams_by_sequential_order(const void *p1, const void *p2);
+
 /* Utility functions  */
 
 extern int