root/opal/mca/pmix/pmix4x/pmix/src/mca/psec/base/psec_base_fns.c

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

DEFINITIONS

This source file includes following definitions.
  1. pmix_psec_base_get_available_modules
  2. pmix_psec_base_assign_module

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
   4  * Copyright (c) 2016      Mellanox Technologies, Inc.
   5  *                         All rights reserved.
   6  *
   7  * $COPYRIGHT$
   8  *
   9  * Additional copyrights may follow
  10  *
  11  * $HEADER$
  12  */
  13 
  14 #include <src/include/pmix_config.h>
  15 
  16 #include <pmix_common.h>
  17 #include "src/include/pmix_globals.h"
  18 
  19 #include "src/class/pmix_list.h"
  20 #include "src/util/argv.h"
  21 #include "src/util/error.h"
  22 #include "src/util/output.h"
  23 #include "src/mca/ptl/base/base.h"
  24 
  25 #include "src/mca/psec/base/base.h"
  26 
  27 
  28 char* pmix_psec_base_get_available_modules(void)
  29 {
  30     pmix_psec_base_active_module_t *active;
  31     char **tmp=NULL, *reply=NULL;
  32 
  33     if (!pmix_psec_globals.initialized) {
  34         return NULL;
  35     }
  36 
  37     PMIX_LIST_FOREACH(active, &pmix_psec_globals.actives, pmix_psec_base_active_module_t) {
  38         pmix_argv_append_nosize(&tmp, active->component->base.pmix_mca_component_name);
  39     }
  40     if (NULL != tmp) {
  41         reply = pmix_argv_join(tmp, ',');
  42         pmix_argv_free(tmp);
  43     }
  44     return reply;
  45 }
  46 
  47 pmix_psec_module_t* pmix_psec_base_assign_module(const char *options)
  48 {
  49     pmix_psec_base_active_module_t *active;
  50     pmix_psec_module_t *mod;
  51     char **tmp=NULL;
  52     int i;
  53 
  54     if (!pmix_psec_globals.initialized) {
  55         return NULL;
  56     }
  57 
  58     if (NULL != options) {
  59         tmp = pmix_argv_split(options, ',');
  60     }
  61 
  62     PMIX_LIST_FOREACH(active, &pmix_psec_globals.actives, pmix_psec_base_active_module_t) {
  63         if (NULL == tmp) {
  64             if (NULL != (mod = active->component->assign_module())) {
  65                 return mod;
  66             }
  67         } else {
  68             for (i=0; NULL != tmp[i]; i++) {
  69                 if (0 == strcmp(tmp[i], active->component->base.pmix_mca_component_name)) {
  70                     if (NULL != (mod = active->component->assign_module())) {
  71                         pmix_argv_free(tmp);
  72                         return mod;
  73                     }
  74                 }
  75             }
  76         }
  77     }
  78 
  79     /* we only get here if nothing was found */
  80     if (NULL != tmp) {
  81         pmix_argv_free(tmp);
  82     }
  83     return NULL;
  84 }

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