#include "wimlib/list.h"
#include "wimlib/lookup_table.h"
#include "wimlib/sha1.h"
-#include "wimlib/unix_data.h"
#include <string.h>
/*
* WIM inode.
*
- * As mentioned in the comment above `struct wim_dentry', in the WIM file that
+ * As mentioned in the comment above `struct wim_dentry', in WIM files there
* is no on-disk analogue of a real inode, as most of these fields are
* duplicated in the dentries. Instead, a `struct wim_inode' is something we
* create ourselves to simplify the handling of hard links.
* entries for this inode. */
struct wim_ads_entry *i_ads_entries;
+ /* If not NULL, a pointer to the extra data that was read from the
+ * dentry. This should be a series of tagged items, each of which
+ * represents a bit of extra metadata, such as the file's object ID.
+ * See tagged_items.c for more information. */
+ void *i_extra;
+
+ /* Size of @i_extra buffer in bytes. If 0, there is no extra data. */
+ size_t i_extra_size;
+
/* Creation time, last access time, and last write time for this inode, in
* 100-nanosecond intervals since 12:00 a.m UTC January 1, 1601. They
* should correspond to the times gotten by calling GetFileTime() on
};
#ifdef WITH_FUSE
- /* Used only during image mount: Table of file descriptors that
- * have been opened to this inode. The table is automatically
- * freed when the last file descriptor is closed. */
- struct wimfs_fd **i_fds;
+ struct {
+ /* Used only during image mount: Table of file
+ * descriptors that have been opened to this inode.
+ * This table is freed when the last file descriptor is
+ * closed. */
+ struct wimfs_fd **i_fds;
+
+ /* Lower bound on the index of the next available entry
+ * in 'i_fds'. */
+ u16 i_next_fd;
+ };
#endif
};
dentry_full_path(inode_first_dentry(inode))
extern struct wim_ads_entry *
-inode_get_ads_entry(struct wim_inode *inode, const tchar *stream_name,
- u16 *idx_ret);
+inode_get_ads_entry(struct wim_inode *inode, const tchar *stream_name);
extern struct wim_ads_entry *
inode_add_ads_utf16le(struct wim_inode *inode,
extern struct wim_ads_entry *
inode_add_ads(struct wim_inode *dentry, const tchar *stream_name);
-extern int
+extern struct wim_ads_entry *
inode_add_ads_with_data(struct wim_inode *inode, const tchar *name,
const void *value, size_t size,
struct wim_lookup_table *lookup_table);
struct wim_lookup_table *lookup_table);
extern void
-inode_remove_ads(struct wim_inode *inode, u16 idx,
+inode_remove_ads(struct wim_inode *inode, struct wim_ads_entry *entry,
struct wim_lookup_table *lookup_table);
-static inline bool
-ads_entry_is_unix_data(const struct wim_ads_entry *entry)
-{
- return (entry->stream_name_nbytes ==
- WIMLIB_UNIX_DATA_TAG_UTF16LE_NBYTES) &&
- !memcmp(entry->stream_name, WIMLIB_UNIX_DATA_TAG_UTF16LE,
- WIMLIB_UNIX_DATA_TAG_UTF16LE_NBYTES);
-}
-
static inline bool
ads_entry_is_named_stream(const struct wim_ads_entry *entry)
{
- return entry->stream_name_nbytes != 0 && !ads_entry_is_unix_data(entry);
+ return entry->stream_name_nbytes != 0;
}
/* Is the inode a directory?
return inode->i_ads_entries[stream_idx - 1].stream_name_nbytes;
}
+static inline u32
+inode_stream_idx_to_id(const struct wim_inode *inode, unsigned stream_idx)
+{
+ if (stream_idx == 0)
+ return 0;
+ else
+ return inode->i_ads_entries[stream_idx - 1].stream_id;
+}
+
extern struct wim_lookup_table_entry *
inode_unnamed_stream_resolved(const struct wim_inode *inode, u16 *stream_idx_ret);
extern int
read_ads_entries(const u8 * restrict p, struct wim_inode * restrict inode,
- size_t nbytes_remaining);
+ size_t *nbytes_remaining_p);
extern int
verify_inode(struct wim_inode *inode, const struct wim_security_data *sd);