+/*
+ * In-memory structure for a WIM directory entry (dentry). There is a directory
+ * tree for each image in the WIM.
+ *
+ * Note that this is a directory entry and not an inode. Since NTFS allows hard
+ * links, it's possible for a NTFS inode to correspond to multiple WIM dentries.
+ * The hard link group ID field of the on-disk WIM dentry tells us the number of
+ * the NTFS inode that the dentry corresponds to (and this gets placed in
+ * d_inode->i_ino).
+ *
+ * Unfortunately, WIM files do not have an analogue to an inode; instead certain
+ * information, such as file attributes, the security descriptor, and file
+ * streams is replicated in each hard-linked dentry, even though this
+ * information really is associated with an inode. In-memory, we fix up this
+ * flaw by allocating a `struct wim_inode' for each dentry that contains some of
+ * this duplicated information, then combining the inodes for each hard link
+ * group together.
+ *
+ * Confusingly, it's possible for stream information to be missing from a dentry
+ * in a hard link set, in which case the stream information needs to be gotten
+ * from one of the other dentries in the hard link set. In addition, it is
+ * possible for dentries to have inconsistent security IDs, file attributes, or
+ * file streams when they share the same hard link ID (don't even ask. I hope
+ * that Microsoft may have fixed this problem, since I've only noticed it in the
+ * 'install.wim' for Windows 7). For those dentries, we have to use the
+ * conflicting fields to split up the hard link groups. (See
+ * dentry_tree_fix_inodes() in hardlink.c).
+ */
+struct wim_dentry {
+ /* The inode for this dentry */
+ struct wim_inode *d_inode;
+
+ /* Red-black tree of sibling dentries */
+ struct rb_node rb_node;
+
+ /* Length of UTF-16LE encoded short filename, in bytes, not including
+ * the terminating zero wide-character. */
+ u16 short_name_nbytes;
+
+ /* Length of UTF-16LE encoded "long" file name, in bytes, not including
+ * the terminating null character. */
+ u16 file_name_nbytes;
+
+ /* Length of full path name, in bytes, as a multibyte-encoded string */
+ u32 full_path_nbytes;
+
+ u8 is_extracted : 1;
+
+ /* Only used during NTFS capture */
+ u8 is_win32_name : 1;
+
+ /* Temporary list */
+ struct list_head tmp_list;
+
+ /* List of dentries in the inode (hard link set) */
+ struct list_head d_alias;
+
+ /* The parent of this directory entry. */
+ struct wim_dentry *parent;
+
+ /*
+ * Size of directory entry on disk, in bytes. Typical size is around
+ * 104 to 120 bytes.
+ *
+ * It is possible for the length field to be 0. This situation, which
+ * is undocumented, indicates the end of a list of sibling nodes in a
+ * directory. It also means the real length is 8, because the dentry
+ * included only the length field, but that takes up 8 bytes.
+ *
+ * The length here includes the base directory entry on disk as well as
+ * the long and short filenames. It does NOT include any alternate
+ * stream entries that may follow the directory entry, even though the
+ * size of those needs to be considered. The length SHOULD be 8-byte
+ * aligned, although we don't require it to be. We do require the
+ * length to be large enough to hold the file name(s) of the dentry;
+ * additionally, a warning is issued if this field is larger than the
+ * aligned size.
+ */
+ u64 length;