+/* Open the NTFS inode that corresponds to the parent of a WIM dentry. */
+static ntfs_inode *dentry_open_parent_ni(const struct dentry *dentry,
+ ntfs_volume *vol)
+{
+ char *p;
+ const char *dir_name;
+ ntfs_inode *dir_ni;
+ char orig;
+
+ p = dentry->full_path_utf8 + dentry->full_path_utf8_len;
+ do {
+ p--;
+ } while (*p != '/');
+
+ orig = *p;
+ *p = '\0';
+ dir_name = dentry->full_path_utf8;
+ dir_ni = ntfs_pathname_to_inode(vol, NULL, dir_name);
+ if (!dir_ni) {
+ ERROR_WITH_ERRNO("Could not find NTFS inode for `%s'",
+ dir_name);
+ }
+ *p = orig;
+ return dir_ni;
+}
+