]> wimlib.net Git - wimlib/blobdiff - include/wimlib/lookup_table.h
Merge branch 'new_extract'
[wimlib] / include / wimlib / lookup_table.h
index a169e3934985f995b80ae34a908def3fe35ab3ee..216565e1939b334f2e6c9ac576199683b9137045 100644 (file)
@@ -28,8 +28,7 @@ enum resource_location {
        RESOURCE_IN_WIM,
 
        /* The stream is located in the external file named by @file_on_disk.
-        * On Windows, @file_on_disk may actually specify a named data stream
-        * (file path, then colon, then name of the stream).  */
+        */
        RESOURCE_IN_FILE_ON_DISK,
 
        /* The stream is directly attached in the in-memory buffer pointed to by
@@ -52,6 +51,11 @@ enum resource_location {
 #endif
 
 #ifdef __WIN32__
+       /* Windows only: the stream is located in the external file named by
+        * @file_on_disk, which is in the Windows NT namespace and may specify a
+        * named data stream.  */
+       RESOURCE_IN_WINNT_FILE_ON_DISK,
+
        /* Windows only: the stream is located in the external file named by
         * @file_on_disk, but the file is encrypted and must be read using the
         * appropriate Windows API.  */
@@ -59,6 +63,11 @@ enum resource_location {
 #endif
 };
 
+struct stream_owner {
+       struct wim_inode *inode;
+       const utf16lechar *stream_name;
+};
+
 /* Specification for a stream, which may be the contents of a file (unnamed data
  * stream), a named data stream, reparse point data, or a WIM metadata resource.
  *
@@ -132,8 +141,8 @@ struct wim_lookup_table_entry {
        /* When a WIM file is written, this is set to the number of references
         * (by dentries) to this stream in the output WIM file.
         *
-        * During extraction, this is set to the number of times the stream must
-        * be extracted.
+        * During extraction, this is the number of slots in stream_owners (or
+        * inline_stream_owners) that have been filled.
         *
         * During image export, this is set to the number of references of this
         * stream that originated from the source WIM.
@@ -172,12 +181,6 @@ struct wim_lookup_table_entry {
         */
        struct list_head rspec_node;
 
-       /* This field is used during the hardlink and symlink image extraction
-        * modes.   In these modes, all identical files are linked together, and
-        * @extracted_file will be set to the filename of the first extracted
-        * file containing this stream.  */
-       tchar *extracted_file;
-
        /* Temporary fields  */
        union {
                /* Fields used temporarily during WIM file writing.  */
@@ -193,6 +196,7 @@ struct wim_lookup_table_entry {
                                struct {
                                        u64 out_res_offset_in_wim;
                                        u64 out_res_size_in_wim;
+                                       u64 out_res_uncompressed_size;
                                };
                        };
 
@@ -204,14 +208,16 @@ struct wim_lookup_table_entry {
                        struct wim_reshdr out_reshdr;
                };
 
-               /* Used temporarily during extraction  */
+               /* Used temporarily during extraction.  This is an array of
+                * pointers to the inodes being extracted that use this stream.
+                */
                union {
-                       /* Dentries to extract that reference this stream.
+                       /* Inodes to extract that reference this stream.
                         * out_refcnt tracks the number of slots filled.  */
-                       struct wim_dentry *inline_lte_dentries[7];
+                       struct stream_owner inline_stream_owners[3];
                        struct {
-                               struct wim_dentry **lte_dentries;
-                               size_t alloc_lte_dentries;
+                               struct stream_owner *stream_owners;
+                               u32 alloc_stream_owners;
                        };
                };
 
@@ -335,9 +341,6 @@ lte_zero_out_refcnt(struct wim_lookup_table_entry *lte, void *ignore);
 extern int
 lte_zero_real_refcnt(struct wim_lookup_table_entry *lte, void *ignore);
 
-extern int
-lte_free_extracted_file(struct wim_lookup_table_entry *lte, void *ignore);
-
 static inline bool
 lte_is_partial(const struct wim_lookup_table_entry * lte)
 {
@@ -358,6 +361,15 @@ lte_filename_valid(const struct wim_lookup_table_entry *lte)
                ;
 }
 
+static inline const struct stream_owner *
+stream_owners(struct wim_lookup_table_entry *stream)
+{
+       if (stream->out_refcnt <= ARRAY_LEN(stream->inline_stream_owners))
+               return stream->inline_stream_owners;
+       else
+               return stream->stream_owners;
+}
+
 static inline void
 lte_bind_wim_resource_spec(struct wim_lookup_table_entry *lte,
                           struct wim_resource_spec *rspec)