root/opal/mca/dl/dlopen/dl_dlopen_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. dlopen_component_register
  2. dlopen_component_open
  3. dlopen_component_close
  4. dlopen_component_query

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2015 Cisco Systems, Inc.  All rights reserved.
   4  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
   5  *                         reserved.
   6  * $COPYRIGHT$
   7  *
   8  * Additional copyrights may follow
   9  *
  10  * $HEADER$
  11  */
  12 
  13 #include "opal_config.h"
  14 
  15 #include "opal/constants.h"
  16 #include "opal/mca/dl/dl.h"
  17 #include "opal/util/argv.h"
  18 
  19 #include "dl_dlopen.h"
  20 
  21 
  22 /*
  23  * Public string showing the sysinfo ompi_linux component version number
  24  */
  25 const char *opal_dl_dlopen_component_version_string =
  26     "OPAL dl dlopen MCA component version " OPAL_VERSION;
  27 
  28 
  29 /*
  30  * Local functions
  31  */
  32 static int dlopen_component_register(void);
  33 static int dlopen_component_open(void);
  34 static int dlopen_component_close(void);
  35 static int dlopen_component_query(mca_base_module_t **module, int *priority);
  36 
  37 /*
  38  * Instantiate the public struct with all of our public information
  39  * and pointers to our public functions in it
  40  */
  41 
  42 opal_dl_dlopen_component_t mca_dl_dlopen_component = {
  43 
  44     /* Fill in the mca_dl_base_component_t */
  45     .base = {
  46 
  47         /* First, the mca_component_t struct containing meta information
  48            about the component itself */
  49         .base_version = {
  50             OPAL_DL_BASE_VERSION_1_0_0,
  51 
  52             /* Component name and version */
  53             .mca_component_name = "dlopen",
  54             MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
  55                                   OPAL_RELEASE_VERSION),
  56 
  57             /* Component functions */
  58             .mca_register_component_params = dlopen_component_register,
  59             .mca_open_component = dlopen_component_open,
  60             .mca_close_component = dlopen_component_close,
  61             .mca_query_component = dlopen_component_query,
  62         },
  63 
  64         .base_data = {
  65             /* The component is checkpoint ready */
  66             MCA_BASE_METADATA_PARAM_CHECKPOINT
  67         },
  68 
  69         /* The dl framework members */
  70         .priority = 80
  71     },
  72 };
  73 
  74 
  75 static int dlopen_component_register(void)
  76 {
  77     int ret;
  78 
  79     mca_dl_dlopen_component.filename_suffixes_mca_storage = ".so,.dylib,.dll,.sl";
  80     ret =
  81         mca_base_component_var_register(&mca_dl_dlopen_component.base.base_version,
  82                                         "filename_suffixes",
  83                                         "Comma-delimited list of filename suffixes that the dlopen component will try",
  84                                         MCA_BASE_VAR_TYPE_STRING,
  85                                         NULL,
  86                                         0,
  87                                         MCA_BASE_VAR_FLAG_SETTABLE,
  88                                         OPAL_INFO_LVL_5,
  89                                         MCA_BASE_VAR_SCOPE_LOCAL,
  90                                         &mca_dl_dlopen_component.filename_suffixes_mca_storage);
  91     if (ret < 0) {
  92         return ret;
  93     }
  94     mca_dl_dlopen_component.filename_suffixes =
  95         opal_argv_split(mca_dl_dlopen_component.filename_suffixes_mca_storage,
  96                         ',');
  97 
  98     return OPAL_SUCCESS;
  99 }
 100 
 101 static int dlopen_component_open(void)
 102 {
 103     return OPAL_SUCCESS;
 104 }
 105 
 106 
 107 static int dlopen_component_close(void)
 108 {
 109     if (NULL != mca_dl_dlopen_component.filename_suffixes) {
 110         opal_argv_free(mca_dl_dlopen_component.filename_suffixes);
 111         mca_dl_dlopen_component.filename_suffixes = NULL;
 112     }
 113 
 114     return OPAL_SUCCESS;
 115 }
 116 
 117 
 118 static int dlopen_component_query(mca_base_module_t **module, int *priority)
 119 {
 120     /* The priority value is somewhat meaningless here; by
 121        opal/mca/dl/configure.m4, there's at most one component
 122        available. */
 123     *priority = mca_dl_dlopen_component.base.priority;
 124     *module = &opal_dl_dlopen_module.super;
 125 
 126     return OPAL_SUCCESS;
 127 }

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