X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=include%2Fwimlib%2Flookup_table.h;h=d1b980dafe240f4ae18c33c05443ed9f09c98b9f;hp=e9532971748f96717d8086c7c710c293da7a6e6a;hb=49a63aa13cdeb4c1348697ccd92207a1a65ec7b0;hpb=61db93f82eca3fe9f7676355c709c58cc425a6ad diff --git a/include/wimlib/lookup_table.h b/include/wimlib/lookup_table.h index e9532971..d1b980da 100644 --- a/include/wimlib/lookup_table.h +++ b/include/wimlib/lookup_table.h @@ -163,6 +163,12 @@ struct wim_lookup_table_entry { * resource is read again. */ u16 dont_check_metadata_hash : 1; + /* Only used during WIM write. Normal value is 0 (resource not + * filtered). */ + u16 filtered : 2; +#define FILTERED_SAME_WIM 0x1 /* Resource already in same WIM */ +#define FILTERED_EXTERNAL_WIM 0x2 /* Resource already in external WIM */ + /* (On-disk field) * Number of times this lookup table entry is referenced by dentries. * Unfortunately, this field is not always set correctly in Microsoft's @@ -237,6 +243,9 @@ struct wim_lookup_table_entry { /* Used temporarily during WIM file writing */ struct { struct hlist_node hash_list_2; + + /* Links streams being written to the WIM. */ + struct list_head write_streams_list; }; /* Used temporarily during WIM file writing (after above) */ @@ -281,9 +290,6 @@ struct wim_lookup_table_entry { /* Links streams that are still unhashed after being been added * to a WIM. */ struct list_head unhashed_list; - - /* Links streams being written to the WIM. */ - struct list_head write_streams_list; }; static inline u64 @@ -292,22 +298,26 @@ wim_resource_size(const struct wim_lookup_table_entry *lte) return lte->resource_entry.original_size; } -static inline u64 -wim_resource_chunks(const struct wim_lookup_table_entry *lte) +static inline u32 +wim_resource_chunk_size(const struct wim_lookup_table_entry * lte) { - return DIV_ROUND_UP(wim_resource_size(lte), WIM_CHUNK_SIZE); + if (lte->resource_location == RESOURCE_IN_WIM && + lte->compression_type != WIMLIB_COMPRESSION_TYPE_NONE) + return lte->wim->chunk_size; + else + return 32768; } + static inline u64 -wim_resource_compressed_size(const struct wim_lookup_table_entry *lte) +wim_resource_chunks(const struct wim_lookup_table_entry *lte) { - return lte->resource_entry.size; + return DIV_ROUND_UP(wim_resource_size(lte), wim_resource_chunk_size(lte)); } static inline int wim_resource_compression_type(const struct wim_lookup_table_entry *lte) { - BUILD_BUG_ON(WIMLIB_COMPRESSION_TYPE_NONE != 0); return lte->compression_type; } @@ -375,7 +385,8 @@ for_lookup_table_entry(struct wim_lookup_table *table, void *arg); extern int -cmp_streams_by_wim_position(const void *p1, const void *p2); +sort_stream_list_by_sequential_order(struct list_head *stream_list, + size_t list_head_offset); extern int for_lookup_table_entry_pos_sorted(struct wim_lookup_table *table, @@ -384,12 +395,14 @@ for_lookup_table_entry_pos_sorted(struct wim_lookup_table *table, void *arg); extern struct wim_lookup_table_entry * -__lookup_resource(const struct wim_lookup_table *table, const u8 hash[]); +lookup_resource(const struct wim_lookup_table *table, const u8 hash[]); extern int -lookup_resource(WIMStruct *wim, const tchar *path, - int lookup_flags, struct wim_dentry **dentry_ret, - struct wim_lookup_table_entry **lte_ret, u16 *stream_idx_ret); +wim_pathname_to_stream(WIMStruct *wim, const tchar *path, + int lookup_flags, + struct wim_dentry **dentry_ret, + struct wim_lookup_table_entry **lte_ret, + u16 *stream_idx_ret); extern void lte_decrement_refcnt(struct wim_lookup_table_entry *lte, @@ -415,6 +428,9 @@ extern int inode_resolve_ltes(struct wim_inode *inode, struct wim_lookup_table *table, bool force); +extern int +resource_not_found_error(const struct wim_inode *inode, const u8 *hash); + extern void inode_unresolve_ltes(struct wim_inode *inode); @@ -438,9 +454,9 @@ inode_stream_lte_unresolved(const struct wim_inode *inode, unsigned stream_idx, if (!table) return NULL; if (stream_idx == 0) - return __lookup_resource(table, inode->i_hash); + return lookup_resource(table, inode->i_hash); else - return __lookup_resource(table, + return lookup_resource(table, inode->i_ads_entries[ stream_idx - 1].hash); } @@ -498,6 +514,9 @@ inode_stream_name_nbytes(const struct wim_inode *inode, unsigned stream_idx) return inode->i_ads_entries[stream_idx - 1].stream_name_nbytes; } +extern struct wim_lookup_table_entry * +inode_unnamed_stream_resolved(const struct wim_inode *inode, u16 *stream_idx_ret); + extern struct wim_lookup_table_entry * inode_unnamed_lte_resolved(const struct wim_inode *inode); @@ -508,6 +527,9 @@ inode_unnamed_lte_unresolved(const struct wim_inode *inode, extern struct wim_lookup_table_entry * inode_unnamed_lte(const struct wim_inode *inode, const struct wim_lookup_table *table); +extern const u8 * +inode_unnamed_stream_hash(const struct wim_inode *inode); + extern u64 lookup_table_total_stream_size(struct wim_lookup_table *table);