Skip to content

Commit 806fa7b

Browse files
committed
xml/import: allow (and ignore for now) info children in more xml tags
This commit is mostly for backport in v2.x since it will simplify xml compatibility between 3.0 export and 2.x import. Allow info tags inside all tags where it could be useful one day (topology, page_type, distances2*, memattr). We already had them in object and cpukind. It's not clear yet whether we'll use info in more objects in v3 (distances and topology have been proposed but not decided yet), but ignoring them is easy to make (current) v3 XML importable in v2. Signed-off-by: Brice Goglin <[email protected]>
1 parent c9c229b commit 806fa7b

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

hwloc/topology-xml.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,13 @@ hwloc__xml_import_pagetype(hwloc_topology_t topology __hwloc_attribute_unused, s
466466
char *attrname, *attrvalue;
467467
if (state->global->next_attr(state, &attrname, &attrvalue) < 0)
468468
break;
469-
if (!strcmp(attrname, "size"))
469+
if (!strcmp(attrname, "info")) {
470+
char *infoname, *infovalue;
471+
int ret = hwloc___xml_import_info(&infoname, &infovalue, state);
472+
if (ret < 0)
473+
return -1;
474+
/* ignored */
475+
} else if (!strcmp(attrname, "size"))
470476
size = strtoull(attrvalue, NULL, 10);
471477
else if (!strcmp(attrname, "count"))
472478
count = strtoull(attrvalue, NULL, 10);
@@ -1066,7 +1072,14 @@ hwloc__xml_v2import_distances(hwloc_topology_t topology,
10661072
if (ret <= 0)
10671073
break;
10681074

1069-
if (!strcmp(tag, "indexes"))
1075+
if (!strcmp(tag, "info")) {
1076+
char *infoname, *infovalue;
1077+
ret = hwloc___xml_import_info(&infoname, &infovalue, state);
1078+
if (ret < 0)
1079+
return ret;
1080+
/* ignored */
1081+
continue;
1082+
} else if (!strcmp(tag, "indexes"))
10701083
is_index = 1;
10711084
else if (!strcmp(tag, "u64values"))
10721085
is_u64values = 1;
@@ -1399,6 +1412,10 @@ hwloc__xml_import_memattr(hwloc_topology_t topology,
13991412

14001413
if (!strcmp(tag, "memattr_value")) {
14011414
ret = hwloc__xml_import_memattr_value(topology, id, flags, &childstate);
1415+
} else if (!strcmp(tag, "info")) {
1416+
char *infoname, *infovalue;
1417+
ret = hwloc___xml_import_info(&infoname, &infovalue, &childstate);
1418+
/* ignored */
14021419
} else {
14031420
if (hwloc__xml_verbose())
14041421
fprintf(stderr, "%s: memattr with unrecognized child %s\n",
@@ -1734,6 +1751,12 @@ hwloc_look_xml(struct hwloc_backend *backend, struct hwloc_disc_status *dstatus)
17341751
ret = hwloc__xml_import_cpukind(topology, &childstate);
17351752
if (ret < 0)
17361753
goto failed;
1754+
} else if (!strcmp(tag, "info")) {
1755+
char *infoname, *infovalue;
1756+
ret = hwloc___xml_import_info(&infoname, &infovalue, &childstate);
1757+
if (ret < 0)
1758+
goto failed;
1759+
/* ignored */
17371760
} else {
17381761
if (hwloc__xml_verbose())
17391762
fprintf(stderr, "%s: ignoring unknown tag `%s' after root object.\n",

0 commit comments

Comments
 (0)