#include "src/include/pmix_config.h"
#include "pmix_common.h"
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#include "src/class/pmix_list.h"
#include "src/util/pmix_argv.h"
#include "src/mca/base/pmix_base.h"
#include "src/mca/gds/base/base.h"
#include "src/mca/gds/base/static-components.h"
pmix_gds_globals_t pmix_gds_globals = {
.actives = PMIX_LIST_STATIC_INIT,
.initialized = false,
.selected = false,
.all_mods = NULL
};
int pmix_gds_base_output = -1;
static pmix_status_t pmix_gds_close(void)
{
pmix_gds_base_active_module_t *active, *prev;
if (!pmix_gds_globals.initialized) {
return PMIX_SUCCESS;
}
pmix_gds_globals.initialized = false;
pmix_gds_globals.selected = false;
PMIX_LIST_FOREACH_SAFE (active, prev, &pmix_gds_globals.actives,
pmix_gds_base_active_module_t) {
pmix_list_remove_item(&pmix_gds_globals.actives, &active->super);
if (NULL != active->module->finalize) {
active->module->finalize();
}
PMIX_RELEASE(active);
}
PMIX_DESTRUCT(&pmix_gds_globals.actives);
if (NULL != pmix_gds_globals.all_mods) {
free(pmix_gds_globals.all_mods);
}
return pmix_mca_base_framework_components_close(&pmix_gds_base_framework, NULL);
}
static pmix_status_t pmix_gds_open(pmix_mca_base_open_flag_t flags)
{
pmix_status_t rc;
pmix_gds_globals.initialized = true;
pmix_gds_globals.all_mods = NULL;
PMIX_CONSTRUCT(&pmix_gds_globals.actives, pmix_list_t);
rc = pmix_mca_base_framework_components_open(&pmix_gds_base_framework, flags);
pmix_gds_base_output = pmix_gds_base_framework.framework_output;
return rc;
}
PMIX_MCA_BASE_FRAMEWORK_DECLARE(pmix, gds, "PMIx Generalized Data Store", NULL, pmix_gds_open,
pmix_gds_close, pmix_mca_gds_base_static_components,
PMIX_MCA_BASE_FRAMEWORK_FLAG_DEFAULT);
PMIX_CLASS_INSTANCE(pmix_gds_base_active_module_t, pmix_list_item_t, NULL, NULL);