-void
-inode_unref_streams(struct wim_inode *inode,
- struct wim_lookup_table *lookup_table)
-{
- struct wim_lookup_table_entry *lte;
- unsigned i;
-
- for (i = 0; i <= inode->i_num_ads; i++) {
- lte = inode_stream_lte(inode, i, lookup_table);
- if (lte)
- lte_decrement_refcnt(lte, lookup_table);
- }
-}
-
-int
-init_inode_table(struct wim_inode_table *table, size_t capacity)
-{
- table->array = CALLOC(capacity, sizeof(table->array[0]));
- if (table->array == NULL) {
- ERROR("Cannot initalize inode table: out of memory");
- return WIMLIB_ERR_NOMEM;
- }
- table->num_entries = 0;
- table->capacity = capacity;
- INIT_LIST_HEAD(&table->extra_inodes);
- return 0;
-}
-
-void
-destroy_inode_table(struct wim_inode_table *table)
-{
- FREE(table->array);
-}
-
-static struct wim_inode *
-inode_table_get_inode(struct wim_inode_table *table, u64 ino, u64 devno)
-{
- u64 hash = hash_u64(hash_u64(ino) + hash_u64(devno));
- size_t pos = hash % table->capacity;
- struct wim_inode *inode;
- struct hlist_node *cur;
-
- hlist_for_each_entry(inode, cur, &table->array[pos], i_hlist) {
- if (inode->i_ino == ino && inode->i_devno == devno) {
- DEBUG("Using existing inode {devno=%"PRIu64", ino=%"PRIu64"}",
- devno, ino);
- inode->i_nlink++;
- return inode;
- }
- }
- inode = new_timeless_inode();
- if (inode) {
- inode->i_ino = ino;
- inode->i_devno = devno;
- hlist_add_head(&inode->i_hlist, &table->array[pos]);
- table->num_entries++;
- }
- return inode;
-}
-
-
-/* Given a directory entry with the name @name for the file with the inode
- * number @ino and device number @devno, create a new WIM dentry with an
- * associated inode, where the inode is shared if an inode with the same @ino
- * and @devno has already been created. On success, the new WIM dentry is
- * written to *dentry_ret, and its inode has i_nlink > 1 if a previously
- * existing inode was used.
+/*
+ * Translate a single-instance stream entry into the pointer contained in the
+ * inode (or ads entry of an inode) that references it.
+ *
+ * This is only possible for "unhashed" streams, which are guaranteed to have
+ * only one reference, and that reference is guaranteed to be in a resolved
+ * inode. (It can't be in an unresolved inode, since that would imply the hash
+ * is known!)