X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=include%2Fwimlib%2Flookup_table.h;h=097750588454a733ad3167cc085b5e9dd2470eb4;hp=a01598c24896efd5a7df99b011ce1f2de17b36e1;hb=c9482ee98e12fa3f1073e4fc3c56f5eef3c40f32;hpb=e8c3ca2d1d0cac3d64985b45a9f654d2029a7518 diff --git a/include/wimlib/lookup_table.h b/include/wimlib/lookup_table.h index a01598c2..09775058 100644 --- a/include/wimlib/lookup_table.h +++ b/include/wimlib/lookup_table.h @@ -138,15 +138,21 @@ struct wim_lookup_table_entry { u16 resource_location : 5; /* 1 if this stream is a unique size (only set while writing streams). */ - u8 unique_size : 1; + u16 unique_size : 1; /* 1 if this stream has not had a SHA1 message digest calculated for it * yet */ - u8 unhashed : 1; + u16 unhashed : 1; - u8 deferred : 1; + u16 deferred : 1; - u8 no_progress : 1; + u16 no_progress : 1; + + /* If resource_location == RESOURCE_IN_WIM, this will be a cached value + * that specifies the compression type of this stream as one of + * WIMLIB_COMPRESSION_TYPE_*. Otherwise this will be 0, which is the + * same as WIMLIB_COMPRESSION_TYPE_NONE. */ + u16 compression_type : 2; /* (On-disk field) * Number of times this lookup table entry is referenced by dentries. @@ -259,7 +265,7 @@ wim_resource_size(const struct wim_lookup_table_entry *lte) static inline u64 wim_resource_chunks(const struct wim_lookup_table_entry *lte) { - return (wim_resource_size(lte) + WIM_CHUNK_SIZE - 1) / WIM_CHUNK_SIZE; + return DIV_ROUND_UP(wim_resource_size(lte), WIM_CHUNK_SIZE); } static inline u64 @@ -268,8 +274,12 @@ wim_resource_compressed_size(const struct wim_lookup_table_entry *lte) return lte->resource_entry.size; } -extern int -wim_resource_compression_type(const struct wim_lookup_table_entry *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; +} static inline bool lte_filename_valid(const struct wim_lookup_table_entry *lte) @@ -288,7 +298,7 @@ lte_filename_valid(const struct wim_lookup_table_entry *lte) } extern struct wim_lookup_table * -new_lookup_table(size_t capacity); +new_lookup_table(size_t capacity) _malloc_attribute; extern int read_lookup_table(WIMStruct *w); @@ -318,10 +328,11 @@ lookup_table_unlink(struct wim_lookup_table *table, struct wim_lookup_table_entr } extern struct wim_lookup_table_entry * -new_lookup_table_entry(void); +new_lookup_table_entry(void) _malloc_attribute; extern struct wim_lookup_table_entry * -clone_lookup_table_entry(const struct wim_lookup_table_entry *lte); +clone_lookup_table_entry(const struct wim_lookup_table_entry *lte) + _malloc_attribute; extern void print_lookup_table_entry(const struct wim_lookup_table_entry *entry, @@ -369,7 +380,7 @@ lte_zero_real_refcnt(struct wim_lookup_table_entry *entry, void *ignore); extern int lte_free_extracted_file(struct wim_lookup_table_entry *lte, void *ignore); -extern void +extern int inode_resolve_ltes(struct wim_inode *inode, struct wim_lookup_table *table); extern void