X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=include%2Fwimlib%2Flookup_table.h;h=f0cfb768f1e92410f022180c1c3393f9d1d04e62;hb=7cfb9777313e1a2f60a49d6b9ef87910f27f1a51;hp=b5b3830fcbde38ac13ee876aaec39ccf23aaf753;hpb=f24f8409b041727329e980fdc81e84a7c9b00e5b;p=wimlib diff --git a/include/wimlib/lookup_table.h b/include/wimlib/lookup_table.h index b5b3830f..f0cfb768 100644 --- a/include/wimlib/lookup_table.h +++ b/include/wimlib/lookup_table.h @@ -49,50 +49,50 @@ struct ntfs_location { * * If we open a WIM and read its lookup table, the location is set to * RESOURCE_IN_WIM since all the streams will initially be located in the WIM. - * However, to deal with problems such as image capture and image mount, we - * allow the actual location of the stream to be somewhere else, such as an - * external file. + * However, to handle situations such as image capture and image mount, we allow + * the actual location of the stream to be somewhere else, such as an external + * file. */ enum resource_location { - /* The lookup table entry does not correspond to a stream (this state - * should exist only temporarily) */ + /* The lookup table entry does not yet correspond to a stream; this is a + * temporary state only. */ RESOURCE_NONEXISTENT = 0, - /* The stream resource is located in a WIM file. The WIMStruct for the - * WIM file will be pointed to by the @wim member. The compression type - * of the resource will be cached in @compression_type, and the pipable - * status of the resource will be cached in @pipable. */ + /* 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 contain multiple streams. */ RESOURCE_IN_WIM, - /* The stream resource is located in an external file. The name of the - * file will be provided by @file_on_disk member. - * - * Note: On Windows @file_on_disk may actually specify a named data - * stream. */ + /* 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. + */ RESOURCE_IN_FILE_ON_DISK, - /* The stream resource is directly attached in an in-memory buffer - * pointed to by @attached_buffer. */ + /* The stream is directly attached in the in-memory buffer pointed to by + * @attached_buffer. */ RESOURCE_IN_ATTACHED_BUFFER, #ifdef WITH_FUSE - /* The stream resource is located in an external file in the staging - * directory for a read-write mount. */ + /* The stream is located in the external file named by + * @staging_file_name, located in the staging directory for a read-write + * mount. */ RESOURCE_IN_STAGING_FILE, #endif #ifdef WITH_NTFS_3G - /* The stream resource is located in an NTFS volume. It is identified - * by volume, filename, data stream name, and by whether it is a reparse - * point or not. @ntfs_loc points to a structure containing this - * information. */ + /* The stream is located in an NTFS volume. It is identified by volume, + * filename, data stream name, and by whether it is a reparse point or + * not. @ntfs_loc points to a structure containing this information. + * */ RESOURCE_IN_NTFS_VOLUME, #endif #ifdef __WIN32__ - /* Windows only: the file is on disk in the file named @file_on_disk, - * but the file is encrypted and must be read using special functions. - * */ + /* 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. */ RESOURCE_WIN32_ENCRYPTED, #endif @@ -115,10 +115,10 @@ struct wim_lookup_table_entry { struct hlist_node hash_list; /* Uncompressed size of the stream. */ - u64 size : 56; + u64 size; /* Stream flags (WIM_RESHDR_FLAG_*). */ - u64 flags : 8; + u16 flags : 8; /* One of the `enum resource_location' values documented above. */ u16 resource_location : 5; @@ -185,7 +185,10 @@ struct wim_lookup_table_entry { /* Pointers to somewhere where the stream is actually located. See the * comments for the @resource_location field above. */ union { - struct wim_resource_spec *rspec; + struct { + struct wim_resource_spec *rspec; + u64 offset_in_res; + }; tchar *file_on_disk; void *attached_buffer; #ifdef WITH_FUSE @@ -264,23 +267,11 @@ struct wim_lookup_table_entry { struct list_head wim_resource_list; }; -static inline int -lte_ctype(const struct wim_lookup_table_entry *lte) -{ - if (lte->resource_location == RESOURCE_IN_WIM) - return lte->rspec->ctype; - else - return WIMLIB_COMPRESSION_TYPE_NONE; -} - -static inline u32 -lte_cchunk_size(const struct wim_lookup_table_entry * lte) +static inline bool +lte_is_partial(const struct wim_lookup_table_entry * lte) { - if (lte->resource_location == RESOURCE_IN_WIM && - lte->rspec->ctype != WIMLIB_COMPRESSION_TYPE_NONE) - return lte->rspec->cchunk_size; - else - return 32768; + return lte->resource_location == RESOURCE_IN_WIM && + lte->size != lte->rspec->uncompressed_size; } static inline bool @@ -388,9 +379,7 @@ lte_bind_wim_resource_spec(struct wim_lookup_table_entry *lte, { lte->resource_location = RESOURCE_IN_WIM; lte->rspec = rspec; - list_add(<e->wim_resource_list, &rspec->lte_list); - lte->flags = rspec->flags; - lte->size = rspec->uncompressed_size; + list_add_tail(<e->wim_resource_list, &rspec->stream_list); } static inline void