-extern int calculate_dentry_full_path(struct dentry *dentry, void *ignore);
-extern void calculate_subdir_offsets(struct dentry *dentry, u64 *subdir_offset_p);
-extern int get_names(char **name_utf16_ret, char **name_utf8_ret,
- u16 *name_utf16_len_ret, u16 *name_utf8_len_ret,
- const char *name);
-extern int change_dentry_name(struct dentry *dentry, const char *new_name);
-extern int change_ads_name(struct ads_entry *entry, const char *new_name);
-
-extern void unlink_dentry(struct dentry *dentry);
-extern void link_dentry(struct dentry *dentry, struct dentry *parent);
-
-extern int print_dentry(struct dentry *dentry, void *lookup_table);
-extern int print_dentry_full_path(struct dentry *entry, void *ignore);
-
-extern struct dentry *get_dentry(WIMStruct *w, const char *path);
-extern struct dentry *get_parent_dentry(WIMStruct *w, const char *path);
-extern struct dentry *get_dentry_child_with_name(const struct dentry *dentry,
- const char *name);
-extern void dentry_update_all_timestamps(struct dentry *dentry);
-extern void init_dentry(struct dentry *dentry, const char *name);
-extern struct dentry *new_dentry(const char *name);
-
-extern void dentry_free_ads_entries(struct dentry *dentry);
-extern void free_dentry(struct dentry *dentry);
-extern void put_dentry(struct dentry *dentry);
-extern struct dentry *clone_dentry(struct dentry *old);
-extern void free_dentry_tree(struct dentry *root,
- struct lookup_table *lookup_table);
-extern int increment_dentry_refcnt(struct dentry *dentry, void *ignore);
-extern int decrement_dentry_refcnt(struct dentry *dentry, void *ignore);
-
-extern void calculate_dir_tree_statistics(struct dentry *root,
- struct lookup_table *table,
- u64 *dir_count_ret,
- u64 *file_count_ret,
- u64 *total_bytes_ret,
- u64 *hard_link_bytes_ret);
-
-extern int read_dentry(const u8 metadata_resource[], u64 metadata_resource_len,
- u64 offset, struct dentry *dentry);
-
-extern int verify_dentry(struct dentry *dentry, void *wim);
-
-extern int read_dentry_tree(const u8 metadata_resource[],
- u64 metadata_resource_len, struct dentry *dentry);
-
-extern u8 *write_dentry_tree(const struct dentry *tree, u8 *p);
-
-
-/* Return the number of dentries in the hard link group */
-static inline size_t dentry_link_group_size(const struct dentry *dentry)
+extern void unlink_dentry(struct wim_dentry *dentry);
+extern bool dentry_add_child(struct wim_dentry * restrict parent,
+ struct wim_dentry * restrict child);
+
+extern struct wim_ads_entry *inode_get_ads_entry(struct wim_inode *inode,
+ const char *stream_name,
+ u16 *idx_ret);
+
+extern struct wim_ads_entry *inode_add_ads(struct wim_inode *dentry,
+ const char *stream_name);
+
+extern void inode_remove_ads(struct wim_inode *inode, u16 idx,
+ struct wim_lookup_table *lookup_table);
+
+extern int read_dentry(const u8 metadata_resource[], u64 metadata_resource_len,
+ u64 offset, struct wim_dentry *dentry);
+
+
+extern int read_dentry_tree(const u8 metadata_resource[],
+ u64 metadata_resource_len,
+ struct wim_dentry *dentry);
+
+extern u8 *write_dentry_tree(const struct wim_dentry *tree, u8 *p);
+
+static inline bool dentry_is_root(const struct wim_dentry *dentry)