Hardware Locality (hwloc)  v2.0-20191027.0400.gite37e7d8
diff.h
00001 /*
00002  * Copyright © 2013-2018 Inria.  All rights reserved.
00003  * See COPYING in top-level directory.
00004  */
00005 
00010 #ifndef HWLOC_DIFF_H
00011 #define HWLOC_DIFF_H
00012 
00013 #ifndef HWLOC_H
00014 #error Please include the main hwloc.h instead
00015 #endif
00016 
00017 
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #elif 0
00021 }
00022 #endif
00023 
00024 
00062 typedef enum hwloc_topology_diff_obj_attr_type_e {
00067   HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE,
00068 
00074   HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME,
00078   HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO
00079 } hwloc_topology_diff_obj_attr_type_t;
00080 
00083 union hwloc_topology_diff_obj_attr_u {
00084   struct hwloc_topology_diff_obj_attr_generic_s {
00085     /* each part of the union must start with these */
00086     hwloc_topology_diff_obj_attr_type_t type;
00087   } generic;
00088 
00090   struct hwloc_topology_diff_obj_attr_uint64_s {
00091     /* used for storing integer attributes */
00092     hwloc_topology_diff_obj_attr_type_t type;
00093     hwloc_uint64_t index; /* not used for SIZE */
00094     hwloc_uint64_t oldvalue;
00095     hwloc_uint64_t newvalue;
00096   } uint64;
00097 
00099   struct hwloc_topology_diff_obj_attr_string_s {
00100     /* used for storing name and info pairs */
00101     hwloc_topology_diff_obj_attr_type_t type;
00102     char *name; /* not used for NAME */
00103     char *oldvalue;
00104     char *newvalue;
00105   } string;
00106 };
00107 
00108 
00111 typedef enum hwloc_topology_diff_type_e {
00115   HWLOC_TOPOLOGY_DIFF_OBJ_ATTR,
00116 
00124   HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX
00125 } hwloc_topology_diff_type_t;
00126 
00129 typedef union hwloc_topology_diff_u {
00130   struct hwloc_topology_diff_generic_s {
00131     /* each part of the union must start with these */
00132     hwloc_topology_diff_type_t type;
00133     union hwloc_topology_diff_u * next; /* pointer to the next element of the list, or NULL */
00134   } generic;
00135 
00136   /* A difference in an object attribute. */
00137   struct hwloc_topology_diff_obj_attr_s {
00138     hwloc_topology_diff_type_t type; /* must be ::HWLOC_TOPOLOGY_DIFF_OBJ_ATTR */
00139     union hwloc_topology_diff_u * next;
00140     /* List of attribute differences for a single object */
00141     int obj_depth;
00142     unsigned obj_index;
00143     union hwloc_topology_diff_obj_attr_u diff;
00144   } obj_attr;
00145 
00146   /* A difference that is too complex. */
00147   struct hwloc_topology_diff_too_complex_s {
00148     hwloc_topology_diff_type_t type; /* must be ::HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX */
00149     union hwloc_topology_diff_u * next;
00150     /* Where we had to stop computing the diff in the first topology */
00151     int obj_depth;
00152     unsigned obj_index;
00153   } too_complex;
00154 } * hwloc_topology_diff_t;
00155 
00156 
00194 HWLOC_DECLSPEC int hwloc_topology_diff_build(hwloc_topology_t topology, hwloc_topology_t newtopology, unsigned long flags, hwloc_topology_diff_t *diff);
00195 
00198 enum hwloc_topology_diff_apply_flags_e {
00202   HWLOC_TOPOLOGY_DIFF_APPLY_REVERSE = (1UL<<0)
00203 };
00204 
00222 HWLOC_DECLSPEC int hwloc_topology_diff_apply(hwloc_topology_t topology, hwloc_topology_diff_t diff, unsigned long flags);
00223 
00226 HWLOC_DECLSPEC int hwloc_topology_diff_destroy(hwloc_topology_diff_t diff);
00227 
00239 HWLOC_DECLSPEC int hwloc_topology_diff_load_xml(const char *xmlpath, hwloc_topology_diff_t *diff, char **refname);
00240 
00250 HWLOC_DECLSPEC int hwloc_topology_diff_export_xml(hwloc_topology_diff_t diff, const char *refname, const char *xmlpath);
00251 
00263 HWLOC_DECLSPEC int hwloc_topology_diff_load_xmlbuffer(const char *xmlbuffer, int buflen, hwloc_topology_diff_t *diff, char **refname);
00264 
00279 HWLOC_DECLSPEC int hwloc_topology_diff_export_xmlbuffer(hwloc_topology_diff_t diff, const char *refname, char **xmlbuffer, int *buflen);
00280 
00284 #ifdef __cplusplus
00285 } /* extern "C" */
00286 #endif
00287 
00288 
00289 #endif /* HWLOC_DIFF_H */