|
3 | 3 | * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana |
4 | 4 | * University Research and Technology |
5 | 5 | * Corporation. All rights reserved. |
6 | | - * Copyright (c) 2004-2007 The University of Tennessee and The University |
| 6 | + * Copyright (c) 2004-2021 The University of Tennessee and The University |
7 | 7 | * of Tennessee Research Foundation. All rights |
8 | 8 | * reserved. |
9 | 9 | * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, |
@@ -171,124 +171,6 @@ static int opal_info_set_nolock(opal_info_t *info, const char *key, const char * |
171 | 171 | return OPAL_SUCCESS; |
172 | 172 | } |
173 | 173 |
|
174 | | -/* |
175 | | - * An object's info can be set, but those settings can be modified by |
176 | | - * system callbacks. When those callbacks happen, we save a "__IN_<key>"/"val" |
177 | | - * copy of changed or erased values. |
178 | | - * |
179 | | - * extra options for how to dup: |
180 | | - * include_system_extras (default 1) |
181 | | - * omit_ignored (default 1) |
182 | | - * show_modifications (default 0) |
183 | | - */ |
184 | | -static int opal_info_dup_mode(opal_info_t *info, opal_info_t **newinfo, |
185 | | - int include_system_extras, // (k/v with no corresponding __IN_k) |
186 | | - int omit_ignored, // (__IN_k with no k/v) |
187 | | - int show_modifications) // (pick v from k/v or __IN_k/v) |
188 | | -{ |
189 | | - int err, flag; |
190 | | - opal_info_entry_t *iterator; |
191 | | - |
192 | | - const char *pkey; |
193 | | - int is_IN_key; |
194 | | - int exists_IN_key, exists_reg_key; |
195 | | - |
196 | | - OPAL_THREAD_LOCK(info->i_lock); |
197 | | - OPAL_LIST_FOREACH (iterator, &info->super, opal_info_entry_t) { |
198 | | - // If we see an __IN_<key> key but no <key>, decide what to do based on mode. |
199 | | - // If we see an __IN_<key> and a <key>, skip since it'll be handled when |
200 | | - // we process <key>. |
201 | | - is_IN_key = 0; |
202 | | - exists_IN_key = 0; |
203 | | - exists_reg_key = 0; |
204 | | - pkey = iterator->ie_key->string; |
205 | | - opal_cstring_t *savedval = NULL; |
206 | | - opal_cstring_t *valstr = NULL; |
207 | | - if (0 |
208 | | - == strncmp(iterator->ie_key->string, OPAL_INFO_SAVE_PREFIX, |
209 | | - strlen(OPAL_INFO_SAVE_PREFIX))) { |
210 | | - pkey += strlen(OPAL_INFO_SAVE_PREFIX); |
211 | | - |
212 | | - is_IN_key = 1; |
213 | | - exists_IN_key = 1; |
214 | | - opal_info_get_nolock(info, pkey, NULL, &flag); |
215 | | - if (flag) { |
216 | | - exists_reg_key = 1; |
217 | | - } |
218 | | - } else { |
219 | | - is_IN_key = 0; |
220 | | - exists_reg_key = 1; |
221 | | - |
222 | | - // see if there is an __IN_<key> for the current <key> |
223 | | - if (strlen(OPAL_INFO_SAVE_PREFIX) + strlen(pkey) < OPAL_MAX_INFO_KEY) { |
224 | | - char savedkey[OPAL_MAX_INFO_KEY + 1]; // iterator->ie_key has this as its size |
225 | | - snprintf(savedkey, OPAL_MAX_INFO_KEY + 1, OPAL_INFO_SAVE_PREFIX "%s", pkey); |
226 | | - // (the prefix macro is a string, so the unreadable part above is a string |
227 | | - // concatenation) |
228 | | - opal_info_get_nolock(info, savedkey, &savedval, &flag); |
229 | | - // release savedval, it remains valid as long we're holding the lock |
230 | | - OBJ_RELEASE(savedval); |
231 | | - exists_IN_key = 1; |
232 | | - } else { |
233 | | - flag = 0; |
234 | | - } |
235 | | - } |
236 | | - |
237 | | - if (is_IN_key) { |
238 | | - if (exists_reg_key) { |
239 | | - // we're processing __IN_<key> and there exists a <key> so we'll handle it then |
240 | | - continue; |
241 | | - } else { |
242 | | - // we're processing __IN_<key> and no <key> exists |
243 | | - // this would mean <key> was set by the user but ignored by the system |
244 | | - // so base our behavior on the omit_ignored |
245 | | - if (!omit_ignored) { |
246 | | - err = opal_info_set_cstring_nolock(*newinfo, pkey, iterator->ie_value); |
247 | | - if (OPAL_SUCCESS != err) { |
248 | | - OPAL_THREAD_UNLOCK(info->i_lock); |
249 | | - return err; |
250 | | - } |
251 | | - } |
252 | | - } |
253 | | - } else { |
254 | | - if (!exists_IN_key) { |
255 | | - // we're processing <key> and no __IN_<key> <key> exists |
256 | | - // this would mean it's a system setting, not something that came from the user |
257 | | - if (include_system_extras) { |
258 | | - valstr = iterator->ie_value; |
259 | | - } |
260 | | - } else { |
261 | | - // we're processing <key> and __IN_<key> also exists |
262 | | - // pick which value to use |
263 | | - if (!show_modifications) { |
264 | | - valstr = savedval; |
265 | | - } else { |
266 | | - valstr = iterator->ie_value; |
267 | | - } |
268 | | - } |
269 | | - if (NULL != valstr) { |
270 | | - err = opal_info_set_cstring_nolock(*newinfo, pkey, valstr); |
271 | | - /* NOTE: we have not retained valstr so don't release here after using it */ |
272 | | - if (OPAL_SUCCESS != err) { |
273 | | - OPAL_THREAD_UNLOCK(info->i_lock); |
274 | | - return err; |
275 | | - } |
276 | | - } |
277 | | - } |
278 | | - } |
279 | | - OPAL_THREAD_UNLOCK(info->i_lock); |
280 | | - return OPAL_SUCCESS; |
281 | | -} |
282 | | - |
283 | | -/* |
284 | | - * Implement opal_info_dup_mpistandard by using whatever mode |
285 | | - * settings represent our interpretation of the standard |
286 | | - */ |
287 | | -int opal_info_dup_mpistandard(opal_info_t *info, opal_info_t **newinfo) |
288 | | -{ |
289 | | - return opal_info_dup_mode(info, newinfo, 1, 1, 0); |
290 | | -} |
291 | | - |
292 | 174 | /* |
293 | 175 | * Set a value on the info |
294 | 176 | */ |
|
0 commit comments