fb296000c855edc48a32ce4cd6c02570615661d6
[wimlib] / src / xml.h
1 #ifndef _WIMLIB_XML_H
2 #define _WIMLIB_XML_H
3
4 #include "util.h"
5
6 /* A struct wim_info structure corresponds to the entire XML data for a WIM file. */
7 struct wim_info {
8         u64 total_bytes;
9         u64 num_images;
10         /* Array of WIMImageInfos, one for each image in the WIM that is
11          * mentioned in the XML data. */
12         struct image_info *images;
13 };
14
15 /* xml.c */
16 extern int xml_export_image(const struct wim_info *old_wim_info, int image, 
17                             struct wim_info **new_wim_info_p,
18                             const char *dest_image_name,
19                             const char *dest_image_description);
20
21 extern size_t xml_get_max_image_name_len(const WIMStruct *w);
22
23 extern void xml_update_image_info(WIMStruct *w, int image);
24
25 extern void xml_delete_image(struct wim_info **wim_info_p, int image);
26
27 extern int xml_add_image(WIMStruct *w, struct dentry *root_dentry, 
28                          const char *name);
29
30 extern void free_wim_info(struct wim_info *info);
31
32 extern void print_image_info(const struct wim_info *wim_info, int image);
33
34 extern int read_xml_data(FILE *fp, const struct resource_entry *res, 
35                          u8 **xml_data_ret, struct wim_info **info_ret);
36
37 extern int write_xml_data(const struct wim_info *wim_info, int image, FILE *out,
38                           u64 total_bytes);
39
40 static inline u64 wim_info_get_total_bytes(const struct wim_info *info)
41 {
42         return info->total_bytes;
43 }
44
45 static inline unsigned wim_info_get_num_images(const struct wim_info *info)
46 {
47         return info->num_images;
48 }
49
50 #endif