1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2004-2007 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-2005 High Performance Computing Center Stuttgart,
10 * University of Stuttgart. All rights reserved.
11 * Copyright (c) 2004-2005 The Regents of the University of California.
12 * All rights reserved.
13 * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
14 * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
15 * reserved.
16 * Copyright (c) 2017 Research Organization for Information Science
17 * and Technology (RIST). All rights reserved.
18 * Copyright (c) 2017 IBM Corporation. All rights reserved.
19 * $COPYRIGHT$
20 *
21 * Additional copyrights may follow
22 *
23 * $HEADER$
24 */
25
26 /**
27 * @file
28 *
29 * This is the private declarations for the MCA variable system.
30 * This file is internal to the MCA variable system and should not
31 * need to be used by any other elements in Open MPI except the
32 * special case of the ompi_info command.
33 *
34 * All the rest of the doxygen documentation in this file is marked as
35 * "internal" and won't show up unless you specifically tell doxygen
36 * to generate internal documentation (by default, it is skipped).
37 */
38
39 #ifndef OPAL_MCA_BASE_VAR_INTERNAL_H
40 #define OPAL_MCA_BASE_VAR_INTERNAL_H
41
42 #include "opal_config.h"
43
44 #include "opal/class/opal_object.h"
45 #include "opal/class/opal_list.h"
46 #include "opal/class/opal_value_array.h"
47 #include "opal/class/opal_pointer_array.h"
48 #include "opal/class/opal_hash_table.h"
49 #include "opal/mca/base/mca_base_var.h"
50 #include "opal/mca/base/mca_base_pvar.h"
51
52 BEGIN_C_DECLS
53
54 /* Internal flags start at bit 16 */
55 #define MCA_BASE_VAR_FLAG_EXTERNAL_MASK 0x0000ffff
56
57 typedef enum {
58 /** Variable is valid */
59 MCA_BASE_VAR_FLAG_VALID = 0x00010000,
60 /** Variable is a synonym */
61 MCA_BASE_VAR_FLAG_SYNONYM = 0x00020000,
62 /** mbv_source_file needs to be freed */
63 MCA_BASE_VAR_FLAG_SOURCE_FILE_NEEDS_FREE = 0x00040000
64 } mca_base_var_flag_internal_t;
65
66 #define VAR_FLAG_ISSET(var, flag) (!!((var).mbp_flags & (flag)))
67
68 #define VAR_IS_VALID(var) (!!((var).mbv_flags & MCA_BASE_VAR_FLAG_VALID))
69 #define VAR_IS_SYNONYM(var) (!!((var).mbv_flags & MCA_BASE_VAR_FLAG_SYNONYM))
70 #define VAR_IS_INTERNAL(var) (!!((var).mbv_flags & MCA_BASE_VAR_FLAG_INTERNAL))
71 #define VAR_IS_DEFAULT_ONLY(var) (!!((var).mbv_flags & MCA_BASE_VAR_FLAG_DEFAULT_ONLY))
72 #define VAR_IS_SETTABLE(var) (!!((var).mbv_flags & MCA_BASE_VAR_FLAG_SETTABLE))
73 #define VAR_IS_DEPRECATED(var) (!!((var).mbv_flags & MCA_BASE_VAR_FLAG_DEPRECATED))
74
75 extern const char *ompi_var_type_names[];
76 extern const size_t ompi_var_type_sizes[];
77 extern bool mca_base_var_initialized;
78
79 /**
80 * \internal
81 *
82 * Structure for holding param names and values read in from files.
83 */
84 struct mca_base_var_file_value_t {
85 /** Allow this to be an OPAL OBJ */
86 opal_list_item_t super;
87
88 /** Parameter name */
89 char *mbvfv_var;
90 /** Parameter value */
91 char *mbvfv_value;
92 /** File it came from */
93 char *mbvfv_file;
94 /** Line it came from */
95 int mbvfv_lineno;
96 };
97
98 /**
99 * \internal
100 *
101 * Convenience typedef
102 */
103 typedef struct mca_base_var_file_value_t mca_base_var_file_value_t;
104
105 /**
106 * Object declaration for mca_base_var_file_value_t
107 */
108 OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_var_file_value_t);
109
110 /**
111 * \internal
112 *
113 * Get a group
114 *
115 * @param[in] group_index Group index
116 * @param[out] group Returned group if it exists
117 * @param[in] invalidok Return group even if it has been deregistered
118 */
119 OPAL_DECLSPEC int mca_base_var_group_get_internal (const int group_index, mca_base_var_group_t **group, bool invalidok);
120
121 /**
122 * \internal
123 *
124 * Parse a parameter file.
125 */
126 OPAL_DECLSPEC int mca_base_parse_paramfile(const char *paramfile, opal_list_t *list);
127
128 /**
129 * \internal
130 *
131 * Add a variable to a group
132 */
133 OPAL_DECLSPEC int mca_base_var_group_add_var (const int group_index, const int param_index);
134
135 /**
136 * \internal
137 *
138 * Add a performance variable to a group
139 */
140 OPAL_DECLSPEC int mca_base_var_group_add_pvar (const int group_index, const int param_index);
141
142 /**
143 * \internal
144 *
145 * Add an enum to a group
146 */
147 OPAL_DECLSPEC int mca_base_var_group_add_enum (const int group_index, const void *storage);
148
149 /**
150 * \internal
151 *
152 * Generate a full name with _ between all of the non-NULL arguments
153 */
154 OPAL_DECLSPEC int mca_base_var_generate_full_name4 (const char *project, const char *framework,
155 const char *component, const char *variable,
156 char **full_name);
157
158 /**
159 * \internal
160 *
161 * Call save_value callback for generated internal mca parameter storing env variables
162 */
163 OPAL_DECLSPEC int mca_base_internal_env_store(void);
164
165 /**
166 * \internal
167 *
168 * Initialize/finalize MCA variable groups
169 */
170 OPAL_DECLSPEC int mca_base_var_group_init (void);
171 OPAL_DECLSPEC int mca_base_var_group_finalize (void);
172
173 /**
174 * \internal
175 *
176 * Initialize MCA performance variables
177 */
178 OPAL_DECLSPEC int mca_base_pvar_init (void);
179 OPAL_DECLSPEC int mca_base_pvar_finalize (void);
180
181 END_C_DECLS
182
183 #endif /* OPAL_MCA_BASE_VAR_INTERNAL_H */