root/opal/mca/base/mca_base_components_close.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. mca_base_component_unload
  2. mca_base_component_close
  3. mca_base_framework_components_close
  4. mca_base_components_close

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2006 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2006 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
  14  *                         reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 
  22 #include "opal_config.h"
  23 
  24 #include "opal/class/opal_list.h"
  25 #include "opal/util/output.h"
  26 #include "opal/mca/mca.h"
  27 #include "opal/mca/base/base.h"
  28 #include "opal/mca/base/mca_base_component_repository.h"
  29 #include "opal/constants.h"
  30 
  31 void mca_base_component_unload (const mca_base_component_t *component, int output_id)
  32 {
  33     int ret;
  34 
  35     /* Unload */
  36     opal_output_verbose (MCA_BASE_VERBOSE_COMPONENT, output_id,
  37                          "mca: base: close: unloading component %s",
  38                          component->mca_component_name);
  39 
  40     ret = mca_base_var_group_find (component->mca_project_name, component->mca_type_name,
  41                                    component->mca_component_name);
  42     if (0 <= ret) {
  43         mca_base_var_group_deregister (ret);
  44     }
  45 
  46     mca_base_component_repository_release (component);
  47 }
  48 
  49 void mca_base_component_close (const mca_base_component_t *component, int output_id)
  50 {
  51     /* Close */
  52     if (NULL != component->mca_close_component) {
  53         if( OPAL_SUCCESS == component->mca_close_component() ) {
  54             opal_output_verbose (MCA_BASE_VERBOSE_COMPONENT, output_id,
  55                                  "mca: base: close: component %s closed",
  56                                  component->mca_component_name);
  57         } else {
  58             opal_output_verbose (MCA_BASE_VERBOSE_COMPONENT, output_id,
  59                                  "mca: base: close: component %s refused to close [drop it]",
  60                                  component->mca_component_name);
  61             return;
  62         }
  63     }
  64 
  65     mca_base_component_unload (component, output_id);
  66 }
  67 
  68 int mca_base_framework_components_close (mca_base_framework_t *framework,
  69                                          const mca_base_component_t *skip)
  70 {
  71     return mca_base_components_close (framework->framework_output,
  72                                       &framework->framework_components,
  73                                       skip);
  74 }
  75 
  76 int mca_base_components_close(int output_id, opal_list_t *components,
  77                               const mca_base_component_t *skip)
  78 {
  79     mca_base_component_list_item_t *cli, *next;
  80 
  81     /* Close and unload all components in the available list, except the
  82        "skip" item.  This is handy to close out all non-selected
  83        components.  It's easier to simply remove the entire list and
  84        then simply re-add the skip entry when done. */
  85 
  86     OPAL_LIST_FOREACH_SAFE(cli, next, components, mca_base_component_list_item_t) {
  87         if (skip == cli->cli_component) {
  88             continue;
  89         }
  90 
  91         mca_base_component_close (cli->cli_component, output_id);
  92         opal_list_remove_item (components, &cli->super);
  93 
  94         OBJ_RELEASE(cli);
  95     }
  96 
  97     /* All done */
  98     return OPAL_SUCCESS;
  99 }

/* [<][>][^][v][top][bottom][index][help] */