+}
+
+void inode_unresolve_ltes(struct wim_inode *inode)
+{
+ if (inode->i_resolved) {
+ if (inode->i_lte)
+ copy_hash(inode->i_hash, inode->i_lte->hash);
+ else
+ zero_out_hash(inode->i_hash);
+
+ for (u16 i = 0; i < inode->i_num_ads; i++) {
+ if (inode->i_ads_entries[i].lte)
+ copy_hash(inode->i_ads_entries[i].hash,
+ inode->i_ads_entries[i].lte->hash);
+ else
+ zero_out_hash(inode->i_ads_entries[i].hash);
+ }
+ inode->i_resolved = 0;
+ }
+}
+
+/*
+ * Returns the lookup table entry 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.
+ */
+struct wim_lookup_table_entry *
+inode_stream_lte(const struct wim_inode *inode, unsigned stream_idx,
+ const struct wim_lookup_table *table)
+{
+ if (inode->i_resolved)
+ return inode_stream_lte_resolved(inode, stream_idx);
+ else
+ return inode_stream_lte_unresolved(inode, stream_idx, table);
+}
+
+
+/* Return the lookup table entry for the unnamed data stream of an inode, or
+ * NULL if there is none.
+ *
+ * You'd think this would be easier than it actually is, since the unnamed data
+ * stream should be the one referenced from the inode itself. Alas, if there
+ * are named data streams, Microsoft's "imagex.exe" program will put the unnamed
+ * data stream in one of the alternate data streams instead of inside the WIM
+ * dentry itself. So we need to check the alternate data streams too.
+ *
+ * Also, note that a dentry may appear to have more than one unnamed stream, but
+ * if the SHA1 message digest is all 0's then the corresponding stream does not
+ * really "count" (this is the case for the inode's own file stream when the
+ * file stream that should be there is actually in one of the alternate stream
+ * entries.). This is despite the fact that we may need to extract such a
+ * missing entry as an empty file or empty named data stream.
+ */
+struct wim_lookup_table_entry *
+inode_unnamed_lte(const struct wim_inode *inode,
+ const struct wim_lookup_table *table)
+{
+ if (inode->i_resolved)
+ return inode_unnamed_lte_resolved(inode);
+ else
+ return inode_unnamed_lte_unresolved(inode, table);
+}
+
+static int lte_add_stream_size(struct wim_lookup_table_entry *lte,
+ void *total_bytes_p)
+{
+ *(u64*)total_bytes_p += lte->resource_entry.size;