+
+ if (!inode->i_resolved) {
+ struct wim_lookup_table_entry *lte;
+ /* Resolve the default file stream */
+ lte = __lookup_resource(table, inode->i_hash);
+ inode->i_lte = lte;
+ inode->i_resolved = 1;
+
+ /* Resolve the alternate data streams */
+ for (u16 i = 0; i < inode->i_num_ads; i++) {
+ struct wim_ads_entry *cur_entry = &inode->i_ads_entries[i];
+ lte = __lookup_resource(table, cur_entry->hash);
+ cur_entry->lte = lte;
+ }
+ }
+}
+
+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);