Minor enhancements to the hwloc base:
* NULL's out the hwloc_obj_t->userdata in hwloc_base_util.c:free_object() and hwloc_base_util.c:opal_hwloc_base_free_topology() after it has been OBJ_RELEASE'd. * Adds a userdata field to opal_hwloc_topo_data_t. This field will be used in an upcoming rmaps component ("lama") to cache some associated data during hardware tree traversals. This commit was SVN r26938.
Этот коммит содержится в:
родитель
d818c9d407
Коммит
91ccba9643
@ -333,6 +333,7 @@ static void topo_data_const(opal_hwloc_topo_data_t *ptr)
|
|||||||
{
|
{
|
||||||
ptr->available = NULL;
|
ptr->available = NULL;
|
||||||
OBJ_CONSTRUCT(&ptr->summaries, opal_list_t);
|
OBJ_CONSTRUCT(&ptr->summaries, opal_list_t);
|
||||||
|
ptr->userdata = NULL;
|
||||||
}
|
}
|
||||||
static void topo_data_dest(opal_hwloc_topo_data_t *ptr)
|
static void topo_data_dest(opal_hwloc_topo_data_t *ptr)
|
||||||
{
|
{
|
||||||
@ -345,6 +346,7 @@ static void topo_data_dest(opal_hwloc_topo_data_t *ptr)
|
|||||||
OBJ_RELEASE(item);
|
OBJ_RELEASE(item);
|
||||||
}
|
}
|
||||||
OBJ_DESTRUCT(&ptr->summaries);
|
OBJ_DESTRUCT(&ptr->summaries);
|
||||||
|
ptr->userdata = NULL;
|
||||||
}
|
}
|
||||||
OBJ_CLASS_INSTANCE(opal_hwloc_topo_data_t,
|
OBJ_CLASS_INSTANCE(opal_hwloc_topo_data_t,
|
||||||
opal_object_t,
|
opal_object_t,
|
||||||
|
@ -240,6 +240,7 @@ static void free_object(hwloc_obj_t obj)
|
|||||||
if (NULL != obj->userdata) {
|
if (NULL != obj->userdata) {
|
||||||
data = (opal_hwloc_obj_data_t*)obj->userdata;
|
data = (opal_hwloc_obj_data_t*)obj->userdata;
|
||||||
OBJ_RELEASE(data);
|
OBJ_RELEASE(data);
|
||||||
|
obj->userdata = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* loop thru our children */
|
/* loop thru our children */
|
||||||
@ -259,6 +260,7 @@ void opal_hwloc_base_free_topology(hwloc_topology_t topo)
|
|||||||
if (NULL != obj->userdata) {
|
if (NULL != obj->userdata) {
|
||||||
rdata = (opal_hwloc_topo_data_t*)obj->userdata;
|
rdata = (opal_hwloc_topo_data_t*)obj->userdata;
|
||||||
OBJ_RELEASE(rdata);
|
OBJ_RELEASE(rdata);
|
||||||
|
obj->userdata = NULL;
|
||||||
}
|
}
|
||||||
/* now recursively descend and release userdata
|
/* now recursively descend and release userdata
|
||||||
* in the rest of the objects
|
* in the rest of the objects
|
||||||
|
@ -132,6 +132,9 @@ typedef struct {
|
|||||||
opal_object_t super;
|
opal_object_t super;
|
||||||
hwloc_cpuset_t available;
|
hwloc_cpuset_t available;
|
||||||
opal_list_t summaries;
|
opal_list_t summaries;
|
||||||
|
|
||||||
|
/** \brief Additional space for custom data */
|
||||||
|
void *userdata;
|
||||||
} opal_hwloc_topo_data_t;
|
} opal_hwloc_topo_data_t;
|
||||||
OBJ_CLASS_DECLARATION(opal_hwloc_topo_data_t);
|
OBJ_CLASS_DECLARATION(opal_hwloc_topo_data_t);
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user