1 #ifndef _WIMLIB_METADATA_H
2 #define _WIMLIB_METADATA_H
4 #include "wimlib/list.h"
5 #include "wimlib/types.h"
6 #include "wimlib/wim.h"
12 /* Metadata for a WIM image */
13 struct wim_image_metadata {
15 /* Number of WIMStruct's that are sharing this image metadata (from
16 * calls to wimlib_export_image().) */
19 /* Pointer to the root dentry of the image. */
20 struct wim_dentry *root_dentry;
22 /* Pointer to the security data of the image. */
23 struct wim_security_data *security_data;
25 /* Pointer to the lookup table entry for this image's metadata resource
27 struct wim_lookup_table_entry *metadata_lte;
29 /* Linked list of 'struct wim_inode's for this image. */
30 struct list_head inode_list;
32 /* Linked list of 'struct wim_lookup_table_entry's for this image that
33 * are referred to in the dentry tree, but have not had a SHA1 message
34 * digest calculated yet and therefore have not been inserted into the
35 * WIM's lookup table. This list is added to during wimlib_add_image()
36 * and wimlib_mount_image() (read-write only). */
37 struct list_head unhashed_streams;
39 /* 1 iff the dentry tree has been modified. If this is the case, the
40 * memory for the dentry tree should not be freed when switching to a
41 * different WIM image. */
45 struct _ntfs_volume *ntfs_vol;
49 /* Retrieve the metadata of the image in @wim currently selected with
50 * select_wim_image(). */
51 static inline struct wim_image_metadata *
52 wim_get_current_image_metadata(WIMStruct *wim)
54 return wim->image_metadata[wim->current_image - 1];
57 /* Retrieve the root dentry of the image in @wim currently selected with
58 * select_wim_image(). */
59 static inline struct wim_dentry *
60 wim_get_current_root_dentry(WIMStruct *wim)
62 return wim_get_current_image_metadata(wim)->root_dentry;
65 /* Retrieve the security data of the image in @wim currently selected with
66 * select_wim_image(). */
67 static inline struct wim_security_data *
68 wim_get_current_security_data(WIMStruct *wim)
70 return wim_get_current_image_metadata(wim)->security_data;
73 /* Iterate over each inode in a WIM image that has not yet been hashed */
74 #define image_for_each_inode(inode, imd) \
75 list_for_each_entry(inode, &(imd)->inode_list, i_list)
77 /* Iterate over each stream in a WIM image that has not yet been hashed */
78 #define image_for_each_unhashed_stream(lte, imd) \
79 list_for_each_entry(lte, &(imd)->unhashed_streams, unhashed_list)
81 /* Iterate over each stream in a WIM image that has not yet been hashed (safe
82 * against stream removal) */
83 #define image_for_each_unhashed_stream_safe(lte, tmp, imd) \
84 list_for_each_entry_safe(lte, tmp, &(imd)->unhashed_streams, unhashed_list)
87 put_image_metadata(struct wim_image_metadata *imd,
88 struct wim_lookup_table *table);
91 append_image_metadata(WIMStruct *wim, struct wim_image_metadata *imd);
93 extern struct wim_image_metadata *
94 new_image_metadata(void) _malloc_attribute;
96 #endif /* _WIMLIB_METADATA_H */