root/opal/mca/pmix/pmix4x/pmix/src/mca/bfrops/base/bfrop_base_stubs.c

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

DEFINITIONS

This source file includes following definitions.
  1. PMIx_Data_type_string
  2. pmix_bfrops_base_get_available_modules
  3. pmix_bfrops_base_assign_module

   1 /*
   2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2006 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2015-2017 Intel, Inc.  All rights reserved.
  13  * $COPYRIGHT$
  14  *
  15  * Additional copyrights may follow
  16  *
  17  * $HEADER$
  18  */
  19 
  20 #include <src/include/pmix_config.h>
  21 
  22 
  23 #include <stdio.h>
  24 #ifdef HAVE_UNISTD_H
  25 #include <unistd.h>
  26 #endif
  27 
  28 #include "src/util/argv.h"
  29 #include "src/util/error.h"
  30 #include "src/include/pmix_globals.h"
  31 
  32 #include "src/mca/bfrops/base/base.h"
  33 
  34 PMIX_EXPORT const char* PMIx_Data_type_string(pmix_data_type_t type)
  35 {
  36     pmix_bfrops_base_active_module_t *active;
  37     char *reply;
  38 
  39     if (!pmix_bfrops_globals.initialized) {
  40         return "NOT INITIALIZED";
  41     }
  42 
  43     PMIX_LIST_FOREACH(active, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
  44         if (NULL != active->module->data_type_string) {
  45             if (NULL != (reply = (char*)active->module->data_type_string(type))) {
  46                 return reply;
  47             }
  48         }
  49     }
  50     return "UNKNOWN";
  51 }
  52 
  53 char* pmix_bfrops_base_get_available_modules(void)
  54 {
  55     pmix_bfrops_base_active_module_t *active;
  56     char **tmp=NULL, *reply=NULL;
  57 
  58     if (!pmix_bfrops_globals.initialized) {
  59         return NULL;
  60     }
  61 
  62     PMIX_LIST_FOREACH(active, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
  63         pmix_argv_append_nosize(&tmp, active->component->base.pmix_mca_component_name);
  64     }
  65     if (NULL != tmp) {
  66         reply = pmix_argv_join(tmp, ',');
  67         pmix_argv_free(tmp);
  68     }
  69     return reply;
  70 }
  71 
  72 pmix_bfrops_module_t* pmix_bfrops_base_assign_module(const char *version)
  73 {
  74     pmix_bfrops_base_active_module_t *active;
  75     pmix_bfrops_module_t *mod;
  76     char **tmp=NULL;
  77     int i;
  78 
  79     if (!pmix_bfrops_globals.initialized) {
  80         return NULL;
  81     }
  82 
  83     if (NULL != version) {
  84         tmp = pmix_argv_split(version, ',');
  85     }
  86 
  87     PMIX_LIST_FOREACH(active, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
  88         if (NULL == tmp) {
  89             if (NULL != (mod = active->component->assign_module())) {
  90                 return mod;
  91             }
  92         } else {
  93             for (i=0; NULL != tmp[i]; i++) {
  94                 if (0 == strcmp(tmp[i], active->component->base.pmix_mca_component_name)) {
  95                     if (NULL != (mod = active->component->assign_module())) {
  96                         pmix_argv_free(tmp);
  97                         return mod;
  98                     }
  99                 }
 100             }
 101         }
 102     }
 103 
 104     /* we only get here if nothing was found */
 105     if (NULL != tmp) {
 106         pmix_argv_free(tmp);
 107     }
 108     return NULL;
 109 }

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