X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=include%2Fwimlib%2Flookup_table.h;h=4252f3a5ccdac4cbca41b534b9bb687c6f7fef75;hb=0158ecdaa9e7475a75799f369468f9af5a8ce4ea;hp=9d6f70a8bc94f0708bacc7392ea8332e9f4a9864;hpb=3eba9411dba38757a990330ea3889f3be3eb20d9;p=wimlib diff --git a/include/wimlib/lookup_table.h b/include/wimlib/lookup_table.h index 9d6f70a8..4252f3a5 100644 --- a/include/wimlib/lookup_table.h +++ b/include/wimlib/lookup_table.h @@ -63,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. * @@ -136,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. @@ -164,7 +169,10 @@ struct wim_lookup_table_entry { tchar *file_on_disk; void *attached_buffer; #ifdef WITH_FUSE - tchar *staging_file_name; + struct { + char *staging_file_name; + int staging_dir_fd; + }; #endif #ifdef WITH_NTFS_3G struct ntfs_location *ntfs_loc; @@ -176,12 +184,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. */ @@ -209,14 +211,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; }; }; @@ -340,9 +344,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) { @@ -350,17 +351,13 @@ lte_is_partial(const struct wim_lookup_table_entry * lte) lte->size != lte->rspec->uncompressed_size; } -static inline bool -lte_filename_valid(const struct wim_lookup_table_entry *lte) +static inline const struct stream_owner * +stream_owners(struct wim_lookup_table_entry *stream) { - return lte->resource_location == RESOURCE_IN_FILE_ON_DISK - #ifdef __WIN32__ - || lte->resource_location == RESOURCE_WIN32_ENCRYPTED - #endif - #ifdef WITH_FUSE - || lte->resource_location == RESOURCE_IN_STAGING_FILE - #endif - ; + if (stream->out_refcnt <= ARRAY_LEN(stream->inline_stream_owners)) + return stream->inline_stream_owners; + else + return stream->stream_owners; } static inline void