1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2004-2009 The Trustees of Indiana University.
4  *                         All rights reserved.
5  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
6  *                         reserved.
7  * $COPYRIGHT$
8  *
9  * Additional copyrights may follow
10  *
11  * $HEADER$
12  */
13 
14 #include "opal_config.h"
15 
16 #include "opal/constants.h"
17 #include "opal/mca/crs/crs.h"
18 #include "opal/mca/crs/base/base.h"
19 #include "crs_none.h"
20 
21 /*
22  * Public string for version number
23  */
24 const char *opal_crs_none_component_version_string =
25 "OPAL CRS none MCA component version " OPAL_VERSION;
26 
27 /*
28  * Local functionality
29  */
30 static int crs_none_register (void);
31 static int crs_none_open(void);
32 static int crs_none_close(void);
33 
34 /*
35  * Instantiate the public struct with all of our public information
36  * and pointer to our public functions in it
37  */
38 opal_crs_none_component_t mca_crs_none_component = {
39     /* First do the base component stuff */
40     {
41         /* Handle the general mca_component_t struct containing
42          *  meta information about the component itnone
43          */
44         .base_version = {
45             OPAL_CRS_BASE_VERSION_2_0_0,
46 
47             /* Component name and version */
48             .mca_component_name = "none",
49             MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
50                                   OPAL_RELEASE_VERSION),
51 
52             /* Component open and close functions */
53             .mca_open_component = crs_none_open,
54             .mca_close_component = crs_none_close,
55             .mca_query_component = opal_crs_none_component_query,
56             .mca_register_component_params = crs_none_register,
57         },
58         .base_data = {
59             /* The component is checkpoint ready */
60             MCA_BASE_METADATA_PARAM_CHECKPOINT
61         },
62 
63         .verbose = 0,
64         .output_handle = -1,
65         .priority = 1,
66     }
67 };
68 
69 /*
70  * None module
71  */
72 static opal_crs_base_module_t loc_module = {
73     /** Initialization Function */
74     opal_crs_none_module_init,
75     /** Finalization Function */
76     opal_crs_none_module_finalize,
77 
78     /** Checkpoint interface */
79     opal_crs_none_checkpoint,
80 
81     /** Restart Command Access */
82     opal_crs_none_restart,
83 
84     /** Disable checkpoints */
85     opal_crs_none_disable_checkpoint,
86     /** Enable checkpoints */
87     opal_crs_none_enable_checkpoint,
88 
89     /** Prelaunch */
90     opal_crs_none_prelaunch,
91 
92     /** Register Thread */
93     opal_crs_none_reg_thread
94 };
95 
96 bool opal_crs_none_select_warning = false;
97 
crs_none_register(void)98 static int crs_none_register (void)
99 {
100     int ret;
101 
102     (void) mca_base_component_var_register (&mca_crs_none_component.super.base_version,
103                                             "priority", "Priority of the crs none "
104                                             "component", MCA_BASE_VAR_TYPE_INT, NULL,
105                                             0, MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
106                                             OPAL_INFO_LVL_3,
107                                             MCA_BASE_VAR_SCOPE_CONSTANT,
108                                             &mca_crs_none_component.super.priority);
109 
110     opal_crs_none_select_warning = false;
111     ret = mca_base_component_var_register (&mca_crs_none_component.super.base_version,
112                                            "select_warning",
113                                            "Enable warning when the 'none' component is selected when checkpoint/restart functionality is requested."
114                                            "[Default = disabled/no-warning]",
115                                            MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
116                                            OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL,
117                                            &opal_crs_none_select_warning);
118     return (0 > ret) ? ret : OPAL_SUCCESS;
119 }
120 
crs_none_open(void)121 static int crs_none_open(void)
122 {
123     return OPAL_SUCCESS;
124 }
125 
crs_none_close(void)126 static int crs_none_close(void)
127 {
128     return OPAL_SUCCESS;
129 }
130 
opal_crs_none_component_query(mca_base_module_t ** module,int * priority)131 int opal_crs_none_component_query(mca_base_module_t **module, int *priority)
132 {
133     *module   = (mca_base_module_t *)&loc_module;
134     *priority = mca_crs_none_component.super.priority;
135 
136     return OPAL_SUCCESS;
137 }
138 
139