- ret = read_dentry(buf, metadata_len, dentry_offset, dentry);
-
- /* This is the root dentry, so set its parent to itself. */
- dentry->parent = dentry;
-
- if (ret != 0)
- goto out_free_dentry_tree;
- inode_add_dentry(dentry, dentry->d_inode);
-
- /* Now read the entire directory entry tree into memory. */
- DEBUG("Reading dentry tree");
- ret = read_dentry_tree(buf, metadata_len, dentry);
- if (ret != 0)
- goto out_free_dentry_tree;
-
- /* Calculate the full paths in the dentry tree. */
- DEBUG("Calculating dentry full paths");
- ret = for_dentry_in_tree(dentry, calculate_dentry_full_path, NULL);
- if (ret != 0)
- goto out_free_dentry_tree;
-
- /* Build hash table that maps hard link group IDs to dentry sets */
- DEBUG("Building link group table");
- ret = init_inode_table(&inode_tab, 9001);
- if (ret != 0)
- goto out_free_dentry_tree;
-
- for_dentry_in_tree(dentry, inode_table_insert, &inode_tab);
-
- DEBUG("Fixing inconsistencies in the hard link groups");
- ret = fix_inodes(&inode_tab, &inode_list);
- destroy_inode_table(&inode_tab);
- if (ret != 0)
- goto out_free_dentry_tree;
-
- DEBUG("Running miscellaneous verifications on the dentry tree");
- for_lookup_table_entry(w->lookup_table, lte_zero_real_refcnt, NULL);
- ret = for_dentry_in_tree(dentry, verify_dentry, w);
- if (ret != 0)
- goto out_free_dentry_tree;
-
- DEBUG("Done reading image metadata");
-
- imd->root_dentry = dentry;
- imd->inode_list = inode_list;
- goto out_free_buf;
-out_free_dentry_tree:
- free_dentry_tree(dentry, NULL);
-out_free_security_data:
- free_security_data(imd->security_data);
- imd->security_data = NULL;
-out_free_buf:
- FREE(buf);