1
1
openmpi/opal/mca/base/mca_base_components_close.c
Nathan Hjelm 020b9991a4 Introduce the MCA framework system. This formalizes the interface frameworks must provide.
Other changes:
 - Added a flag to the MCA variable system to indicate a variable should go away
   when its group does. Both mca_base_framework_var_register() and
   mca_base_component_var_register() set this flag.

Notes:
 - mca_base_components_open is deprecated. It will be removed in a future commit.
 - All frameworks should use MCA_BASE_FRAMEWORK_DECLARE to declare their
   framework structure.
 - All calls to framework open/close functions should be changed to use the
   mca_base_framework_* functions.
 - Instead of special-casing installdirs a flag was added to prevent calling
   into the variable system when opening a framework.
 - Ralph: Clarify the functional definition of the "register" function in the
   MCA framework object - it had the same name as another function that does a
   totally different thing.
 - As per discussion with Ralph the behavior of mca_base_framework_register()
   is to always call mca_base_framework_components_register() if the framework's
   register function was successful. This removed the need for frameworks to
   have to call this function directly.

This commit was SVN r28237.
2013-03-27 21:10:18 +00:00

90 строки
3.2 KiB
C

/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2006 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/class/opal_list.h"
#include "opal/util/output.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_component_repository.h"
#include "opal/constants.h"
void mca_base_component_close (const mca_base_component_t *component, int output_id)
{
int ret;
/* Close */
if (NULL != component->mca_close_component) {
component->mca_close_component();
opal_output_verbose(10, output_id,
"mca: base: close: component %s closed",
component->mca_component_name);
}
/* Unload */
opal_output_verbose(10, output_id,
"mca: base: close: unloading component %s",
component->mca_component_name);
/* XXX -- TODO -- Replace reserved by mca_project_name for 1.9 */
ret = mca_base_var_group_find (component->reserved, component->mca_type_name,
component->mca_component_name);
if (0 <= ret) {
mca_base_var_group_deregister (ret);
}
mca_base_component_repository_release((mca_base_component_t *) component);
}
int mca_base_framework_components_close (mca_base_framework_t *framework,
const mca_base_component_t *skip)
{
return mca_base_components_close (framework->framework_output,
&framework->framework_components,
skip);
}
int mca_base_components_close(int output_id, opal_list_t *components,
const mca_base_component_t *skip)
{
mca_base_component_list_item_t *cli, *next;
/* Close and unload all components in the available list, except the
"skip" item. This is handy to close out all non-selected
components. It's easier to simply remove the entire list and
then simply re-add the skip entry when done. */
OPAL_LIST_FOREACH_SAFE(cli, next, components, mca_base_component_list_item_t) {
if (skip == cli->cli_component) {
continue;
}
mca_base_component_close (cli->cli_component, output_id);
opal_list_remove_item (components, &cli->super);
OBJ_RELEASE(cli);
}
/* All done */
return OPAL_SUCCESS;
}