2004-08-02 04:24:22 +04:00
|
|
|
/*
|
2006-02-28 15:33:42 +03:00
|
|
|
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-02-28 15:33:42 +03:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2006-02-28 15:33:42 +03:00
|
|
|
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
|
2004-11-28 23:09:25 +03:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2006-02-28 15:33:42 +03:00
|
|
|
* Copyright (c) 2004-2006 The Regents of the University of California.
|
2005-03-24 15:43:37 +03:00
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-08-02 04:24:22 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal_config.h"
|
2004-08-02 04:24:22 +04:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2005-07-04 03:31:27 +04:00
|
|
|
#include "opal/util/output.h"
|
2005-08-13 00:46:25 +04:00
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
2005-09-01 16:16:36 +04:00
|
|
|
#include "opal/mca/base/mca_base_component_repository.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/constants.h"
|
2004-08-02 04:24:22 +04:00
|
|
|
|
|
|
|
int mca_base_components_close(int output_id,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t *components_available,
|
2004-08-02 04:24:22 +04:00
|
|
|
const mca_base_component_t *skip)
|
|
|
|
{
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t *item;
|
2004-11-12 19:55:41 +03:00
|
|
|
mca_base_component_priority_list_item_t *pcli, *skipped_pcli = NULL;
|
2004-08-02 04:24:22 +04:00
|
|
|
const mca_base_component_t *component;
|
|
|
|
|
|
|
|
/* 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. */
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
for (item = opal_list_remove_first(components_available);
|
2004-08-02 04:24:22 +04:00
|
|
|
NULL != item;
|
2005-07-03 20:22:16 +04:00
|
|
|
item = opal_list_remove_first(components_available)) {
|
2004-11-12 19:55:41 +03:00
|
|
|
pcli = (mca_base_component_priority_list_item_t *) item;
|
|
|
|
component = pcli->super.cli_component;
|
2004-08-02 04:24:22 +04:00
|
|
|
|
|
|
|
if (component != skip) {
|
|
|
|
|
|
|
|
/* Close */
|
|
|
|
|
|
|
|
|
|
|
|
if (NULL != component->mca_close_component) {
|
|
|
|
component->mca_close_component();
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(10, output_id,
|
2004-08-20 05:12:50 +04:00
|
|
|
"mca: base: close: component %s closed",
|
2004-08-02 04:24:22 +04:00
|
|
|
component->mca_component_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Unload */
|
|
|
|
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(10, output_id,
|
2004-08-20 05:12:50 +04:00
|
|
|
"mca: base: close: unloading component %s",
|
2004-08-02 04:24:22 +04:00
|
|
|
component->mca_component_name);
|
2004-08-16 07:08:01 +04:00
|
|
|
mca_base_component_repository_release((mca_base_component_t *) component);
|
2004-11-12 19:55:41 +03:00
|
|
|
free(pcli);
|
|
|
|
} else {
|
|
|
|
skipped_pcli = pcli;
|
2004-08-02 04:24:22 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-11-12 19:55:41 +03:00
|
|
|
/* If we found it, re-add the skipped component to the available
|
|
|
|
list (see above comment) */
|
2004-08-02 04:24:22 +04:00
|
|
|
|
2004-11-12 19:55:41 +03:00
|
|
|
if (NULL != skipped_pcli) {
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(components_available, (opal_list_item_t *) skipped_pcli);
|
2004-08-02 04:24:22 +04:00
|
|
|
}
|
|
|
|
|
2006-02-28 15:33:42 +03:00
|
|
|
/*
|
2006-08-16 20:23:35 +04:00
|
|
|
* If we are not the verbose output stream, and we shouldn't skip
|
|
|
|
* any components, close the output stream. If there's a skip
|
|
|
|
* component, this is a 'choose one' framework and we're closing the
|
|
|
|
* unchoosen components, but will still be using the framework.
|
2006-02-28 15:33:42 +03:00
|
|
|
*/
|
2006-08-16 20:23:35 +04:00
|
|
|
if (0 != output_id && NULL == skip) {
|
2006-02-28 15:33:42 +03:00
|
|
|
opal_output_close (output_id);
|
|
|
|
}
|
2004-08-02 04:24:22 +04:00
|
|
|
/* All done */
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_SUCCESS;
|
2004-08-02 04:24:22 +04:00
|
|
|
}
|