]> wimlib.net Git - wimlib/blob - include/wimlib/xml.h
439bd012438b1a8abca002106cd1ddb29fbb2057
[wimlib] / include / wimlib / xml.h
1 #ifndef _WIMLIB_XML_H
2 #define _WIMLIB_XML_H
3
4 #include "wimlib/types.h"
5
6 struct image_info;
7 struct resource_entry;
8
9 /* A struct wim_info structure corresponds to the entire XML data for a WIM file. */
10 struct wim_info {
11         u64 total_bytes;
12         int num_images;
13         /* Array of `struct image_info's, one for each image in the WIM that is
14          * mentioned in the XML data. */
15         struct image_info *images;
16 };
17
18 /* xml.c */
19 extern int
20 xml_export_image(const struct wim_info *old_wim_info, int image,
21                  struct wim_info **new_wim_info_p,
22                  const tchar *dest_image_name,
23                  const tchar *dest_image_description);
24
25 extern size_t
26 xml_get_max_image_name_len(const WIMStruct *w);
27
28 extern void
29 xml_update_image_info(WIMStruct *w, int image);
30
31 extern void
32 xml_delete_image(struct wim_info **wim_info_p, int image);
33
34 extern int
35 xml_add_image(WIMStruct *w, const tchar *name);
36
37 extern void
38 free_wim_info(struct wim_info *info);
39
40 extern void
41 print_image_info(const struct wim_info *wim_info, int image);
42
43 extern int
44 read_xml_data(int in_fd, const struct resource_entry *res,
45               struct wim_info **info_ret);
46
47 extern int
48 write_xml_data(const struct wim_info *wim_info, int image, int out_fd,
49                u64 total_bytes, struct resource_entry *out_res_entry);
50
51 extern void
52 libxml_global_init(void);
53
54 extern void
55 libxml_global_cleanup(void);
56
57 static inline u64
58 wim_info_get_total_bytes(const struct wim_info *info)
59 {
60         return info->total_bytes;
61 }
62
63 static inline unsigned
64 wim_info_get_num_images(const struct wim_info *info)
65 {
66         return info->num_images;
67 }
68
69 #ifdef ENABLE_CUSTOM_MEMORY_ALLOCATOR
70 extern void
71 xml_set_memory_allocator(void *(*malloc_func)(size_t),
72                          void (*free_func)(void *),
73                          void *(*realloc_func)(void *, size_t));
74 #endif
75
76 #endif