1
2
3
4
5
6 #ifndef PRIVATE_XML_H
7 #define PRIVATE_XML_H 1
8
9 #include <hwloc.h>
10
11 #include <sys/types.h>
12
13 HWLOC_DECLSPEC int hwloc__xml_verbose(void);
14
15
16
17
18
19 typedef struct hwloc__xml_import_state_s {
20 struct hwloc__xml_import_state_s *parent;
21
22
23 struct hwloc_xml_backend_data_s *global;
24
25
26
27
28 char data[32];
29 } * hwloc__xml_import_state_t;
30
31 struct hwloc__xml_imported_v1distances_s {
32 unsigned long kind;
33 unsigned nbobjs;
34 float *floats;
35 struct hwloc__xml_imported_v1distances_s *prev, *next;
36 };
37
38 HWLOC_DECLSPEC int hwloc__xml_import_diff(hwloc__xml_import_state_t state, hwloc_topology_diff_t *firstdiffp);
39
40 struct hwloc_xml_backend_data_s {
41
42 int (*look_init)(struct hwloc_xml_backend_data_s *bdata, struct hwloc__xml_import_state_s *state);
43 void (*look_done)(struct hwloc_xml_backend_data_s *bdata, int result);
44 void (*backend_exit)(struct hwloc_xml_backend_data_s *bdata);
45 int (*next_attr)(struct hwloc__xml_import_state_s * state, char **namep, char **valuep);
46 int (*find_child)(struct hwloc__xml_import_state_s * state, struct hwloc__xml_import_state_s * childstate, char **tagp);
47 int (*close_tag)(struct hwloc__xml_import_state_s * state);
48 void (*close_child)(struct hwloc__xml_import_state_s * state);
49 int (*get_content)(struct hwloc__xml_import_state_s * state, char **beginp, size_t expected_length);
50 void (*close_content)(struct hwloc__xml_import_state_s * state);
51 char * msgprefix;
52 void *data;
53 unsigned version_major, version_minor;
54 unsigned nbnumanodes;
55 hwloc_obj_t first_numanode, last_numanode;
56 struct hwloc__xml_imported_v1distances_s *first_v1dist, *last_v1dist;
57 };
58
59
60
61
62
63 typedef struct hwloc__xml_export_state_s {
64 struct hwloc__xml_export_state_s *parent;
65
66 void (*new_child)(struct hwloc__xml_export_state_s *parentstate, struct hwloc__xml_export_state_s *state, const char *name);
67 void (*new_prop)(struct hwloc__xml_export_state_s *state, const char *name, const char *value);
68 void (*add_content)(struct hwloc__xml_export_state_s *state, const char *buffer, size_t length);
69 void (*end_object)(struct hwloc__xml_export_state_s *state, const char *name);
70
71 struct hwloc__xml_export_data_s {
72 hwloc_obj_t v1_memory_group;
73 } *global;
74
75
76
77
78 char data[40];
79 } * hwloc__xml_export_state_t;
80
81 HWLOC_DECLSPEC void hwloc__xml_export_topology(hwloc__xml_export_state_t parentstate, hwloc_topology_t topology, unsigned long flags);
82
83 HWLOC_DECLSPEC void hwloc__xml_export_diff(hwloc__xml_export_state_t parentstate, hwloc_topology_diff_t diff);
84
85
86
87
88
89 struct hwloc_xml_callbacks {
90 int (*backend_init)(struct hwloc_xml_backend_data_s *bdata, const char *xmlpath, const char *xmlbuffer, int xmlbuflen);
91 int (*export_file)(struct hwloc_topology *topology, struct hwloc__xml_export_data_s *edata, const char *filename, unsigned long flags);
92 int (*export_buffer)(struct hwloc_topology *topology, struct hwloc__xml_export_data_s *edata, char **xmlbuffer, int *buflen, unsigned long flags);
93 void (*free_buffer)(void *xmlbuffer);
94 int (*import_diff)(struct hwloc__xml_import_state_s *state, const char *xmlpath, const char *xmlbuffer, int xmlbuflen, hwloc_topology_diff_t *diff, char **refnamep);
95 int (*export_diff_file)(union hwloc_topology_diff_u *diff, const char *refname, const char *filename);
96 int (*export_diff_buffer)(union hwloc_topology_diff_u *diff, const char *refname, char **xmlbuffer, int *buflen);
97 };
98
99 struct hwloc_xml_component {
100 struct hwloc_xml_callbacks *nolibxml_callbacks;
101 struct hwloc_xml_callbacks *libxml_callbacks;
102 };
103
104 HWLOC_DECLSPEC void hwloc_xml_callbacks_register(struct hwloc_xml_component *component);
105 HWLOC_DECLSPEC void hwloc_xml_callbacks_reset(void);
106
107 #endif