Skip to content

Commit 52d44af

Browse files
authored
Merge pull request #3743 from hjelmn/abstration_fix
opal/info: fix abstraction break
2 parents e2160d1 + 9c621ad commit 52d44af

File tree

3 files changed

+71
-77
lines changed

3 files changed

+71
-77
lines changed

opal/util/info.c

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@
4343
#include "opal/util/strncpy.h"
4444

4545
#include "opal/util/info.h"
46-
#ifdef XXX
47-
#include "ompi/runtime/mpiruntime.h"
48-
#include "ompi/runtime/params.h"
49-
#endif
50-
5146

5247
/*
5348
* Local functions
@@ -88,13 +83,13 @@ int opal_info_dup (opal_info_t *info, opal_info_t **newinfo)
8883
OPAL_THREAD_LOCK(info->i_lock);
8984
OPAL_LIST_FOREACH(iterator, &info->super, opal_info_entry_t) {
9085
err = opal_info_set(*newinfo, iterator->ie_key, iterator->ie_value);
91-
if (MPI_SUCCESS != err) {
86+
if (OPAL_SUCCESS != err) {
9287
OPAL_THREAD_UNLOCK(info->i_lock);
9388
return err;
9489
}
9590
}
9691
OPAL_THREAD_UNLOCK(info->i_lock);
97-
return MPI_SUCCESS;
92+
return OPAL_SUCCESS;
9893
}
9994

10095
/*
@@ -115,8 +110,8 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo,
115110
{
116111
int err, flag;
117112
opal_info_entry_t *iterator;
118-
char savedkey[MPI_MAX_INFO_KEY];
119-
char savedval[MPI_MAX_INFO_VAL];
113+
char savedkey[OPAL_MAX_INFO_KEY];
114+
char savedval[OPAL_MAX_INFO_VAL];
120115
char *valptr, *pkey;
121116
int is_IN_key;
122117
int exists_IN_key, exists_reg_key;
@@ -144,9 +139,9 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo,
144139
exists_reg_key = 1;
145140

146141
// see if there is an __IN_<key> for the current <key>
147-
if (strlen(iterator->ie_key) + 5 < MPI_MAX_INFO_KEY) {
142+
if (strlen(iterator->ie_key) + 5 < OPAL_MAX_INFO_KEY) {
148143
sprintf(savedkey, "__IN_%s", iterator->ie_key);
149-
err = opal_info_get (info, savedkey, MPI_MAX_INFO_VAL,
144+
err = opal_info_get (info, savedkey, OPAL_MAX_INFO_VAL,
150145
savedval, &flag);
151146
} else {
152147
flag = 0;
@@ -166,7 +161,7 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo,
166161
// so base our behavior on the omit_ignored
167162
if (!omit_ignored) {
168163
err = opal_info_set(*newinfo, pkey, iterator->ie_value);
169-
if (MPI_SUCCESS != err) {
164+
if (OPAL_SUCCESS != err) {
170165
OPAL_THREAD_UNLOCK(info->i_lock);
171166
return err;
172167
}
@@ -191,15 +186,15 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo,
191186
}
192187
if (valptr) {
193188
err = opal_info_set(*newinfo, pkey, valptr);
194-
if (MPI_SUCCESS != err) {
189+
if (OPAL_SUCCESS != err) {
195190
OPAL_THREAD_UNLOCK(info->i_lock);
196191
return err;
197192
}
198193
}
199194
}
200195
}
201196
OPAL_THREAD_UNLOCK(info->i_lock);
202-
return MPI_SUCCESS;
197+
return OPAL_SUCCESS;
203198
}
204199

205200
/*
@@ -222,7 +217,7 @@ int opal_info_set (opal_info_t *info, const char *key, const char *value)
222217

223218
new_value = strdup(value);
224219
if (NULL == new_value) {
225-
return MPI_ERR_NO_MEM;
220+
return OPAL_ERR_OUT_OF_RESOURCE;
226221
}
227222

228223
OPAL_THREAD_LOCK(info->i_lock);
@@ -238,14 +233,14 @@ int opal_info_set (opal_info_t *info, const char *key, const char *value)
238233
if (NULL == new_info) {
239234
free(new_value);
240235
OPAL_THREAD_UNLOCK(info->i_lock);
241-
return MPI_ERR_NO_MEM;
236+
return OPAL_ERR_OUT_OF_RESOURCE;
242237
}
243-
strncpy (new_info->ie_key, key, MPI_MAX_INFO_KEY);
238+
strncpy (new_info->ie_key, key, OPAL_MAX_INFO_KEY);
244239
new_info->ie_value = new_value;
245240
opal_list_append (&(info->super), (opal_list_item_t *) new_info);
246241
}
247242
OPAL_THREAD_UNLOCK(info->i_lock);
248-
return MPI_SUCCESS;
243+
return OPAL_SUCCESS;
249244
}
250245

251246

@@ -293,15 +288,15 @@ int opal_info_get (opal_info_t *info, const char *key, int valuelen,
293288
strcpy(value, search->ie_value);
294289
} else {
295290
opal_strncpy(value, search->ie_value, valuelen);
296-
if (MPI_MAX_INFO_VAL == valuelen) {
291+
if (OPAL_MAX_INFO_VAL == valuelen) {
297292
value[valuelen-1] = 0;
298293
} else {
299294
value[valuelen] = 0;
300295
}
301296
}
302297
}
303298
OPAL_THREAD_UNLOCK(info->i_lock);
304-
return MPI_SUCCESS;
299+
return OPAL_SUCCESS;
305300
}
306301

307302
int opal_info_get_value_enum (opal_info_t *info, const char *key, int *value,
@@ -318,7 +313,7 @@ int opal_info_get_value_enum (opal_info_t *info, const char *key, int *value,
318313
if (NULL == search){
319314
OPAL_THREAD_UNLOCK(info->i_lock);
320315
*flag = 0;
321-
return MPI_SUCCESS;
316+
return OPAL_SUCCESS;
322317
}
323318

324319
/* we found a mathing key. pass the string value to the enumerator and
@@ -346,7 +341,7 @@ int opal_info_get_bool(opal_info_t *info, char *key, bool *value, int *flag)
346341
*value = opal_str_to_bool(str);
347342
}
348343

349-
return MPI_SUCCESS;
344+
return OPAL_SUCCESS;
350345
}
351346

352347

@@ -392,7 +387,7 @@ int opal_info_delete(opal_info_t *info, const char *key)
392387
search = info_find_key (info, key);
393388
if (NULL == search){
394389
OPAL_THREAD_UNLOCK(info->i_lock);
395-
return MPI_ERR_INFO_NOKEY;
390+
return OPAL_ERR_NOT_FOUND;
396391
} else {
397392
/*
398393
* An entry with this key value was found. Remove the item
@@ -404,7 +399,7 @@ int opal_info_delete(opal_info_t *info, const char *key)
404399
OBJ_RELEASE(search);
405400
}
406401
OPAL_THREAD_UNLOCK(info->i_lock);
407-
return MPI_SUCCESS;
402+
return OPAL_SUCCESS;
408403
}
409404

410405

@@ -429,7 +424,7 @@ int opal_info_get_valuelen (opal_info_t *info, const char *key, int *valuelen,
429424
*valuelen = strlen(search->ie_value);
430425
}
431426
OPAL_THREAD_UNLOCK(info->i_lock);
432-
return MPI_SUCCESS;
427+
return OPAL_SUCCESS;
433428
}
434429

435430

@@ -451,17 +446,17 @@ int opal_info_get_nthkey (opal_info_t *info, int n, char *key)
451446
if (opal_list_get_end(&(info->super)) ==
452447
(opal_list_item_t *) iterator) {
453448
OPAL_THREAD_UNLOCK(info->i_lock);
454-
return MPI_ERR_ARG;
449+
return OPAL_ERR_BAD_PARAM;
455450
}
456451
}
457452
/*
458453
* iterator is of the type opal_list_item_t. We have to
459454
* cast it to opal_info_entry_t before we can use it to
460455
* access the value
461456
*/
462-
strncpy(key, iterator->ie_key, MPI_MAX_INFO_KEY);
457+
strncpy(key, iterator->ie_key, OPAL_MAX_INFO_KEY);
463458
OPAL_THREAD_UNLOCK(info->i_lock);
464-
return MPI_SUCCESS;
459+
return OPAL_SUCCESS;
465460
}
466461

467462

@@ -506,7 +501,7 @@ static void info_destructor(opal_info_t *info)
506501
static void info_entry_constructor(opal_info_entry_t *entry)
507502
{
508503
memset(entry->ie_key, 0, sizeof(entry->ie_key));
509-
entry->ie_key[MPI_MAX_INFO_KEY] = 0;
504+
entry->ie_key[OPAL_MAX_INFO_KEY] = 0;
510505
}
511506

512507

0 commit comments

Comments
 (0)