]> wimlib.net Git - wimlib/blobdiff - src/dentry.h
Windows native build
[wimlib] / src / dentry.h
index 7caeee997ce5659b43c8227fa40906eda00021ac..76087320d52ab46bc4928eefcf29677cb295755f 100644 (file)
@@ -255,6 +255,7 @@ struct wim_inode {
        /* %true iff verify_inode() has run on this inode. */
        u8 i_verified : 1;
 
+       /* Used only in NTFS-mode extraction */
        u8 i_dos_name_extracted : 1;
 
        /* Number of alternate data streams associated with this inode */
@@ -322,10 +323,8 @@ struct wim_inode {
 #define inode_add_dentry(dentry, inode) \
                list_add_tail(&(dentry)->d_alias, &(inode)->i_dentry)
 
-static inline struct wim_dentry *inode_first_dentry(struct wim_inode *inode)
-{
-       return container_of(inode->i_dentry.next, struct wim_dentry, d_alias);
-}
+#define inode_first_dentry(inode) \
+               container_of(inode->i_dentry.next, struct wim_dentry, d_alias)
 
 static inline bool dentry_is_first_in_inode(const struct wim_dentry *dentry)
 {
@@ -395,10 +394,45 @@ extern struct wim_ads_entry *inode_get_ads_entry(struct wim_inode *inode,
 
 extern struct wim_ads_entry *inode_add_ads(struct wim_inode *dentry,
                                           const char *stream_name);
+extern int inode_add_ads_with_data(struct wim_inode *inode, const char *name,
+                                  const u8 *value, size_t size,
+                                  struct wim_lookup_table *lookup_table);
 
 extern void inode_remove_ads(struct wim_inode *inode, u16 idx,
                             struct wim_lookup_table *lookup_table);
 
+#define WIMLIB_UNIX_DATA_TAG "$$__wimlib_UNIX_data"
+
+#define WIMLIB_UNIX_DATA_TAG_LEN (sizeof(WIMLIB_UNIX_DATA_TAG) - 1)
+
+/* Format for special alternate data stream entries to store UNIX data for files
+ * and directories (see: WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA) */
+struct wimlib_unix_data {
+       u16 version; /* Must be 0 */
+       u16 uid;
+       u16 gid;
+       u16 mode;
+} PACKED;
+
+#ifndef __WIN32__
+
+#define NO_UNIX_DATA (-1)
+#define BAD_UNIX_DATA (-2)
+extern int inode_get_unix_data(const struct wim_inode *inode,
+                              struct wimlib_unix_data *unix_data,
+                              u16 *stream_idx_ret);
+
+#define UNIX_DATA_UID    0x1
+#define UNIX_DATA_GID    0x2
+#define UNIX_DATA_MODE   0x4
+#define UNIX_DATA_ALL    (UNIX_DATA_UID | UNIX_DATA_GID | UNIX_DATA_MODE)
+#define UNIX_DATA_CREATE 0x8
+extern int inode_set_unix_data(struct wim_inode *inode,
+                              uid_t uid, gid_t gid, mode_t mode,
+                              struct wim_lookup_table *lookup_table,
+                              int which);
+#endif
+
 extern int read_dentry(const u8 metadata_resource[], u64 metadata_resource_len,
                       u64 offset, struct wim_dentry *dentry);