+ /* NTFS filename namespaces need careful consideration. A name for a
+ * NTFS file may be in either the POSIX, Win32, DOS, or Win32+DOS
+ * namespaces. The following list of assumptions and facts clarify the
+ * way that WIM dentries are mapped to NTFS files. The statements
+ * marked ASSUMPTION are statements I am assuming to be true due to the
+ * lack of documentation; they are verified in verify_dentry() and
+ * verify_inode() in verify.c.
+ *
+ * - ASSUMPTION: The root WIM dentry has neither a "long name" nor a
+ * "short name".
+ *
+ * - ASSUMPTION: Every WIM dentry other than the root directory provides
+ * a non-empty "long name" and a possibly empty "short name". The
+ * "short name" corresponds to the DOS name of the file, while the
+ * "long name" may be Win32 or POSIX.
+ *
+ * XXX It may actually be legal to have a short name but no long name
+ *
+ * - FACT: If a dentry has a "long name" but no "short name", then it is
+ * ambigious whether the name is POSIX or Win32+DOS, unless the name
+ * is a valid POSIX name but not a valid Win32+DOS name. wimlib
+ * currently will always create POSIX names for these files, as this
+ * is the behavior of the ntfs_create() and ntfs_link() functions.
+ *
+ * - FACT: Multiple WIM dentries may correspond to the same underlying
+ * inode, as provided at this point in the code by the d_inode member.
+ */
+
+
+ /* Currently wimlib does not apply DOS names to hard linked files due to
+ * issues with ntfs-3g, so the following is commented out. */
+#if 0
+again:
+ /*
+ * libntfs-3g requires that for an NTFS inode with a DOS name, the
+ * corresponding long name be extracted first so that the DOS name is
+ * associated with the correct long name. Note that by the last
+ * ASSUMPTION above, a NTFS inode can have at most one DOS name (i.e. a
+ * WIM inode can have at most one non-empty short name).
+ *
+ * Therefore, search for an alias of this dentry that has a short name,
+ * and extract it first unless it was already extracted.
+ */
+ orig_dentry = NULL;
+ if (!dentry->d_inode->i_dos_name_extracted) {
+ inode_for_each_dentry(other, dentry->d_inode) {
+ if (other->short_name_len && other != dentry &&
+ !other->is_extracted)
+ {
+ orig_dentry = dentry;
+ dentry = other;
+ break;
+ }
+ }
+ dentry->d_inode->i_dos_name_extracted = 1;
+ }
+#endif