+/*
+ * Returns the hash for stream @stream_idx of the inode, where stream_idx = 0
+ * means the default un-named file stream, and stream_idx >= 1 corresponds to an
+ * alternate data stream.
+ *
+ * This works for both resolved and un-resolved dentries.
+ */
+static inline const u8 *
+inode_stream_hash(const struct wim_inode *inode, unsigned stream_idx)
+{
+ if (inode->i_resolved)
+ return inode_stream_hash_resolved(inode, stream_idx);
+ else
+ return inode_stream_hash_unresolved(inode, stream_idx);
+}
+
+static inline u16
+inode_stream_name_nbytes(const struct wim_inode *inode, unsigned stream_idx)
+{
+ wimlib_assert(stream_idx <= inode->i_num_ads);
+ if (stream_idx == 0)
+ return 0;
+ else
+ return inode->i_ads_entries[stream_idx - 1].stream_name_nbytes;
+}
+
+static inline struct wim_lookup_table_entry *
+inode_unnamed_lte_resolved(const struct wim_inode *inode)
+{
+ wimlib_assert(inode->i_resolved);
+ for (unsigned i = 0; i <= inode->i_num_ads; i++) {
+ if (inode_stream_name_nbytes(inode, i) == 0 &&
+ !is_zero_hash(inode_stream_hash_resolved(inode, i)))
+ {
+ return inode_stream_lte_resolved(inode, i);
+ }
+ }
+ return NULL;
+}
+
+static inline struct wim_lookup_table_entry *
+inode_unnamed_lte_unresolved(const struct wim_inode *inode,
+ const struct wim_lookup_table *table)
+{
+ wimlib_assert(!inode->i_resolved);
+ for (unsigned i = 0; i <= inode->i_num_ads; i++) {
+ if (inode_stream_name_nbytes(inode, i) == 0 &&
+ !is_zero_hash(inode_stream_hash_unresolved(inode, i)))
+ {
+ return inode_stream_lte_unresolved(inode, i, table);
+ }
+ }
+ return NULL;
+}
+
+extern struct wim_lookup_table_entry *
+inode_unnamed_lte(const struct wim_inode *inode, const struct wim_lookup_table *table);
+
+extern u64
+lookup_table_total_stream_size(struct wim_lookup_table *table);
+
+
+static inline void
+lookup_table_insert_unhashed(struct wim_lookup_table *table,
+ struct wim_lookup_table_entry *lte,
+ struct wim_inode *back_inode,
+ u32 back_stream_id)
+{
+ lte->unhashed = 1;
+ lte->back_inode = back_inode;
+ lte->back_stream_id = back_stream_id;
+ list_add_tail(<e->unhashed_list, table->unhashed_streams);
+}
+
+extern int
+hash_unhashed_stream(struct wim_lookup_table_entry *lte,
+ struct wim_lookup_table *lookup_table,
+ struct wim_lookup_table_entry **lte_ret);
+
+extern struct wim_lookup_table_entry **
+retrieve_lte_pointer(struct wim_lookup_table_entry *lte);
+