Hardware Locality (hwloc)  PR-737-20250925.0822.gite8f69c77f
diff.h
1 /*
2  * SPDX-License-Identifier: BSD-3-Clause
3  * Copyright © 2013-2024 Inria. All rights reserved.
4  * See COPYING in top-level directory.
5  */
6 
11 #ifndef HWLOC_DIFF_H
12 #define HWLOC_DIFF_H
13 
14 #ifndef HWLOC_H
15 #error Please include the main hwloc.h instead
16 #endif
17 
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #elif 0
22 }
23 #endif
24 
25 
69 
81 
86  /* each part of the union must start with these */
88  } generic;
89 
92  /* used for storing integer attributes */
94  hwloc_uint64_t index; /* not used for SIZE */
95  hwloc_uint64_t oldvalue;
96  hwloc_uint64_t newvalue;
97  } uint64;
98 
101  /* used for storing name and info pairs */
103  char *name; /* not used for NAME */
104  char *oldvalue;
105  char *newvalue;
106  } string;
107 };
108 
109 
117 
127 
130 typedef union hwloc_topology_diff_u {
132  /* each part of the union must start with these */
134  union hwloc_topology_diff_u * next; /* pointer to the next element of the list, or NULL */
135  } generic;
136 
137  /* A difference in an object attribute. */
139  hwloc_topology_diff_type_t type; /* must be ::HWLOC_TOPOLOGY_DIFF_OBJ_ATTR */
141  /* List of attribute differences for a single object */
142  int obj_depth; /* topology depth if topology attribute instead of object attribute */
143  unsigned obj_index;
145  } obj_attr;
146 
147  /* A difference that is too complex. */
149  hwloc_topology_diff_type_t type; /* must be ::HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX */
151  /* Where we had to stop computing the diff in the first topology */
153  unsigned obj_index;
154  } too_complex;
156 
157 
195 HWLOC_DECLSPEC int hwloc_topology_diff_build(hwloc_topology_t topology, hwloc_topology_t newtopology, unsigned long flags, hwloc_topology_diff_t *diff);
196 
204 };
205 
223 HWLOC_DECLSPEC int hwloc_topology_diff_apply(hwloc_topology_t topology, hwloc_topology_diff_t diff, unsigned long flags);
224 
229 HWLOC_DECLSPEC int hwloc_topology_diff_destroy(hwloc_topology_diff_t diff);
230 
244 HWLOC_DECLSPEC int hwloc_topology_diff_load_xml(const char *xmlpath, hwloc_topology_diff_t *diff, char **refname);
245 
257 HWLOC_DECLSPEC int hwloc_topology_diff_export_xml(hwloc_topology_diff_t diff, const char *refname, const char *xmlpath);
258 
277 HWLOC_DECLSPEC int hwloc_topology_diff_load_xmlbuffer(const char *xmlbuffer, int buflen, hwloc_topology_diff_t *diff, char **refname);
278 
295 HWLOC_DECLSPEC int hwloc_topology_diff_export_xmlbuffer(hwloc_topology_diff_t diff, const char *refname, char **xmlbuffer, int *buflen);
296 
300 #ifdef __cplusplus
301 } /* extern "C" */
302 #endif
303 
304 
305 #endif /* HWLOC_DIFF_H */
HWLOC_TOPOLOGY_DIFF_APPLY_REVERSE
@ HWLOC_TOPOLOGY_DIFF_APPLY_REVERSE
Apply topology diff in reverse direction.
Definition: diff.h:203
hwloc_topology_diff_apply_flags_e
hwloc_topology_diff_apply_flags_e
Flags to be given to hwloc_topology_diff_apply().
Definition: diff.h:199
hwloc_topology_diff_u::hwloc_topology_diff_obj_attr_s
Definition: diff.h:138
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s
String attribute modification with an optional name.
Definition: diff.h:100
hwloc_topology_diff_u::hwloc_topology_diff_too_complex_s::obj_index
unsigned obj_index
Definition: diff.h:153
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s::name
char * name
Definition: diff.h:103
hwloc_topology_diff_apply
int hwloc_topology_diff_apply(hwloc_topology_t topology, hwloc_topology_diff_t diff, unsigned long flags)
Apply a topology diff to an existing topology.
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_generic_s
Definition: diff.h:85
hwloc_topology_diff_load_xml
int hwloc_topology_diff_load_xml(const char *xmlpath, hwloc_topology_diff_t *diff, char **refname)
Load a list of topology differences from a XML file.
hwloc_topology_diff_u::hwloc_topology_diff_obj_attr_s::next
union hwloc_topology_diff_u * next
Definition: diff.h:140
hwloc_topology_diff_u::hwloc_topology_diff_too_complex_s::next
union hwloc_topology_diff_u * next
Definition: diff.h:150
hwloc_topology_t
struct hwloc_topology * hwloc_topology_t
Topology context.
Definition: hwloc.h:778
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO
@ HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO
the value of an info attribute is modified. The union is a hwloc_topology_diff_obj_attr_u::hwloc_topo...
Definition: diff.h:79
hwloc_topology_diff_u::hwloc_topology_diff_obj_attr_s::obj_index
unsigned obj_index
Definition: diff.h:143
hwloc_topology_diff_obj_attr_u::string
struct hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s string
hwloc_topology_diff_t
union hwloc_topology_diff_u * hwloc_topology_diff_t
One element of a difference list between two topologies.
hwloc_topology_diff_build
int hwloc_topology_diff_build(hwloc_topology_t topology, hwloc_topology_t newtopology, unsigned long flags, hwloc_topology_diff_t *diff)
Compute the difference between 2 topologies.
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_uint64_s::newvalue
hwloc_uint64_t newvalue
Definition: diff.h:96
hwloc_topology_diff_u::hwloc_topology_diff_generic_s
Definition: diff.h:131
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_uint64_s::index
hwloc_uint64_t index
Definition: diff.h:94
hwloc_topology_diff_u::hwloc_topology_diff_obj_attr_s::type
hwloc_topology_diff_type_t type
Definition: diff.h:139
hwloc_topology_diff_destroy
int hwloc_topology_diff_destroy(hwloc_topology_diff_t diff)
Destroy a list of topology differences.
hwloc_topology_diff_u::hwloc_topology_diff_obj_attr_s::obj_depth
int obj_depth
Definition: diff.h:142
hwloc_topology_diff_obj_attr_u
One object attribute difference.
Definition: diff.h:84
HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX
@ HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX
The difference is too complex, it cannot be represented. The difference below this object has not bee...
Definition: diff.h:125
hwloc_topology_diff_u::hwloc_topology_diff_too_complex_s
Definition: diff.h:148
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_generic_s::type
hwloc_topology_diff_obj_attr_type_t type
Definition: diff.h:87
hwloc_topology_diff_export_xmlbuffer
int hwloc_topology_diff_export_xmlbuffer(hwloc_topology_diff_t diff, const char *refname, char **xmlbuffer, int *buflen)
Export a list of topology differences to a XML buffer.
hwloc_topology_diff_obj_attr_type_e
hwloc_topology_diff_obj_attr_type_e
Type of one object attribute difference.
Definition: diff.h:63
hwloc_topology_diff_u
One element of a difference list between two topologies.
Definition: diff.h:130
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR
@ HWLOC_TOPOLOGY_DIFF_OBJ_ATTR
An object attribute was changed. The union is a hwloc_topology_diff_u::hwloc_topology_diff_obj_attr_s...
Definition: diff.h:116
hwloc_topology_diff_export_xml
int hwloc_topology_diff_export_xml(hwloc_topology_diff_t diff, const char *refname, const char *xmlpath)
Export a list of topology differences to a XML file.
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME
@ HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME
The object name is modified. The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_a...
Definition: diff.h:75
hwloc_topology_diff_u::hwloc_topology_diff_generic_s::type
hwloc_topology_diff_type_t type
Definition: diff.h:133
hwloc_topology_diff_obj_attr_u::uint64
struct hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_uint64_s uint64
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_uint64_s
Integer attribute modification with an optional index.
Definition: diff.h:91
hwloc_topology_diff_type_e
hwloc_topology_diff_type_e
Type of one element of a difference list.
Definition: diff.h:112
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s::oldvalue
char * oldvalue
Definition: diff.h:104
hwloc_topology_diff_u::hwloc_topology_diff_generic_s::next
union hwloc_topology_diff_u * next
Definition: diff.h:134
hwloc_topology_diff_u::hwloc_topology_diff_too_complex_s::type
hwloc_topology_diff_type_t type
Definition: diff.h:149
hwloc_topology_diff_type_t
enum hwloc_topology_diff_type_e hwloc_topology_diff_type_t
Type of one element of a difference list.
hwloc_topology_diff_u::hwloc_topology_diff_too_complex_s::obj_depth
int obj_depth
Definition: diff.h:152
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_uint64_s::type
hwloc_topology_diff_obj_attr_type_t type
Definition: diff.h:93
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s::newvalue
char * newvalue
Definition: diff.h:105
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE
@ HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE
The object local memory is modified. The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_di...
Definition: diff.h:68
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_uint64_s::oldvalue
hwloc_uint64_t oldvalue
Definition: diff.h:95
hwloc_topology_diff_obj_attr_type_t
enum hwloc_topology_diff_obj_attr_type_e hwloc_topology_diff_obj_attr_type_t
Type of one object attribute difference.
hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s::type
hwloc_topology_diff_obj_attr_type_t type
Definition: diff.h:102
hwloc_topology_diff_load_xmlbuffer
int hwloc_topology_diff_load_xmlbuffer(const char *xmlbuffer, int buflen, hwloc_topology_diff_t *diff, char **refname)
Load a list of topology differences from a XML buffer.