#define WIM_ADS_ENTRY_DISK_SIZE 38
-#ifndef WITH_NTFS_3G
/*
* Reparse tags documented at
* http://msdn.microsoft.com/en-us/library/dd541667(v=prot.10).aspx
*
* IO_REPARSE_TAG_SYMLINK is the only one we really care about.
*/
-#define IO_REPARSE_TAG_RESERVED_ZERO 0x00000000
-#define IO_REPARSE_TAG_RESERVED_ONE 0x00000001
-#define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
-#define IO_REPARSE_TAG_HSM 0xC0000004
-#define IO_REPARSE_TAG_HSM2 0x80000006
-#define IO_REPARSE_TAG_DRIVER_EXTENDER 0x80000005
-#define IO_REPARSE_TAG_SIS 0x80000007
-#define IO_REPARSE_TAG_DFS 0x8000000A
-#define IO_REPARSE_TAG_DFSR 0x80000012
-#define IO_REPARSE_TAG_FILTER_MANAGER 0x8000000B
-#define IO_REPARSE_TAG_SYMLINK 0xA000000C
-#endif /* !WITH_NTFS_3G */
+#define WIM_IO_REPARSE_TAG_RESERVED_ZERO 0x00000000
+#define WIM_IO_REPARSE_TAG_RESERVED_ONE 0x00000001
+#define WIM_IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
+#define WIM_IO_REPARSE_TAG_HSM 0xC0000004
+#define WIM_IO_REPARSE_TAG_HSM2 0x80000006
+#define WIM_IO_REPARSE_TAG_DRIVER_EXTENDER 0x80000005
+#define WIM_IO_REPARSE_TAG_SIS 0x80000007
+#define WIM_IO_REPARSE_TAG_DFS 0x8000000A
+#define WIM_IO_REPARSE_TAG_DFSR 0x80000012
+#define WIM_IO_REPARSE_TAG_FILTER_MANAGER 0x8000000B
+#define WIM_IO_REPARSE_TAG_SYMLINK 0xA000000C
#define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
static inline u64 ads_entry_length(const struct ads_entry *entry)
{
- return WIM_ADS_ENTRY_DISK_SIZE + entry->stream_name_len;
+ u64 len = WIM_ADS_ENTRY_DISK_SIZE + entry->stream_name_len + 2;
+ return (len + 7) & ~7;
}
/* In-memory structure for a directory entry. There is a directory tree for
int refcnt;
};
+/* Return hash of the "unnamed" (default) data stream. */
+static inline const u8 *dentry_hash(const struct dentry *dentry)
+{
+ /* If there are alternate data streams, the dentry hash field is zeroed
+ * out, and we need to find the hash in the un-named data stream (should
+ * be the first one, but check them in order just in case, and fall back
+ * to the dentry hash field if we can't find an unnamed data stream). */
+ for (u16 i = 0; i < dentry->num_ads; i++)
+ if (dentry->ads_entries[i].stream_name_len == 0)
+ return dentry->ads_entries[i].hash;
+ return dentry->hash;
+}
+
extern u64 dentry_total_length(const struct dentry *dentry);
extern void stbuf_to_dentry(const struct stat *stbuf, struct dentry *dentry);
return (dentry->attributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
}
+static inline bool dentry_is_symlink(const struct dentry *dentry)
+{
+ return (dentry->attributes & FILE_ATTRIBUTE_REPARSE_POINT)
+ && (dentry->reparse_tag == WIM_IO_REPARSE_TAG_SYMLINK);
+}
+
static inline bool dentry_is_regular_file(const struct dentry *dentry)
{
return !dentry_is_directory(dentry);