Merge pull request #3743 from hjelmn/abstration_fix
opal/info: fix abstraction break
Этот коммит содержится в:
Коммит
52d44afb74
@ -43,11 +43,6 @@
|
|||||||
#include "opal/util/strncpy.h"
|
#include "opal/util/strncpy.h"
|
||||||
|
|
||||||
#include "opal/util/info.h"
|
#include "opal/util/info.h"
|
||||||
#ifdef XXX
|
|
||||||
#include "ompi/runtime/mpiruntime.h"
|
|
||||||
#include "ompi/runtime/params.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local functions
|
* Local functions
|
||||||
@ -88,13 +83,13 @@ int opal_info_dup (opal_info_t *info, opal_info_t **newinfo)
|
|||||||
OPAL_THREAD_LOCK(info->i_lock);
|
OPAL_THREAD_LOCK(info->i_lock);
|
||||||
OPAL_LIST_FOREACH(iterator, &info->super, opal_info_entry_t) {
|
OPAL_LIST_FOREACH(iterator, &info->super, opal_info_entry_t) {
|
||||||
err = opal_info_set(*newinfo, iterator->ie_key, iterator->ie_value);
|
err = opal_info_set(*newinfo, iterator->ie_key, iterator->ie_value);
|
||||||
if (MPI_SUCCESS != err) {
|
if (OPAL_SUCCESS != err) {
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return MPI_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -115,8 +110,8 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo,
|
|||||||
{
|
{
|
||||||
int err, flag;
|
int err, flag;
|
||||||
opal_info_entry_t *iterator;
|
opal_info_entry_t *iterator;
|
||||||
char savedkey[MPI_MAX_INFO_KEY];
|
char savedkey[OPAL_MAX_INFO_KEY];
|
||||||
char savedval[MPI_MAX_INFO_VAL];
|
char savedval[OPAL_MAX_INFO_VAL];
|
||||||
char *valptr, *pkey;
|
char *valptr, *pkey;
|
||||||
int is_IN_key;
|
int is_IN_key;
|
||||||
int exists_IN_key, exists_reg_key;
|
int exists_IN_key, exists_reg_key;
|
||||||
@ -144,9 +139,9 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo,
|
|||||||
exists_reg_key = 1;
|
exists_reg_key = 1;
|
||||||
|
|
||||||
// see if there is an __IN_<key> for the current <key>
|
// see if there is an __IN_<key> for the current <key>
|
||||||
if (strlen(iterator->ie_key) + 5 < MPI_MAX_INFO_KEY) {
|
if (strlen(iterator->ie_key) + 5 < OPAL_MAX_INFO_KEY) {
|
||||||
sprintf(savedkey, "__IN_%s", iterator->ie_key);
|
sprintf(savedkey, "__IN_%s", iterator->ie_key);
|
||||||
err = opal_info_get (info, savedkey, MPI_MAX_INFO_VAL,
|
err = opal_info_get (info, savedkey, OPAL_MAX_INFO_VAL,
|
||||||
savedval, &flag);
|
savedval, &flag);
|
||||||
} else {
|
} else {
|
||||||
flag = 0;
|
flag = 0;
|
||||||
@ -166,7 +161,7 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo,
|
|||||||
// so base our behavior on the omit_ignored
|
// so base our behavior on the omit_ignored
|
||||||
if (!omit_ignored) {
|
if (!omit_ignored) {
|
||||||
err = opal_info_set(*newinfo, pkey, iterator->ie_value);
|
err = opal_info_set(*newinfo, pkey, iterator->ie_value);
|
||||||
if (MPI_SUCCESS != err) {
|
if (OPAL_SUCCESS != err) {
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -191,7 +186,7 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo,
|
|||||||
}
|
}
|
||||||
if (valptr) {
|
if (valptr) {
|
||||||
err = opal_info_set(*newinfo, pkey, valptr);
|
err = opal_info_set(*newinfo, pkey, valptr);
|
||||||
if (MPI_SUCCESS != err) {
|
if (OPAL_SUCCESS != err) {
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -199,7 +194,7 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return MPI_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -222,7 +217,7 @@ int opal_info_set (opal_info_t *info, const char *key, const char *value)
|
|||||||
|
|
||||||
new_value = strdup(value);
|
new_value = strdup(value);
|
||||||
if (NULL == new_value) {
|
if (NULL == new_value) {
|
||||||
return MPI_ERR_NO_MEM;
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
OPAL_THREAD_LOCK(info->i_lock);
|
OPAL_THREAD_LOCK(info->i_lock);
|
||||||
@ -238,14 +233,14 @@ int opal_info_set (opal_info_t *info, const char *key, const char *value)
|
|||||||
if (NULL == new_info) {
|
if (NULL == new_info) {
|
||||||
free(new_value);
|
free(new_value);
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return MPI_ERR_NO_MEM;
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||||
}
|
}
|
||||||
strncpy (new_info->ie_key, key, MPI_MAX_INFO_KEY);
|
strncpy (new_info->ie_key, key, OPAL_MAX_INFO_KEY);
|
||||||
new_info->ie_value = new_value;
|
new_info->ie_value = new_value;
|
||||||
opal_list_append (&(info->super), (opal_list_item_t *) new_info);
|
opal_list_append (&(info->super), (opal_list_item_t *) new_info);
|
||||||
}
|
}
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return MPI_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -293,7 +288,7 @@ int opal_info_get (opal_info_t *info, const char *key, int valuelen,
|
|||||||
strcpy(value, search->ie_value);
|
strcpy(value, search->ie_value);
|
||||||
} else {
|
} else {
|
||||||
opal_strncpy(value, search->ie_value, valuelen);
|
opal_strncpy(value, search->ie_value, valuelen);
|
||||||
if (MPI_MAX_INFO_VAL == valuelen) {
|
if (OPAL_MAX_INFO_VAL == valuelen) {
|
||||||
value[valuelen-1] = 0;
|
value[valuelen-1] = 0;
|
||||||
} else {
|
} else {
|
||||||
value[valuelen] = 0;
|
value[valuelen] = 0;
|
||||||
@ -301,7 +296,7 @@ int opal_info_get (opal_info_t *info, const char *key, int valuelen,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return MPI_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int opal_info_get_value_enum (opal_info_t *info, const char *key, int *value,
|
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,
|
|||||||
if (NULL == search){
|
if (NULL == search){
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
*flag = 0;
|
*flag = 0;
|
||||||
return MPI_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we found a mathing key. pass the string value to the enumerator and
|
/* 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)
|
|||||||
*value = opal_str_to_bool(str);
|
*value = opal_str_to_bool(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
return MPI_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -392,7 +387,7 @@ int opal_info_delete(opal_info_t *info, const char *key)
|
|||||||
search = info_find_key (info, key);
|
search = info_find_key (info, key);
|
||||||
if (NULL == search){
|
if (NULL == search){
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return MPI_ERR_INFO_NOKEY;
|
return OPAL_ERR_NOT_FOUND;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* An entry with this key value was found. Remove the item
|
* 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)
|
|||||||
OBJ_RELEASE(search);
|
OBJ_RELEASE(search);
|
||||||
}
|
}
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return MPI_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -429,7 +424,7 @@ int opal_info_get_valuelen (opal_info_t *info, const char *key, int *valuelen,
|
|||||||
*valuelen = strlen(search->ie_value);
|
*valuelen = strlen(search->ie_value);
|
||||||
}
|
}
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return MPI_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -451,7 +446,7 @@ int opal_info_get_nthkey (opal_info_t *info, int n, char *key)
|
|||||||
if (opal_list_get_end(&(info->super)) ==
|
if (opal_list_get_end(&(info->super)) ==
|
||||||
(opal_list_item_t *) iterator) {
|
(opal_list_item_t *) iterator) {
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return MPI_ERR_ARG;
|
return OPAL_ERR_BAD_PARAM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -459,9 +454,9 @@ int opal_info_get_nthkey (opal_info_t *info, int n, char *key)
|
|||||||
* cast it to opal_info_entry_t before we can use it to
|
* cast it to opal_info_entry_t before we can use it to
|
||||||
* access the value
|
* access the value
|
||||||
*/
|
*/
|
||||||
strncpy(key, iterator->ie_key, MPI_MAX_INFO_KEY);
|
strncpy(key, iterator->ie_key, OPAL_MAX_INFO_KEY);
|
||||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||||
return MPI_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -506,7 +501,7 @@ static void info_destructor(opal_info_t *info)
|
|||||||
static void info_entry_constructor(opal_info_entry_t *entry)
|
static void info_entry_constructor(opal_info_entry_t *entry)
|
||||||
{
|
{
|
||||||
memset(entry->ie_key, 0, sizeof(entry->ie_key));
|
memset(entry->ie_key, 0, sizeof(entry->ie_key));
|
||||||
entry->ie_key[MPI_MAX_INFO_KEY] = 0;
|
entry->ie_key[OPAL_MAX_INFO_KEY] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "mpi.h"
|
|
||||||
#include "opal/class/opal_list.h"
|
#include "opal/class/opal_list.h"
|
||||||
#include "opal/class/opal_pointer_array.h"
|
#include "opal/class/opal_pointer_array.h"
|
||||||
#include "opal/threads/mutex.h"
|
#include "opal/threads/mutex.h"
|
||||||
@ -66,7 +65,7 @@ struct opal_info_entry_t {
|
|||||||
opal_list_item_t super; /**< required for opal_list_t type */
|
opal_list_item_t super; /**< required for opal_list_t type */
|
||||||
char *ie_value; /**< value part of the (key, value) pair.
|
char *ie_value; /**< value part of the (key, value) pair.
|
||||||
* Maximum length is MPI_MAX_INFO_VAL */
|
* Maximum length is MPI_MAX_INFO_VAL */
|
||||||
char ie_key[MPI_MAX_INFO_KEY + 1]; /**< "key" part of the (key, value)
|
char ie_key[OPAL_MAX_INFO_KEY + 1]; /**< "key" part of the (key, value)
|
||||||
* pair */
|
* pair */
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -81,13 +80,13 @@ BEGIN_C_DECLS
|
|||||||
* \internal
|
* \internal
|
||||||
* Some declarations needed to use OBJ_NEW and OBJ_DESTRUCT macros
|
* Some declarations needed to use OBJ_NEW and OBJ_DESTRUCT macros
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(opal_info_t);
|
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_info_t);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \internal
|
* \internal
|
||||||
* Some declarations needed to use OBJ_NEW and OBJ_DESTRUCT macros
|
* Some declarations needed to use OBJ_NEW and OBJ_DESTRUCT macros
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(opal_info_entry_t);
|
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_info_entry_t);
|
||||||
|
|
||||||
|
|
||||||
int opal_mpiinfo_init(void*);
|
int opal_mpiinfo_init(void*);
|
||||||
@ -98,8 +97,8 @@ int opal_mpiinfo_init(void*);
|
|||||||
* @param info source info object (handle)
|
* @param info source info object (handle)
|
||||||
* @param newinfo pointer to the new info object (handle)
|
* @param newinfo pointer to the new info object (handle)
|
||||||
*
|
*
|
||||||
* @retval MPI_SUCCESS upon success
|
* @retval OPAL_SUCCESS upon success
|
||||||
* @retval MPI_ERR_NO_MEM if out of memory
|
* @retval OPAL_ERR_OUT_OF_RESOURCE if out of memory
|
||||||
*
|
*
|
||||||
* Not only will the (key, value) pairs be duplicated, the order
|
* Not only will the (key, value) pairs be duplicated, the order
|
||||||
* of keys will be the same in 'newinfo' as it is in 'info'. When
|
* of keys will be the same in 'newinfo' as it is in 'info'. When
|
||||||
@ -114,8 +113,8 @@ int opal_info_dup (opal_info_t *info, opal_info_t **newinfo);
|
|||||||
* @param info source info object (handle)
|
* @param info source info object (handle)
|
||||||
* @param newinfo pointer to the new info object (handle)
|
* @param newinfo pointer to the new info object (handle)
|
||||||
*
|
*
|
||||||
* @retval MPI_SUCCESS upon success
|
* @retval OPAL_SUCCESS upon success
|
||||||
* @retval MPI_ERR_NO_MEM if out of memory
|
* @retval OPAL_ERR_OUT_OF_RESOURCE if out of memory
|
||||||
*
|
*
|
||||||
* The user sets an info object with key/value pairs and once processed,
|
* The user sets an info object with key/value pairs and once processed,
|
||||||
* we keep key/val pairs that might have been modified vs what the user
|
* we keep key/val pairs that might have been modified vs what the user
|
||||||
@ -143,10 +142,10 @@ int opal_info_dup_mpistandard (opal_info_t *info, opal_info_t **newinfo);
|
|||||||
* @param key pointer to the new key object
|
* @param key pointer to the new key object
|
||||||
* @param value pointer to the new value object
|
* @param value pointer to the new value object
|
||||||
*
|
*
|
||||||
* @retval MPI_SUCCESS upon success
|
* @retval OPAL_SUCCESS upon success
|
||||||
* @retval MPI_ERR_NO_MEM if out of memory
|
* @retval OPAL_ERR_OUT_OF_RESOURCE if out of memory
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int opal_info_set (opal_info_t *info, const char *key, const char *value);
|
OPAL_DECLSPEC int opal_info_set (opal_info_t *info, const char *key, const char *value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a new key,value pair from a variable enumerator.
|
* Set a new key,value pair from a variable enumerator.
|
||||||
@ -156,11 +155,11 @@ OMPI_DECLSPEC int opal_info_set (opal_info_t *info, const char *key, const char
|
|||||||
* @param value integer value of the info key (must be valid in var_enum)
|
* @param value integer value of the info key (must be valid in var_enum)
|
||||||
* @param var_enum variable enumerator
|
* @param var_enum variable enumerator
|
||||||
*
|
*
|
||||||
* @retval MPI_SUCCESS upon success
|
* @retval OPAL_SUCCESS upon success
|
||||||
* @retval MPI_ERR_NO_MEM if out of memory
|
* @retval OPAL_ERR_OUT_OF_RESOURCE if out of memory
|
||||||
* @retval OPAL_ERR_VALUE_OUT_OF_BOUNDS if the value is not valid in the enumerator
|
* @retval OPAL_ERR_VALUE_OUT_OF_BOUNDS if the value is not valid in the enumerator
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int opal_info_set_value_enum (opal_info_t *info, const char *key, int value,
|
OPAL_DECLSPEC int opal_info_set_value_enum (opal_info_t *info, const char *key, int value,
|
||||||
mca_base_var_enum_t *var_enum);
|
mca_base_var_enum_t *var_enum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,8 +167,8 @@ OMPI_DECLSPEC int opal_info_set_value_enum (opal_info_t *info, const char *key,
|
|||||||
*
|
*
|
||||||
* @param info pointer to info (opal_info_t *) object to be freed (handle)
|
* @param info pointer to info (opal_info_t *) object to be freed (handle)
|
||||||
*
|
*
|
||||||
* @retval MPI_SUCCESS
|
* @retval OPAL_SUCCESS
|
||||||
* @retval MPI_ERR_ARG
|
* @retval OPAL_ERR_BAD_PARAM
|
||||||
*
|
*
|
||||||
* Upon successful completion, 'info' will be set to
|
* Upon successful completion, 'info' will be set to
|
||||||
* 'MPI_INFO_NULL'. Free the info handle and all of its keys and
|
* 'MPI_INFO_NULL'. Free the info handle and all of its keys and
|
||||||
@ -187,7 +186,7 @@ int opal_info_free (opal_info_t **info);
|
|||||||
* @param flag true (1) if 'key' defined on 'info', false (0) if not
|
* @param flag true (1) if 'key' defined on 'info', false (0) if not
|
||||||
* (logical)
|
* (logical)
|
||||||
*
|
*
|
||||||
* @retval MPI_SUCCESS
|
* @retval OPAL_SUCCESS
|
||||||
*
|
*
|
||||||
* If found, the string value will be cast to the boolen output in
|
* If found, the string value will be cast to the boolen output in
|
||||||
* the following manner:
|
* the following manner:
|
||||||
@ -200,7 +199,7 @@ int opal_info_free (opal_info_t **info);
|
|||||||
* result is false
|
* result is false
|
||||||
* - All other values are false
|
* - All other values are false
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int opal_info_get_bool (opal_info_t *info, char *key, bool *value,
|
OPAL_DECLSPEC int opal_info_get_bool (opal_info_t *info, char *key, bool *value,
|
||||||
int *flag);
|
int *flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,10 +215,10 @@ OMPI_DECLSPEC int opal_info_get_bool (opal_info_t *info, char *key, bool *value,
|
|||||||
* @param flag true (1) if 'key' defined on 'info', false (0) if not
|
* @param flag true (1) if 'key' defined on 'info', false (0) if not
|
||||||
* (logical)
|
* (logical)
|
||||||
*
|
*
|
||||||
* @retval MPI_SUCCESS
|
* @retval OPAL_SUCCESS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
OMPI_DECLSPEC int opal_info_get_value_enum (opal_info_t *info, const char *key,
|
OPAL_DECLSPEC int opal_info_get_value_enum (opal_info_t *info, const char *key,
|
||||||
int *value, int default_value,
|
int *value, int default_value,
|
||||||
mca_base_var_enum_t *var_enum, int *flag);
|
mca_base_var_enum_t *var_enum, int *flag);
|
||||||
|
|
||||||
@ -233,12 +232,12 @@ OMPI_DECLSPEC int opal_info_get_value_enum (opal_info_t *info, const char *key,
|
|||||||
* @param flag true (1) if 'key' defined on 'info', false (0) if not
|
* @param flag true (1) if 'key' defined on 'info', false (0) if not
|
||||||
* (logical)
|
* (logical)
|
||||||
*
|
*
|
||||||
* @retval MPI_SUCCESS
|
* @retval OPAL_SUCCESS
|
||||||
*
|
*
|
||||||
* In C and C++, 'valuelen' should be one less than the allocated
|
* In C and C++, 'valuelen' should be one less than the allocated
|
||||||
* space to allow for for the null terminator.
|
* space to allow for for the null terminator.
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int opal_info_get (opal_info_t *info, const char *key, int valuelen,
|
OPAL_DECLSPEC int opal_info_get (opal_info_t *info, const char *key, int valuelen,
|
||||||
char *value, int *flag);
|
char *value, int *flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -248,8 +247,8 @@ OMPI_DECLSPEC int opal_info_get (opal_info_t *info, const char *key, int valuele
|
|||||||
* @param key The key portion of the (key,value) pair that
|
* @param key The key portion of the (key,value) pair that
|
||||||
* needs to be deleted
|
* needs to be deleted
|
||||||
*
|
*
|
||||||
* @retval MPI_SUCCESS
|
* @retval OPAL_SUCCESS
|
||||||
* @retval MPI_ERR_NOKEY
|
* @retval OPAL_ERR_NOT_FOUND
|
||||||
*/
|
*/
|
||||||
int opal_info_delete(opal_info_t *info, const char *key);
|
int opal_info_delete(opal_info_t *info, const char *key);
|
||||||
|
|
||||||
@ -260,15 +259,15 @@ int opal_info_delete(opal_info_t *info, const char *key);
|
|||||||
* @param flag - true (1) if 'key' defined on 'info', false (0) if not
|
* @param flag - true (1) if 'key' defined on 'info', false (0) if not
|
||||||
* (logical)
|
* (logical)
|
||||||
*
|
*
|
||||||
* @retval MPI_SUCCESS
|
* @retval OPAL_SUCCESS
|
||||||
* @retval MPI_ERR_ARG
|
* @retval OPAL_ERR_BAD_PARAM
|
||||||
* @retval MPI_ERR_INFO_KEY
|
* @retval MPI_ERR_INFO_KEY
|
||||||
*
|
*
|
||||||
* The length returned in C and C++ does not include the end-of-string
|
* The length returned in C and C++ does not include the end-of-string
|
||||||
* character. If the 'key' is not found on 'info', 'valuelen' is left
|
* character. If the 'key' is not found on 'info', 'valuelen' is left
|
||||||
* alone.
|
* alone.
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int opal_info_get_valuelen (opal_info_t *info, const char *key, int *valuelen,
|
OPAL_DECLSPEC int opal_info_get_valuelen (opal_info_t *info, const char *key, int *valuelen,
|
||||||
int *flag);
|
int *flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -278,8 +277,8 @@ OMPI_DECLSPEC int opal_info_get_valuelen (opal_info_t *info, const char *key, in
|
|||||||
* @param n index of key to retrieve (integer)
|
* @param n index of key to retrieve (integer)
|
||||||
* @param key character string of at least 'MPI_MAX_INFO_KEY' characters
|
* @param key character string of at least 'MPI_MAX_INFO_KEY' characters
|
||||||
*
|
*
|
||||||
* @retval MPI_SUCCESS
|
* @retval OPAL_SUCCESS
|
||||||
* @retval MPI_ERR_ARG
|
* @retval OPAL_ERR_BAD_PARAM
|
||||||
*/
|
*/
|
||||||
int opal_info_get_nthkey (opal_info_t *info, int n, char *key);
|
int opal_info_get_nthkey (opal_info_t *info, int n, char *key);
|
||||||
|
|
||||||
@ -294,23 +293,23 @@ int opal_info_get_nthkey (opal_info_t *info, int n, char *key);
|
|||||||
* @param value Value string for info key to interpret
|
* @param value Value string for info key to interpret
|
||||||
* @param interp returned interpretation of the value key
|
* @param interp returned interpretation of the value key
|
||||||
*
|
*
|
||||||
* @retval OMPI_SUCCESS string was successfully interpreted
|
* @retval OPAL_SUCCESS string was successfully interpreted
|
||||||
* @retval OMPI_ERR_BAD_PARAM string was not able to be interpreted
|
* @retval OPAL_ERR_BAD_PARAM string was not able to be interpreted
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int opal_info_value_to_bool(char *value, bool *interp);
|
OPAL_DECLSPEC int opal_info_value_to_bool(char *value, bool *interp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert value string to integer
|
* Convert value string to integer
|
||||||
*
|
*
|
||||||
* Convert value string \c value into a integer, using the
|
* Convert value string \c value into a integer, using the
|
||||||
* interpretation rules specified in MPI-2 Section 4.10.
|
* interpretation rules specified in MPI-2 Section 4.10.
|
||||||
* All others will return \c OMPI_ERR_BAD_PARAM
|
* All others will return \c OPAL_ERR_BAD_PARAM
|
||||||
*
|
*
|
||||||
* @param value Value string for info key to interpret
|
* @param value Value string for info key to interpret
|
||||||
* @param interp returned interpretation of the value key
|
* @param interp returned interpretation of the value key
|
||||||
*
|
*
|
||||||
* @retval OMPI_SUCCESS string was successfully interpreted
|
* @retval OPAL_SUCCESS string was successfully interpreted
|
||||||
* @retval OMPI_ERR_BAD_PARAM string was not able to be interpreted
|
* @retval OPAL_ERR_BAD_PARAM string was not able to be interpreted
|
||||||
*/
|
*/
|
||||||
int opal_info_value_to_int(char *value, int *interp);
|
int opal_info_value_to_int(char *value, int *interp);
|
||||||
|
|
||||||
@ -327,7 +326,7 @@ static inline int
|
|||||||
opal_info_get_nkeys(opal_info_t *info, int *nkeys)
|
opal_info_get_nkeys(opal_info_t *info, int *nkeys)
|
||||||
{
|
{
|
||||||
*nkeys = (int) opal_list_get_size(&(info->super));
|
*nkeys = (int) opal_list_get_size(&(info->super));
|
||||||
return MPI_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool opal_str_to_bool(char*);
|
bool opal_str_to_bool(char*);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2007-2015 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2007-2015 Cisco Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
* Copyright (c) 2015 Research Organization for Information Science
|
* Copyright (c) 2015 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
@ -253,19 +253,19 @@ opal_infosubscribe_testregister(opal_infosubscriber_t *object)
|
|||||||
static int
|
static int
|
||||||
save_original_key_val(opal_info_t *info, char *key, char *val, int overwrite)
|
save_original_key_val(opal_info_t *info, char *key, char *val, int overwrite)
|
||||||
{
|
{
|
||||||
char modkey[MPI_MAX_INFO_KEY];
|
char modkey[OPAL_MAX_INFO_KEY];
|
||||||
int flag, err;
|
int flag, err;
|
||||||
|
|
||||||
// Checking strlen, even though it should be unnecessary.
|
// Checking strlen, even though it should be unnecessary.
|
||||||
// This should only happen on predefined keys with short lengths.
|
// This should only happen on predefined keys with short lengths.
|
||||||
if (strlen(key) + 5 < MPI_MAX_INFO_KEY) {
|
if (strlen(key) + 5 < OPAL_MAX_INFO_KEY) {
|
||||||
sprintf(modkey, "__IN_%s", key);
|
sprintf(modkey, "__IN_%s", key);
|
||||||
|
|
||||||
flag = 0;
|
flag = 0;
|
||||||
opal_info_get(info, modkey, 0, NULL, &flag);
|
opal_info_get(info, modkey, 0, NULL, &flag);
|
||||||
if (!flag || overwrite) {
|
if (!flag || overwrite) {
|
||||||
err = opal_info_set(info, modkey, val);
|
err = opal_info_set(info, modkey, val);
|
||||||
if (MPI_SUCCESS != err) {
|
if (OPAL_SUCCESS != err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ save_original_key_val(opal_info_t *info, char *key, char *val, int overwrite)
|
|||||||
printf("WARNING: Unexpected key length [%s]\n", key);
|
printf("WARNING: Unexpected key length [%s]\n", key);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return MPI_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -308,9 +308,9 @@ opal_infosubscribe_change_info(opal_infosubscriber_t *object, opal_info_t *new_i
|
|||||||
// either way it shouldn't be set, which we'll ensure with an unset
|
// either way it shouldn't be set, which we'll ensure with an unset
|
||||||
// in case a previous value exists.
|
// in case a previous value exists.
|
||||||
err = opal_info_delete(object->s_info, iterator->ie_key);
|
err = opal_info_delete(object->s_info, iterator->ie_key);
|
||||||
err = MPI_SUCCESS; // we don't care if the key was found or not
|
err = OPAL_SUCCESS; // we don't care if the key was found or not
|
||||||
}
|
}
|
||||||
if (MPI_SUCCESS != err) {
|
if (OPAL_SUCCESS != err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
// Save the original at "__IN_<key>":"original"
|
// Save the original at "__IN_<key>":"original"
|
||||||
@ -378,12 +378,12 @@ int opal_infosubscribe_subscribe(opal_infosubscriber_t *object, char *key, char
|
|||||||
}
|
}
|
||||||
// - is there a value already associated with key in this obj's info:
|
// - is there a value already associated with key in this obj's info:
|
||||||
// to use in the callback()
|
// to use in the callback()
|
||||||
char *buffer = malloc(MPI_MAX_INFO_VAL+1); // (+1 shouldn't be needed)
|
char *buffer = malloc(OPAL_MAX_INFO_VAL+1); // (+1 shouldn't be needed)
|
||||||
char *val = value; // start as default value
|
char *val = value; // start as default value
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
char *updated_value;
|
char *updated_value;
|
||||||
int err;
|
int err;
|
||||||
opal_info_get(object->s_info, key, MPI_MAX_INFO_VAL, buffer, &flag);
|
opal_info_get(object->s_info, key, OPAL_MAX_INFO_VAL, buffer, &flag);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
val = buffer; // become info value if this key was in info
|
val = buffer; // become info value if this key was in info
|
||||||
}
|
}
|
||||||
@ -393,9 +393,9 @@ int opal_infosubscribe_subscribe(opal_infosubscriber_t *object, char *key, char
|
|||||||
err = opal_info_set(object->s_info, key, updated_value);
|
err = opal_info_set(object->s_info, key, updated_value);
|
||||||
} else {
|
} else {
|
||||||
err = opal_info_delete(object->s_info, key);
|
err = opal_info_delete(object->s_info, key);
|
||||||
err = MPI_SUCCESS; // we don't care if the key was found or not
|
err = OPAL_SUCCESS; // we don't care if the key was found or not
|
||||||
}
|
}
|
||||||
if (MPI_SUCCESS != err) {
|
if (OPAL_SUCCESS != err) {
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user