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) 2016 Intel, Inc. All rights reserved
17 * $COPYRIGHT$
18 *
19 * Additional copyrights may follow
20 *
21 * $HEADER$
22 */
23
24 /**
25 * @file
26 *
27 * This is the private declarations for the MCA variable system.
28 * This file is internal to the MCA variable system and should not
29 * need to be used by any other elements in PMIX except the
30 * special case of the ompi_info command.
31 *
32 * All the rest of the doxygen documentation in this file is marked as
33 * "internal" and won't show up unless you specifically tell doxygen
34 * to generate internal documentation (by default, it is skipped).
35 */
36
37 #ifndef PMIX_MCA_BASE_VAR_INTERNAL_H
38 #define PMIX_MCA_BASE_VAR_INTERNAL_H
39
40 #include <src/include/pmix_config.h>
41
42 #include "src/class/pmix_object.h"
43 #include "src/class/pmix_list.h"
44 #include "src/class/pmix_value_array.h"
45 #include "src/class/pmix_pointer_array.h"
46 #include "src/class/pmix_hash_table.h"
47 #include "src/mca/base/pmix_mca_base_var.h"
48
49 BEGIN_C_DECLS
50
51 /* Internal flags start at bit 16 */
52 #define PMIX_MCA_BASE_VAR_FLAG_EXTERNAL_MASK 0x0000ffff
53
54 typedef enum {
55 /** Variable is valid */
56 PMIX_MCA_BASE_VAR_FLAG_VALID = 0x00010000,
57 /** Variable is a synonym */
58 PMIX_MCA_BASE_VAR_FLAG_SYNONYM = 0x00020000,
59 /** mbv_source_file needs to be freed */
60 PMIX_MCA_BASE_VAR_FLAG_SOURCE_FILE_NEEDS_FREE = 0x00040000
61 } pmix_mca_base_var_flag_internal_t;
62
63 #define PMIX_VAR_FLAG_ISSET(var, flag) (!!((var).mbp_flags & (flag)))
64
65 #define PMIX_VAR_IS_VALID(var) (!!((var).mbv_flags & PMIX_MCA_BASE_VAR_FLAG_VALID))
66 #define PMIX_VAR_IS_SYNONYM(var) (!!((var).mbv_flags & PMIX_MCA_BASE_VAR_FLAG_SYNONYM))
67 #define PMIX_VAR_IS_INTERNAL(var) (!!((var).mbv_flags & PMIX_MCA_BASE_VAR_FLAG_INTERNAL))
68 #define PMIX_VAR_IS_DEFAULT_ONLY(var) (!!((var).mbv_flags & PMIX_MCA_BASE_VAR_FLAG_DEFAULT_ONLY))
69 #define PMIX_VAR_IS_SETTABLE(var) (!!((var).mbv_flags & PMIX_MCA_BASE_VAR_FLAG_SETTABLE))
70 #define PMIX_VAR_IS_DEPRECATED(var) (!!((var).mbv_flags & PMIX_MCA_BASE_VAR_FLAG_DEPRECATED))
71
72 extern const char *pmix_var_type_names[];
73 extern const size_t pmix_var_type_sizes[];
74 extern bool pmix_mca_base_var_initialized;
75
76 /**
77 * \internal
78 *
79 * Structure for holding param names and values read in from files.
80 */
81 struct pmix_mca_base_var_file_value_t {
82 /** Allow this to be an PMIX OBJ */
83 pmix_list_item_t super;
84
85 /** Parameter name */
86 char *mbvfv_var;
87 /** Parameter value */
88 char *mbvfv_value;
89 /** File it came from */
90 char *mbvfv_file;
91 /** Line it came from */
92 int mbvfv_lineno;
93 };
94
95 /**
96 * \internal
97 *
98 * Convenience typedef
99 */
100 typedef struct pmix_mca_base_var_file_value_t pmix_mca_base_var_file_value_t;
101
102 /**
103 * Object declaration for pmix_mca_base_var_file_value_t
104 */
105 PMIX_CLASS_DECLARATION(pmix_mca_base_var_file_value_t);
106
107 /**
108 * \internal
109 *
110 * Get a group
111 *
112 * @param[in] group_index Group index
113 * @param[out] group Returned group if it exists
114 * @param[in] invalidok Return group even if it has been deregistered
115 */
116 int pmix_mca_base_var_group_get_internal (const int group_index, pmix_mca_base_var_group_t **group, bool invalidok);
117
118 /**
119 * \internal
120 *
121 * Parse a parameter file.
122 */
123 int pmix_mca_base_parse_paramfile(const char *paramfile, pmix_list_t *list);
124
125 /**
126 * \internal
127 *
128 * Add a variable to a group
129 */
130 int pmix_mca_base_var_group_add_var (const int group_index, const int param_index);
131
132 /**
133 * \internal
134 *
135 * Add a performance variable to a group
136 */
137 int pmix_mca_base_var_group_add_pvar (const int group_index, const int param_index);
138
139 /**
140 * \internal
141 *
142 * Generate a full name with _ between all of the non-NULL arguments
143 */
144 int pmix_mca_base_var_generate_full_name4 (const char *project, const char *framework,
145 const char *component, const char *variable,
146 char **full_name);
147
148 /**
149 * \internal
150 *
151 * Call save_value callback for generated internal mca parameter storing env variables
152 */
153 int pmix_mca_base_internal_env_store(void);
154
155 /**
156 * \internal
157 *
158 * Initialize/finalize MCA variable groups
159 */
160 int pmix_mca_base_var_group_init (void);
161 int pmix_mca_base_var_group_finalize (void);
162
163 END_C_DECLS
164
165 #endif /* PMIX_MCA_BASE_VAR_INTERNAL_H */