]> wimlib.net Git - wimlib/blobdiff - include/wimlib/lookup_table.h
resource.c: Cleanup and refactor
[wimlib] / include / wimlib / lookup_table.h
index 936163480c1f08f2524a92b2ada7cc86a52ad1bf..d1b980dafe240f4ae18c33c05443ed9f09c98b9f 100644 (file)
@@ -298,16 +298,26 @@ wim_resource_size(const struct wim_lookup_table_entry *lte)
        return lte->resource_entry.original_size;
 }
 
+static inline u32
+wim_resource_chunk_size(const struct wim_lookup_table_entry * lte)
+{
+       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_chunks(const struct wim_lookup_table_entry *lte)
 {
-       return DIV_ROUND_UP(wim_resource_size(lte), WIM_CHUNK_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;
 }
 
@@ -419,7 +429,7 @@ inode_resolve_ltes(struct wim_inode *inode, struct wim_lookup_table *table,
                   bool force);
 
 extern int
-resource_not_found_error(struct wim_inode *inode, const u8 *hash);
+resource_not_found_error(const struct wim_inode *inode, const u8 *hash);
 
 extern void
 inode_unresolve_ltes(struct wim_inode *inode);
@@ -504,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);
 
@@ -514,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);