1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
/*
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/sysinfo/sysinfo.h"
#include "opal/mca/sysinfo/base/base.h"
/*
* Globals
*/
int opal_sysinfo_base_select(void)
{
int pri;
opal_sysinfo_module_t *module;
opal_sysinfo_base_module_t *sysmod;
mca_base_module_t *mod;
mca_base_component_list_item_t *cli;
mca_base_component_t *component;
opal_list_item_t *item;
if (opal_sysinfo_selected) {
return OPAL_SUCCESS;
}
opal_sysinfo_selected = true;
/*
* Select all available components
*/
for (item = opal_list_get_first(&opal_sysinfo_base_components_opened);
item != opal_list_get_end(&opal_sysinfo_base_components_opened);
item = opal_list_get_next(item)) {
cli = (mca_base_component_list_item_t *) item;
component = (mca_base_component_t *) cli->cli_component;
if (NULL == component->mca_query_component) {
/* no way to get the module */
continue;
}
if (OPAL_SUCCESS != component->mca_query_component(&mod, &pri)) {
continue;
}
/* init the module */
sysmod = (opal_sysinfo_base_module_t*)mod;
if (NULL != sysmod->init) {
if (OPAL_SUCCESS != sysmod->init()) {
/* can't run */
continue;
}
}
module = OBJ_NEW(opal_sysinfo_module_t);
module->module = sysmod;
opal_list_append(&opal_sysinfo_avail_modules, &module->super);
}
return OPAL_SUCCESS;
}
|