#ifndef _WIMLIB_DENTRY_H
#define _WIMLIB_DENTRY_H
+#include "wimlib/compiler.h"
#include "wimlib/list.h"
#include "wimlib/rbtree.h"
#include "wimlib/sha1.h"
/* Size of the struct wim_dentry up to and including the file_name_len. */
#define WIM_DENTRY_DISK_SIZE 102
-/* Size of on-disk WIM alternate data stream entry, in bytes, up to and
- * including the stream length field (see below). */
-#define WIM_ADS_ENTRY_DISK_SIZE 38
-
/*
* Reparse tags documented at
* http://msdn.microsoft.com/en-us/library/dd541667(v=prot.10).aspx
};
/* Length of UTF16-encoded stream name, in bytes, not including the
- * terminating null character. */
+ * terminating null character; or 0 if the stream is unnamed. */
u16 stream_name_nbytes;
/* Number to identify an alternate data stream even after it's possibly
* been moved or renamed. */
u32 stream_id;
- /* Stream name (UTF-16LE) */
+ /* Stream name (UTF-16LE), null-terminated, or NULL if the stream is
+ * unnamed. */
utf16lechar *stream_name;
- /* Unused field. We read it into memory so we can write it out
+ /* Reserved field. We read it into memory so we can write it out
* unchanged. */
- u64 unused;
+ u64 reserved;
};
/* The inode for this dentry */
struct wim_inode *d_inode;
- /* Red-black tree of sibling dentries */
+ /* Node for the parent's red-black tree of child dentries, sorted by
+ * case sensitive long name. */
struct rb_node rb_node;
+#ifdef __WIN32__
+ /* Node for the parent's red-black tree of child dentries, sorted by
+ * case insensitive long name. */
+ struct rb_node rb_node_case_insensitive;
+
+ /* List of dentries in a directory that have different case sensitive
+ * long names but share the same case insensitive long name */
+ struct list_head case_insensitive_conflict_list;
+#endif
+
/* Length of UTF-16LE encoded short filename, in bytes, not including
* the terminating zero wide-character. */
u16 short_name_nbytes;
/* Does this dentry need to be extracted? */
u8 needs_extraction : 1;
+ u8 not_extracted : 1;
+
/* Only used during NTFS capture */
u8 is_win32_name : 1;
+ /* Set to 1 if an inode has multiple DOS names. */
+ u8 dos_name_invalid : 1;
+
/* Temporary list */
struct list_head tmp_list;
* points. */
u64 subdir_offset;
+ u64 d_unused_1;
+ u64 d_unused_2;
+
/* Pointer to the UTF-16LE short filename (malloc()ed buffer) */
utf16lechar *short_name;
/* Pointer to the UTF-16LE filename (malloc()ed buffer). */
utf16lechar *file_name;
- /* Full path of this dentry */
+ /* Full path of this dentry in the WIM */
tchar *_full_path;
+
+ /* Actual name to extract this dentry as. */
+ tchar *extraction_name;
+ size_t extraction_name_nchars;
+
+ /* List head for building a list of dentries that contain a certain
+ * stream. */
+ struct list_head extraction_stream_list;
};
#define rbnode_dentry(node) container_of(node, struct wim_dentry, rb_node)
/* Unused/unknown fields that we just read into memory so we can
* re-write them unchanged. */
- u64 i_unused_1;
- u64 i_unused_2;
u32 i_rp_unknown_1;
u16 i_rp_unknown_2;
- /* A hash of the file's contents, or a pointer to the lookup table entry
- * for this dentry if the lookup table entries have been resolved.
+ /* If i_resolved == 0:
+ * SHA1 message digest of the contents of the unnamed-data stream
+ * of this inode, or all zeroes if this inode has no unnamed data
+ * stream, or optionally all zeroes if this inode has an empty
+ * unnamed data stream.
*
- * More specifically, this is for the un-named default file stream, as
- * opposed to the alternate (named) file streams, which may have their
- * own lookup table entries. */
+ * If i_resolved == 1:
+ * Pointer to the lookup table entry for the unnamed data stream
+ * of this inode, or NULL if this inode has no unnamed data stream,
+ * or optionally all zeroes if this inode has an empty unnamed data
+ * stream.
+ */
union {
u8 i_hash[SHA1_HASH_SIZE];
struct wim_lookup_table_entry *i_lte;
* noted in the @attributes field.) */
struct rb_root i_children;
+#ifdef __WIN32__
+ struct rb_root i_children_case_insensitive;
+#endif
+
/* Next alternate data stream ID to be assigned */
u32 i_next_stream_id;
extern int
print_dentry_full_path(struct wim_dentry *entry, void *ignore);
+extern int
+calculate_dentry_full_path(struct wim_dentry *dentry);
+
extern int
calculate_dentry_tree_full_paths(struct wim_dentry *root);
dentry_full_path(struct wim_dentry *dentry);
extern struct wim_inode *
-new_timeless_inode(void);
+new_timeless_inode(void) _malloc_attribute;
extern int
new_dentry(const tchar *name, struct wim_dentry **dentry_ret);
u16 uid;
u16 gid;
u16 mode;
-} PACKED;
+} _packed_attribute;
#ifndef __WIN32__
#endif
extern int
-read_dentry(const u8 metadata_resource[], u64 metadata_resource_len,
+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);