@@ -435,6 +435,7 @@ hwloc___xml_import_info(char **infonamep, char **infovaluep,
435435
436436static int
437437hwloc__xml_import_obj_info (hwloc_topology_t topology ,
438+ struct hwloc_xml_backend_data_s * data ,
438439 hwloc_obj_t obj ,
439440 hwloc__xml_import_state_t state )
440441{
@@ -449,27 +450,31 @@ hwloc__xml_import_obj_info(hwloc_topology_t topology,
449450 if (infoname ) {
450451 /* empty strings are ignored by libxml */
451452 if (infovalue ) {
452- if (!obj -> parent && (
453- !strcmp (infoname , "Backend" )
454- || !strcmp (infoname , "SyntheticDescription" )
455- || !strcmp (infoname , "LinuxCgroup" )
456- || !strcmp (infoname , "WindowsBuildEnvironment" )
457- || !strcmp (infoname , "OSName" )
458- || !strcmp (infoname , "OSRelease" )
459- || !strcmp (infoname , "OSVersion" )
460- || !strcmp (infoname , "HostName" )
461- || !strcmp (infoname , "Architecture" )
462- || !strcmp (infoname , "hwlocVersion" )
463- || !strcmp (infoname , "ProcessName" ))) {
464- /* topo infos were in root in v2 */
465- hwloc__add_info (& topology -> infos , infoname , infovalue );
466- } else {
467- hwloc_obj_add_info (obj , infoname , infovalue );
453+ if (data -> version_major <= 2 ) {
454+ /* v2 info tweaks */
455+ if (!obj -> parent ) {
456+ /* these v2 root infos must move to topo infos */
457+ if (!strcmp (infoname , "Backend" )
458+ || !strcmp (infoname , "SyntheticDescription" )
459+ || !strcmp (infoname , "LinuxCgroup" )
460+ || !strcmp (infoname , "WindowsBuildEnvironment" )
461+ || !strcmp (infoname , "OSName" )
462+ || !strcmp (infoname , "OSRelease" )
463+ || !strcmp (infoname , "OSVersion" )
464+ || !strcmp (infoname , "HostName" )
465+ || !strcmp (infoname , "Architecture" )
466+ || !strcmp (infoname , "hwlocVersion" )
467+ || !strcmp (infoname , "ProcessName" )) {
468+ hwloc__add_info (& topology -> infos , infoname , infovalue );
469+ return 0 ;
470+ }
471+ }
468472 }
473+ hwloc_obj_add_info (obj , infoname , infovalue );
469474 }
470475 }
471476
472- return err ;
477+ return 0 ;
473478}
474479
475480static int
@@ -717,7 +722,7 @@ hwloc__xml_import_object(hwloc_topology_t topology,
717722 }
718723
719724 } else if (!strcmp (tag , "info" )) {
720- ret = hwloc__xml_import_obj_info (topology , obj , & childstate );
725+ ret = hwloc__xml_import_obj_info (topology , data , obj , & childstate );
721726 } else if (!strcmp (tag , "userdata" )) {
722727 ret = hwloc__xml_import_userdata (topology , obj , & childstate );
723728 } else {
0 commit comments