From: Brice Goglin Date: Tue, 2 Jul 2013 13:22:51 +0000 (+0000) Subject: Fix/cleanup misc object depth X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=c083491ce1e355f792a32b923702ae6f1c81e174;p=people%2Fandrewcoop%2Fhwloc.git Fix/cleanup misc object depth Misc can be added though insert_by_parent (load from XML) or explicit insert_misc_by_parent/cpuset(). So move the actual setting of their depth or these, instead of trying to do it during level build since Misc objects are kind of ignored there anyway. This fixes tests/hwloc_insert_misc when debug is enabled (depth was 0 instead of -1 when reloading from XML). This commit was SVN r5724. --- diff --git a/src/topology.c b/src/topology.c index 5931683b..3a083c08 100644 --- a/src/topology.c +++ b/src/topology.c @@ -904,6 +904,11 @@ hwloc_insert_object_by_parent(struct hwloc_topology *topology, hwloc_obj_t paren next_child = child->next_sibling; hwloc_insert_object_by_parent(topology, parent, child); } + + if (obj->type == HWLOC_OBJ_MISC) { + /* misc objects go in no level (needed here because level building doesn't see Misc objects inside I/O trees) */ + obj->depth = (unsigned) HWLOC_TYPE_DEPTH_UNKNOWN; + } } /* Adds a misc object _after_ detection, and thus has to reconnect all the pointers */ @@ -926,7 +931,7 @@ hwloc_topology_insert_misc_object_by_cpuset(struct hwloc_topology *topology, hwl if (name) obj->name = strdup(name); - /* misc objects go in no level (needed here because level building doesn't see Misc objects inside I/O trees) */ + /* misc objects go in no level */ obj->depth = (unsigned) HWLOC_TYPE_DEPTH_UNKNOWN; obj->cpuset = hwloc_bitmap_dup(cpuset); @@ -984,9 +989,6 @@ hwloc_topology_insert_misc_object_by_parent(struct hwloc_topology *topology, hwl return NULL; } - /* misc objects go in no level (needed here because level building doesn't see Misc objects inside I/O trees) */ - obj->depth = (unsigned) HWLOC_TYPE_DEPTH_UNKNOWN; - hwloc_insert_object_by_parent(topology, parent, obj); hwloc_connect_children(topology->levels[0][0]); @@ -1943,8 +1945,6 @@ hwloc_level_filter_object(hwloc_topology_t topology, int nb = hwloc_level_filter_object(topology, new_obj, old->children[i]); if (new_obj) { new_obj += nb; - /* misc objects go in no level (needed here because insert_misc() not always involved e.g. during XML import) */ - old->depth = (unsigned) HWLOC_TYPE_DEPTH_UNKNOWN; } total += nb; }