Bring over the ORTE 2.0 DSS. This introduces a few changes, almost all of which are transparent to the user:
1. Introduces a flag for the type of buffer that now allows a user to either have a fully described or a completely non-described buffer. In the latter case, no data type descriptions are included in the buffer. This obviously limits what we can do for debugging purposes, but the intent here was to provide an optimized communications capability for those wanting it. Note that individual buffers can be designated for either type using the orte_dss.set_buffer_type command. In other words, the buffer type can be set dynamically - it isn't a configuration setting at all. The type will default to fully described. A buffer MUST be empty to set its type - this is checked by the set_buffer_type command, and you will receive an error if you violate that rule. IMPORTANT NOTE: ORTE 1.x actually will NOT work with non-described buffers. This capability should therefore NOT be used until we tell you it is okay. For now, it is here simply so we can begin bringing over parts of ORTE 2.0. The problem is that ORTE 1.x depends upon the transmission of non-hard-cast data types such as size_t. These "soft" types currently utilize a "peek" function to see their actual type in the buffer - obviously, without description, the system has no idea how to unpack these "soft" types. We will deal with this later - for now, please don't use the non-described buffer option. 2. Introduces the orte_std_cntr_t type. This will become the replacement for the size_t's used throughout ORTE 1.x. At the moment, it is actually typedef'd to size_t for backward compatibility. 3. Introduces the orte_dss.arith API that supports arbitrary arithmetic functions on numeric data types. Calling the function with any other data type will generate an error. This commit was SVN r11075.
Этот коммит содержится в:
родитель
7784f1a818
Коммит
bd7e8febb1
@ -30,6 +30,7 @@ dss_libdss_la_SOURCES = \
|
||||
dss/dss_arith.c \
|
||||
dss/dss_compare.c \
|
||||
dss/dss_copy.c \
|
||||
dss/dss_dump.c \
|
||||
dss/dss_get.c \
|
||||
dss/dss_load_unload.c \
|
||||
dss/dss_lookup.c \
|
||||
@ -39,6 +40,7 @@ dss_libdss_la_SOURCES = \
|
||||
dss/dss_register.c \
|
||||
dss/dss_release.c \
|
||||
dss/dss_set.c \
|
||||
dss/dss_set_buffer_type.c \
|
||||
dss/dss_size.c \
|
||||
dss/dss_unpack.c \
|
||||
dss/dss_open_close.c
|
||||
|
@ -35,6 +35,28 @@
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set the buffer type.
|
||||
*
|
||||
* The pack/unpack functions can work with two types of buffer - fully
|
||||
* described (i.e., every data object is preceeded by an identifier as
|
||||
* to the type of the object) and non-described (i.e., no type
|
||||
* identifier included). This function allows the caller to set the
|
||||
* buffer type to the specified type - the function first checks to
|
||||
* ensure the buffer is empty as the type cannot be changed once
|
||||
* data has already entered the buffer.
|
||||
*
|
||||
* @param *buffer A pointer to the buffer
|
||||
*
|
||||
* @param type The new buffer type
|
||||
*
|
||||
* @retval ORTE_SUCCESS Operation successfully executed
|
||||
*
|
||||
* @retval ORTE_ERROR_VALUE An appropriate error code
|
||||
*/
|
||||
typedef int (*orte_dss_set_buffer_type_fn_t)(orte_buffer_t *buffer, orte_dss_buffer_type_t type);
|
||||
|
||||
/**
|
||||
* Top-level itnerface function to pack one or more values into a
|
||||
* buffer.
|
||||
@ -87,7 +109,7 @@ extern "C" {
|
||||
* @endcode
|
||||
*/
|
||||
typedef int (*orte_dss_pack_fn_t)(orte_buffer_t *buffer, void *src,
|
||||
size_t num_values,
|
||||
orte_std_cntr_t num_values,
|
||||
orte_data_type_t type);
|
||||
|
||||
/**
|
||||
@ -147,7 +169,7 @@ typedef int (*orte_dss_pack_fn_t)(orte_buffer_t *buffer, void *src,
|
||||
* string in the array - the caller must only provide adequate memory
|
||||
* for the array of pointers.
|
||||
*
|
||||
* @param *num A pointer to a size_t value indicating the maximum
|
||||
* @param *num A pointer to a orte_std_cntr_t value indicating the maximum
|
||||
* number of values that are to be unpacked, beginning at the location
|
||||
* pointed to by src. This is provided to help protect the caller from
|
||||
* memory overrun. Note that a string
|
||||
@ -180,7 +202,7 @@ typedef int (*orte_dss_pack_fn_t)(orte_buffer_t *buffer, void *src,
|
||||
* orte_buffer_t *buffer;
|
||||
* int32_t dest;
|
||||
* char **string_array;
|
||||
* size_t num_values;
|
||||
* orte_std_cntr_t num_values;
|
||||
*
|
||||
* num_values = 1;
|
||||
* status_code = orte_dss.unpack(buffer, (void*)&dest, &num_values, ORTE_INT32);
|
||||
@ -192,7 +214,7 @@ typedef int (*orte_dss_pack_fn_t)(orte_buffer_t *buffer, void *src,
|
||||
* @endcode
|
||||
*/
|
||||
typedef int (*orte_dss_unpack_fn_t)(orte_buffer_t *buffer, void *dest,
|
||||
size_t *max_num_values,
|
||||
orte_std_cntr_t *max_num_values,
|
||||
orte_data_type_t type);
|
||||
|
||||
/**
|
||||
@ -209,7 +231,7 @@ typedef int (*orte_dss_unpack_fn_t)(orte_buffer_t *buffer, void *dest,
|
||||
* type of the next item in the buffer is to be stored. Caller must
|
||||
* have memory backing this location.
|
||||
*
|
||||
* @param number A pointer to a size_t variable where the number of
|
||||
* @param number A pointer to a orte_std_cntr_t variable where the number of
|
||||
* data values in the next item is to be stored. Caller must have
|
||||
* memory backing this location.
|
||||
*
|
||||
@ -221,7 +243,7 @@ typedef int (*orte_dss_unpack_fn_t)(orte_buffer_t *buffer, void *dest,
|
||||
*/
|
||||
typedef int (*orte_dss_peek_next_item_fn_t)(orte_buffer_t *buffer,
|
||||
orte_data_type_t *type,
|
||||
size_t *number);
|
||||
orte_std_cntr_t *number);
|
||||
|
||||
/**
|
||||
* Unload the data payload from a buffer.
|
||||
@ -452,7 +474,7 @@ typedef int (*orte_dss_get_fn_t)(void **data, orte_data_value_t *value, orte_dat
|
||||
* @retval ORTE_ERROR(s) An appropriate error code - usually caused by the specified type
|
||||
* not matching the data type within the stored object.
|
||||
*/
|
||||
typedef int (*orte_dss_arith_fn_t)(orte_data_value_t *value, void *operand, orte_dss_arith_op_t operation, orte_data_type_t type);
|
||||
typedef int (*orte_dss_arith_fn_t)(orte_data_value_t *value, orte_data_value_t *operand, orte_dss_arith_op_t operation);
|
||||
|
||||
/**
|
||||
* Increment a data value
|
||||
@ -553,6 +575,7 @@ struct orte_dss_t {
|
||||
orte_dss_arith_fn_t arith;
|
||||
orte_dss_increment_fn_t increment;
|
||||
orte_dss_decrement_fn_t decrement;
|
||||
orte_dss_set_buffer_type_fn_t set_buffer_type;
|
||||
orte_dss_pack_fn_t pack;
|
||||
orte_dss_unpack_fn_t unpack;
|
||||
orte_dss_copy_fn_t copy;
|
||||
|
@ -43,68 +43,68 @@ static void orte_dss_arith_uint64(uint64_t *value, uint64_t *operand, orte_dss_a
|
||||
static void orte_dss_arith_data_type(orte_data_type_t *value, orte_data_type_t *operand, orte_dss_arith_op_t operation);
|
||||
static void orte_dss_arith_daemon_cmd(orte_daemon_cmd_flag_t *value, orte_daemon_cmd_flag_t *operand, orte_dss_arith_op_t operation);
|
||||
|
||||
int orte_dss_arith(orte_data_value_t *value, void *operand, orte_dss_arith_op_t operation, orte_data_type_t type)
|
||||
int orte_dss_arith(orte_data_value_t *value, orte_data_value_t *operand, orte_dss_arith_op_t operation)
|
||||
{
|
||||
/* check for error */
|
||||
if (NULL == value || NULL == operand) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
if (type != value->type) {
|
||||
if (operand->type != value->type) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_TYPE_MISMATCH);
|
||||
return ORTE_ERR_TYPE_MISMATCH;
|
||||
}
|
||||
|
||||
/* Lookup the arith function for this type and call it */
|
||||
|
||||
switch(type) {
|
||||
switch(operand->type) {
|
||||
case ORTE_INT:
|
||||
orte_dss_arith_int(value->data, operand, operation);
|
||||
orte_dss_arith_int(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
case ORTE_UINT:
|
||||
orte_dss_arith_uint(value->data, operand, operation);
|
||||
orte_dss_arith_uint(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
case ORTE_SIZE:
|
||||
orte_dss_arith_size(value->data, operand, operation);
|
||||
orte_dss_arith_size(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
case ORTE_PID:
|
||||
orte_dss_arith_pid(value->data, operand, operation);
|
||||
orte_dss_arith_pid(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
case ORTE_BYTE:
|
||||
case ORTE_UINT8:
|
||||
orte_dss_arith_byte(value->data, operand, operation);
|
||||
orte_dss_arith_byte(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
case ORTE_INT8:
|
||||
orte_dss_arith_int8(value->data, operand, operation);
|
||||
orte_dss_arith_int8(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
case ORTE_INT16:
|
||||
orte_dss_arith_int16(value->data, operand, operation);
|
||||
orte_dss_arith_int16(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
case ORTE_UINT16:
|
||||
orte_dss_arith_uint16(value->data, operand, operation);
|
||||
orte_dss_arith_uint16(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
case ORTE_INT32:
|
||||
orte_dss_arith_int32(value->data, operand, operation);
|
||||
orte_dss_arith_int32(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
case ORTE_UINT32:
|
||||
orte_dss_arith_uint32(value->data, operand, operation);
|
||||
orte_dss_arith_uint32(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
case ORTE_INT64:
|
||||
orte_dss_arith_int64(value->data, operand, operation);
|
||||
orte_dss_arith_int64(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
case ORTE_UINT64:
|
||||
orte_dss_arith_uint64(value->data, operand, operation);
|
||||
orte_dss_arith_uint64(value->data, operand->data, operation);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -210,6 +210,16 @@ int orte_dss_compare_string(char *value1, char *value2, orte_data_type_t type)
|
||||
|
||||
/* COMPARE FUNCTIONS FOR GENERIC ORTE TYPES */
|
||||
|
||||
/* ORTE_STD_CNTR */
|
||||
int orte_dss_compare_std_cntr(orte_std_cntr_t *value1, orte_std_cntr_t *value2, orte_data_type_t type)
|
||||
{
|
||||
if (*value1 > *value2) return ORTE_VALUE1_GREATER;
|
||||
|
||||
if (*value2 > *value1) return ORTE_VALUE2_GREATER;
|
||||
|
||||
return ORTE_EQUAL;
|
||||
}
|
||||
|
||||
/* ORTE_DATA_TYPE */
|
||||
int orte_dss_compare_dt(orte_data_type_t *value1, orte_data_type_t *value2, orte_data_type_t type)
|
||||
{
|
||||
@ -247,7 +257,7 @@ int orte_dss_compare_data_value(orte_data_value_t *value1, orte_data_value_t *va
|
||||
int orte_dss_compare_byte_object(orte_byte_object_t *value1, orte_byte_object_t *value2, orte_data_type_t type)
|
||||
{
|
||||
int checksum, diff;
|
||||
size_t i;
|
||||
orte_std_cntr_t i;
|
||||
|
||||
/* compare the sizes first - bigger size object is "greater than" */
|
||||
if (value1->size > value2->size) return ORTE_VALUE1_GREATER;
|
||||
|
@ -104,6 +104,10 @@ int orte_dss_std_copy(void **dest, void *src, orte_data_type_t type)
|
||||
datasize = 8;
|
||||
break;
|
||||
|
||||
case ORTE_STD_CNTR:
|
||||
datasize = sizeof(orte_std_cntr_t);
|
||||
break;
|
||||
|
||||
case ORTE_DATA_TYPE:
|
||||
datasize = sizeof(orte_data_type_t);
|
||||
break;
|
||||
|
@ -46,3 +46,4 @@ void orte_dss_dump_data_types(int output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,21 +157,24 @@ extern orte_data_type_t orte_dss_num_reg_types;
|
||||
/*
|
||||
* Implementations of API functions
|
||||
*/
|
||||
|
||||
int orte_dss_set(orte_data_value_t *value, void *new_value, orte_data_type_t type);
|
||||
|
||||
int orte_dss_get(void **data, orte_data_value_t *value, orte_data_type_t type);
|
||||
|
||||
int orte_dss_arith(orte_data_value_t *value, void *operand, orte_dss_arith_op_t operation, orte_data_type_t type);
|
||||
int orte_dss_arith(orte_data_value_t *value, orte_data_value_t *operand, orte_dss_arith_op_t operation);
|
||||
|
||||
int orte_dss_increment(orte_data_value_t *value);
|
||||
|
||||
int orte_dss_decrement(orte_data_value_t *value);
|
||||
|
||||
int orte_dss_set_buffer_type(orte_buffer_t *buffer, orte_dss_buffer_type_t type);
|
||||
|
||||
int orte_dss_pack(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals,
|
||||
orte_std_cntr_t num_vals,
|
||||
orte_data_type_t type);
|
||||
int orte_dss_unpack(orte_buffer_t *buffer, void *dest,
|
||||
size_t *max_num_vals,
|
||||
orte_std_cntr_t *max_num_vals,
|
||||
orte_data_type_t type);
|
||||
|
||||
int orte_dss_copy(void **dest, void *src, orte_data_type_t type);
|
||||
@ -184,7 +187,7 @@ extern orte_data_type_t orte_dss_num_reg_types;
|
||||
int orte_dss_size(size_t *size, void *src, orte_data_type_t type);
|
||||
|
||||
int orte_dss_peek(orte_buffer_t *buffer, orte_data_type_t *type,
|
||||
size_t *number);
|
||||
orte_std_cntr_t *number);
|
||||
|
||||
int orte_dss_peek_type(orte_buffer_t *buffer, orte_data_type_t *type);
|
||||
|
||||
@ -211,10 +214,10 @@ extern orte_data_type_t orte_dss_num_reg_types;
|
||||
/*
|
||||
* Non-API functions
|
||||
*/
|
||||
int orte_dss_pack_buffer(orte_buffer_t *buffer, void *src, size_t num_vals,
|
||||
int orte_dss_pack_buffer(orte_buffer_t *buffer, void *src, orte_std_cntr_t num_vals,
|
||||
orte_data_type_t type);
|
||||
|
||||
int orte_dss_unpack_buffer(orte_buffer_t *buffer, void *dst, size_t *num_vals,
|
||||
int orte_dss_unpack_buffer(orte_buffer_t *buffer, void *dst, orte_std_cntr_t *num_vals,
|
||||
orte_data_type_t type);
|
||||
|
||||
/*
|
||||
@ -222,84 +225,90 @@ extern orte_data_type_t orte_dss_num_reg_types;
|
||||
*/
|
||||
|
||||
int orte_dss_pack_null(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
int orte_dss_pack_byte(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_pack_bool(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_pack_int(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
int orte_dss_pack_int16(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
int orte_dss_pack_int32(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
int orte_dss_pack_int64(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_pack_sizet(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_pack_pid(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_pack_string(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_pack_std_cntr(orte_buffer_t *buffer, void *src, orte_std_cntr_t num,
|
||||
orte_data_type_t type);
|
||||
|
||||
int orte_dss_pack_data_type(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_pack_daemon_cmd(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_pack_data_value(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_pack_byte_object(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type);
|
||||
|
||||
/*
|
||||
* Internal unpack functions
|
||||
*/
|
||||
|
||||
int orte_dss_unpack_null(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
int orte_dss_unpack_byte(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_unpack_bool(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_unpack_int(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
int orte_dss_unpack_int16(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
int orte_dss_unpack_int32(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
int orte_dss_unpack_int64(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_unpack_sizet(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_unpack_pid(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_unpack_string(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_unpack_std_cntr(orte_buffer_t *buffer, void *dest, orte_std_cntr_t *num,
|
||||
orte_data_type_t type);
|
||||
|
||||
int orte_dss_unpack_data_type(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_unpack_daemon_cmd(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_unpack_data_value(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
|
||||
int orte_dss_unpack_byte_object(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type);
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type);
|
||||
|
||||
/*
|
||||
* Internal copy functions
|
||||
@ -347,6 +356,8 @@ extern orte_data_type_t orte_dss_num_reg_types;
|
||||
|
||||
int orte_dss_compare_string(char *value1, char *value2, orte_data_type_t type);
|
||||
|
||||
int orte_dss_compare_std_cntr(orte_std_cntr_t *value1, orte_std_cntr_t *value2, orte_data_type_t type);
|
||||
|
||||
int orte_dss_compare_dt(orte_data_type_t *value1, orte_data_type_t *value2, orte_data_type_t type);
|
||||
|
||||
int orte_dss_compare_daemon_cmd(orte_daemon_cmd_flag_t *value1, orte_daemon_cmd_flag_t *value2, orte_data_type_t type);
|
||||
@ -392,6 +403,7 @@ extern orte_data_type_t orte_dss_num_reg_types;
|
||||
int orte_dss_print_int64(char **output, char *prefix, void *src, orte_data_type_t type);
|
||||
#endif
|
||||
int orte_dss_print_null(char **output, char *prefix, void *src, orte_data_type_t type);
|
||||
int orte_dss_print_std_cntr(char **output, char *prefix, orte_std_cntr_t *src, orte_data_type_t type);
|
||||
int orte_dss_print_data_type(char **output, char *prefix, orte_data_type_t *src, orte_data_type_t type);
|
||||
int orte_dss_print_daemon_cmd(char **output, char *prefix, orte_daemon_cmd_flag_t *src, orte_data_type_t type);
|
||||
int orte_dss_print_data_value(char **output, char *prefix, orte_data_value_t *src, orte_data_type_t type);
|
||||
@ -415,12 +427,12 @@ extern orte_data_type_t orte_dss_num_reg_types;
|
||||
|
||||
bool orte_dss_too_small(orte_buffer_t *buffer, size_t bytes_reqd);
|
||||
|
||||
orte_dss_type_info_t* orte_dss_find_type(orte_data_type_t type);
|
||||
|
||||
int orte_dss_store_data_type(orte_buffer_t *buffer, orte_data_type_t type);
|
||||
|
||||
int orte_dss_get_data_type(orte_buffer_t *buffer, orte_data_type_t *type);
|
||||
|
||||
orte_dss_type_info_t* orte_dss_find_type(orte_data_type_t type);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -27,6 +27,8 @@
|
||||
#endif
|
||||
|
||||
#include "opal/util/output.h"
|
||||
|
||||
#include "orte/class/orte_pointer_array.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
|
||||
#include "orte/dss/dss_internal.h"
|
||||
@ -104,96 +106,41 @@ bool orte_dss_too_small(orte_buffer_t *buffer, size_t bytes_reqd)
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal function to store data type in buffer
|
||||
*/
|
||||
int orte_dss_store_data_type(orte_buffer_t *buffer, orte_data_type_t type)
|
||||
{
|
||||
size_t required;
|
||||
int rc;
|
||||
|
||||
required = sizeof(orte_data_type_t);
|
||||
switch (required) {
|
||||
|
||||
case 1:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_byte(buffer, &type, 1, ORTE_BYTE))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_int16(buffer, &type, 1, ORTE_INT16))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_int32(buffer, &type, 1, ORTE_INT32))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_int64(buffer, &type, 1, ORTE_INT64))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
orte_dss_type_info_t *info;
|
||||
|
||||
/* Lookup the pack function for the actual orte_data_type type and call it */
|
||||
|
||||
if (NULL == (info = orte_pointer_array_get_item(orte_dss_types, ORTE_DATA_TYPE_T))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_PACK_FAILURE);
|
||||
return ORTE_ERR_PACK_FAILURE;
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS != (rc = info->odti_pack_fn(buffer, &type, 1, ORTE_DATA_TYPE_T))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal function to retrieve data type from buffer
|
||||
*/
|
||||
int orte_dss_get_data_type(orte_buffer_t *buffer, orte_data_type_t *type)
|
||||
{
|
||||
size_t required, n=1;
|
||||
int rc;
|
||||
orte_dss_type_info_t *info;
|
||||
orte_std_cntr_t n=1;
|
||||
|
||||
required = sizeof(orte_data_type_t);
|
||||
switch (required) {
|
||||
/* Lookup the unpack function for the actual orte_data_type type and call it */
|
||||
|
||||
case 1:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_byte(buffer, type, &n, ORTE_BYTE))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_int16(buffer, type, &n, ORTE_INT16))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_int32(buffer, type, &n, ORTE_INT32))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_int64(buffer, type, &n, ORTE_INT64))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
if (NULL == (info = orte_pointer_array_get_item(orte_dss_types, ORTE_DATA_TYPE_T))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_PACK_FAILURE);
|
||||
return ORTE_ERR_PACK_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
if (ORTE_SUCCESS != (rc = info->odti_unpack_fn(buffer, type, &n, ORTE_DATA_TYPE_T))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ int orte_dss_verbose = -1; /* by default disabled */
|
||||
int orte_dss_page_size;
|
||||
orte_pointer_array_t *orte_dss_types;
|
||||
orte_data_type_t orte_dss_num_reg_types;
|
||||
orte_dss_buffer_type_t default_buf_type;
|
||||
|
||||
OMPI_DECLSPEC orte_dss_t orte_dss = {
|
||||
orte_dss_set,
|
||||
@ -44,6 +45,7 @@ OMPI_DECLSPEC orte_dss_t orte_dss = {
|
||||
orte_dss_arith,
|
||||
orte_dss_increment,
|
||||
orte_dss_decrement,
|
||||
orte_dss_set_buffer_type,
|
||||
orte_dss_pack,
|
||||
orte_dss_unpack,
|
||||
orte_dss_copy,
|
||||
@ -55,7 +57,8 @@ OMPI_DECLSPEC orte_dss_t orte_dss = {
|
||||
orte_dss_unload,
|
||||
orte_dss_load,
|
||||
orte_dss_register,
|
||||
orte_dss_lookup_data_type
|
||||
orte_dss_lookup_data_type,
|
||||
orte_dss_dump_data_types
|
||||
};
|
||||
|
||||
/**
|
||||
@ -86,6 +89,9 @@ OBJ_CLASS_INSTANCE(
|
||||
|
||||
static void orte_buffer_construct (orte_buffer_t* buffer)
|
||||
{
|
||||
/** set the default buffer type */
|
||||
buffer->type = default_buf_type;
|
||||
|
||||
/* Make everything NULL to begin with */
|
||||
|
||||
buffer->base_ptr = buffer->pack_ptr = buffer->unpack_ptr = NULL;
|
||||
@ -149,6 +155,9 @@ int orte_dss_open(void)
|
||||
orte_dss_debug = false;
|
||||
}
|
||||
|
||||
/** set the default buffer type */
|
||||
default_buf_type = ORTE_DSS_BUFFER_FULLY_DESC;
|
||||
|
||||
/* setup the page size -this is for use by the BUFFER system, NOT the data type
|
||||
manager that keeps track of registered data types!! It must be converted to
|
||||
bytes since the buffer system will allocate a "page_size" at a time.
|
||||
@ -378,6 +387,19 @@ int orte_dss_open(void)
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
tmp = ORTE_STD_CNTR;
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_std_cntr,
|
||||
orte_dss_unpack_std_cntr,
|
||||
(orte_dss_copy_fn_t)orte_dss_std_copy,
|
||||
(orte_dss_compare_fn_t)orte_dss_compare_std_cntr,
|
||||
(orte_dss_size_fn_t)orte_dss_std_size,
|
||||
(orte_dss_print_fn_t)orte_dss_print_std_cntr,
|
||||
(orte_dss_release_fn_t)orte_dss_std_release,
|
||||
ORTE_DSS_UNSTRUCTURED,
|
||||
"ORTE_STD_CNTR", &tmp))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
tmp = ORTE_DATA_TYPE;
|
||||
if (ORTE_SUCCESS != (rc = orte_dss.register_type(orte_dss_pack_data_type,
|
||||
orte_dss_unpack_data_type,
|
||||
|
@ -23,13 +23,14 @@
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "opal/types.h"
|
||||
#include "opal/util/output.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
|
||||
#include "orte/dss/dss_internal.h"
|
||||
|
||||
int orte_dss_pack(orte_buffer_t *buffer, void *src, size_t num_vals,
|
||||
int orte_dss_pack(orte_buffer_t *buffer, void *src, orte_std_cntr_t num_vals,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
int rc;
|
||||
@ -41,11 +42,13 @@ int orte_dss_pack(orte_buffer_t *buffer, void *src, size_t num_vals,
|
||||
}
|
||||
|
||||
/* Pack the number of values */
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_store_data_type(buffer, ORTE_SIZE))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC == buffer->type) {
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_store_data_type(buffer, ORTE_STD_CNTR))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_pack_sizet(buffer, &num_vals, 1, ORTE_SIZE))) {
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_pack_std_cntr(buffer, &num_vals, 1, ORTE_STD_CNTR))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
@ -58,17 +61,20 @@ int orte_dss_pack(orte_buffer_t *buffer, void *src, size_t num_vals,
|
||||
return rc;
|
||||
}
|
||||
|
||||
int orte_dss_pack_buffer(orte_buffer_t *buffer, void *src, size_t num_vals,
|
||||
int orte_dss_pack_buffer(orte_buffer_t *buffer, void *src, orte_std_cntr_t num_vals,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
int rc;
|
||||
orte_dss_type_info_t *info;
|
||||
|
||||
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_pack_buffer( %p, %p, %lu, %d )\n", buffer, src, num_vals, (int)type ) );
|
||||
|
||||
/* Pack the declared data type */
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_pack_data_type(buffer, &type, 1, type))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC == buffer->type) {
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_store_data_type(buffer, type))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
/* Lookup the pack function for this type and call it */
|
||||
@ -92,7 +98,7 @@ int orte_dss_pack_buffer(orte_buffer_t *buffer, void *src, size_t num_vals,
|
||||
* BOOL
|
||||
*/
|
||||
int orte_dss_pack_bool(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -109,7 +115,7 @@ int orte_dss_pack_bool(orte_buffer_t *buffer, void *src,
|
||||
* INT
|
||||
*/
|
||||
int orte_dss_pack_int(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -126,7 +132,7 @@ int orte_dss_pack_int(orte_buffer_t *buffer, void *src,
|
||||
* SIZE_T
|
||||
*/
|
||||
int orte_dss_pack_sizet(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -143,7 +149,7 @@ int orte_dss_pack_sizet(orte_buffer_t *buffer, void *src,
|
||||
* PID_T
|
||||
*/
|
||||
int orte_dss_pack_pid(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -163,7 +169,7 @@ int orte_dss_pack_pid(orte_buffer_t *buffer, void *src,
|
||||
* NULL
|
||||
*/
|
||||
int orte_dss_pack_null(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type)
|
||||
{
|
||||
char null=0x00;
|
||||
char *dst;
|
||||
@ -191,7 +197,7 @@ int orte_dss_pack_null(orte_buffer_t *buffer, void *src,
|
||||
* BYTE, CHAR, INT8
|
||||
*/
|
||||
int orte_dss_pack_byte(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type)
|
||||
{
|
||||
char *dst;
|
||||
|
||||
@ -217,9 +223,9 @@ int orte_dss_pack_byte(orte_buffer_t *buffer, void *src,
|
||||
* INT16
|
||||
*/
|
||||
int orte_dss_pack_int16(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type)
|
||||
{
|
||||
size_t i;
|
||||
orte_std_cntr_t i;
|
||||
uint16_t tmp, *srctmp = (uint16_t*) src;
|
||||
char *dst;
|
||||
|
||||
@ -246,9 +252,9 @@ int orte_dss_pack_int16(orte_buffer_t *buffer, void *src,
|
||||
* INT32
|
||||
*/
|
||||
int orte_dss_pack_int32(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type)
|
||||
{
|
||||
size_t i;
|
||||
orte_std_cntr_t i;
|
||||
uint32_t tmp, *srctmp = (uint32_t*) src;
|
||||
char *dst;
|
||||
|
||||
@ -275,9 +281,9 @@ int orte_dss_pack_int32(orte_buffer_t *buffer, void *src,
|
||||
* INT64
|
||||
*/
|
||||
int orte_dss_pack_int64(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type)
|
||||
{
|
||||
size_t i;
|
||||
orte_std_cntr_t i;
|
||||
uint64_t tmp, *srctmp = (uint64_t*) src;
|
||||
char *dst;
|
||||
size_t bytes_packed = num_vals * sizeof(tmp);
|
||||
@ -305,10 +311,10 @@ int orte_dss_pack_int64(orte_buffer_t *buffer, void *src,
|
||||
* STRING
|
||||
*/
|
||||
int orte_dss_pack_string(orte_buffer_t *buffer, void *src,
|
||||
size_t num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t num_vals, orte_data_type_t type)
|
||||
{
|
||||
int ret = ORTE_SUCCESS;
|
||||
size_t i, len;
|
||||
orte_std_cntr_t i, len;
|
||||
char **ssrc = (char**) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
@ -337,62 +343,46 @@ int orte_dss_pack_string(orte_buffer_t *buffer, void *src,
|
||||
|
||||
/* PACK FUNCTIONS FOR GENERIC ORTE TYPES */
|
||||
|
||||
/*
|
||||
* ORTE_STD_CNTR
|
||||
*/
|
||||
int orte_dss_pack_std_cntr(orte_buffer_t *buffer, void *src, orte_std_cntr_t num_vals,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Turn around and pack the real type */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_pack_buffer(buffer, src, num_vals, ORTE_STD_CNTR_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* ORTE_DATA_TYPE
|
||||
*/
|
||||
int orte_dss_pack_data_type(orte_buffer_t *buffer, void *src, size_t num,
|
||||
int orte_dss_pack_data_type(orte_buffer_t *buffer, void *src, orte_std_cntr_t num_vals,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
size_t required;
|
||||
int rc;
|
||||
|
||||
required = sizeof(orte_data_type_t);
|
||||
switch (required) {
|
||||
|
||||
case 1:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_byte(buffer, src, num, ORTE_BYTE))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_int16(buffer, src, num, ORTE_INT16))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_int32(buffer, src, num, ORTE_INT32))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_int64(buffer, src, num, ORTE_INT64))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
int ret;
|
||||
|
||||
/* Turn around and pack the real type */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_pack_buffer(buffer, src, num_vals, ORTE_DATA_TYPE_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* ORTE_DATA_VALUE
|
||||
*/
|
||||
int orte_dss_pack_data_value(orte_buffer_t *buffer, void *src, size_t num, orte_data_type_t type)
|
||||
int orte_dss_pack_data_value(orte_buffer_t *buffer, void *src, orte_std_cntr_t num, orte_data_type_t type)
|
||||
{
|
||||
orte_dss_type_info_t *info;
|
||||
orte_data_value_t **sdv;
|
||||
size_t i;
|
||||
orte_std_cntr_t i;
|
||||
int ret;
|
||||
|
||||
sdv = (orte_data_value_t **) src;
|
||||
@ -430,59 +420,27 @@ int orte_dss_pack_data_value(orte_buffer_t *buffer, void *src, size_t num, orte_
|
||||
/*
|
||||
* ORTE_DAEMON_CMD
|
||||
*/
|
||||
int orte_dss_pack_daemon_cmd(orte_buffer_t *buffer, void *src, size_t num,
|
||||
int orte_dss_pack_daemon_cmd(orte_buffer_t *buffer, void *src, orte_std_cntr_t num_vals,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
size_t required;
|
||||
int rc;
|
||||
|
||||
required = sizeof(orte_daemon_cmd_flag_t);
|
||||
switch (required) {
|
||||
|
||||
case 1:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_byte(buffer, src, num, ORTE_BYTE))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_int16(buffer, src, num, ORTE_INT16))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_int32(buffer, src, num, ORTE_INT32))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_pack_int64(buffer, src, num, ORTE_INT64))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
int ret;
|
||||
|
||||
/* Turn around and pack the real type */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_pack_buffer(buffer, src, num_vals, ORTE_DAEMON_CMD_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* ORTE_BYTE_OBJECT
|
||||
*/
|
||||
int orte_dss_pack_byte_object(orte_buffer_t *buffer, void *src, size_t num,
|
||||
int orte_dss_pack_byte_object(orte_buffer_t *buffer, void *src, orte_std_cntr_t num,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
orte_byte_object_t **sbyteptr;
|
||||
size_t i, n;
|
||||
orte_std_cntr_t i, n;
|
||||
int ret;
|
||||
|
||||
sbyteptr = (orte_byte_object_t **) src;
|
||||
|
@ -24,11 +24,11 @@
|
||||
|
||||
|
||||
int orte_dss_peek(orte_buffer_t *buffer, orte_data_type_t *type,
|
||||
size_t *num_vals)
|
||||
orte_std_cntr_t *num_vals)
|
||||
{
|
||||
int ret;
|
||||
orte_buffer_t tmp;
|
||||
size_t n=1;
|
||||
orte_std_cntr_t n=1;
|
||||
orte_data_type_t local_type;
|
||||
|
||||
/* check for errors */
|
||||
@ -44,6 +44,16 @@ int orte_dss_peek(orte_buffer_t *buffer, orte_data_type_t *type,
|
||||
*num_vals = 0;
|
||||
return ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
|
||||
}
|
||||
|
||||
/* if this is NOT a fully described buffer, then that is as much as
|
||||
* we can do - there is no way we can tell the caller what type is
|
||||
* in the buffer since that info wasn't stored.
|
||||
*/
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC != buffer->type) {
|
||||
*type = ORTE_UNDEF;
|
||||
*num_vals = 0;
|
||||
return ORTE_ERR_UNKNOWN_DATA_TYPE;
|
||||
}
|
||||
|
||||
/* cheat: unpack from a copy of the buffer -- leaving all the
|
||||
original pointers intact */
|
||||
@ -55,13 +65,13 @@ int orte_dss_peek(orte_buffer_t *buffer, orte_data_type_t *type,
|
||||
*num_vals = 0;
|
||||
return ret;
|
||||
}
|
||||
if (ORTE_SIZE != local_type) { /* if the length wasn't first, then error */
|
||||
if (ORTE_STD_CNTR != local_type) { /* if the length wasn't first, then error */
|
||||
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_FAILURE);
|
||||
*type = ORTE_NULL;
|
||||
*num_vals = 0;
|
||||
return ORTE_ERR_UNPACK_FAILURE;
|
||||
}
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_sizet(&tmp, num_vals, &n, ORTE_SIZE))) {
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_std_cntr(&tmp, num_vals, &n, ORTE_STD_CNTR))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
*type = ORTE_NULL;
|
||||
*num_vals = 0;
|
||||
@ -87,6 +97,14 @@ int orte_dss_peek_type(orte_buffer_t *buffer, orte_data_type_t *type)
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
|
||||
/* if this is NOT a fully described buffer, then there isn't anything
|
||||
* we can do - there is no way we can tell the caller what type is
|
||||
* in the buffer since that info wasn't stored.
|
||||
*/
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC != buffer->type) {
|
||||
*type = ORTE_UNDEF;
|
||||
return ORTE_ERR_UNKNOWN_DATA_TYPE;
|
||||
}
|
||||
/* Double check and ensure that there is data left in the buffer. */
|
||||
|
||||
if (buffer->unpack_ptr >= buffer->base_ptr + buffer->bytes_used) {
|
||||
|
@ -363,6 +363,27 @@ int orte_dss_print_null(char **output, char *prefix, void *src, orte_data_type_t
|
||||
|
||||
|
||||
/* PRINT FUNCTIONS FOR GENERIC ORTE TYPES */
|
||||
/*
|
||||
* ORTE_STD_CNTR
|
||||
*/
|
||||
int orte_dss_print_std_cntr(char **output, char *prefix, orte_std_cntr_t *src, orte_data_type_t type)
|
||||
{
|
||||
char *prefx;
|
||||
|
||||
/* deal with NULL prefix */
|
||||
if (NULL == prefix) asprintf(&prefx, " ");
|
||||
else prefx = prefix;
|
||||
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: ORTE_STD_CNTR\tValue: NULL pointer", prefx);
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: ORTE_STD_CNTR\tValue: %lu", prefx, (unsigned long) *src);
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* ORTE_DATA_TYPE
|
||||
*/
|
||||
|
@ -38,7 +38,7 @@ int orte_dss_register(orte_dss_pack_fn_t pack_fn,
|
||||
{
|
||||
int ret;
|
||||
orte_dss_type_info_t *info, **ptr;
|
||||
size_t i;
|
||||
orte_std_cntr_t i;
|
||||
orte_data_type_t j;
|
||||
|
||||
/* Check for bozo cases */
|
||||
@ -79,6 +79,7 @@ int orte_dss_register(orte_dss_pack_fn_t pack_fn,
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
info->odti_type = *type;
|
||||
info->odti_name = strdup(name);
|
||||
info->odti_pack_fn = pack_fn;
|
||||
info->odti_unpack_fn = unpack_fn;
|
||||
|
50
orte/dss/dss_set_buffer_type.c
Обычный файл
50
orte/dss/dss_set_buffer_type.c
Обычный файл
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#if HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "opal/util/output.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
|
||||
#include "orte/dss/dss.h"
|
||||
#include "orte/dss/dss_internal.h"
|
||||
|
||||
int orte_dss_set_buffer_type(orte_buffer_t *buffer, orte_dss_buffer_type_t type)
|
||||
{
|
||||
/** check for error */
|
||||
if (NULL == buffer) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
|
||||
/** see if the buffer is empty - if not, generate error */
|
||||
if (buffer->base_ptr == buffer->pack_ptr) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BUFFER);
|
||||
return ORTE_ERR_BUFFER;
|
||||
}
|
||||
|
||||
/** set the type */
|
||||
buffer->type = type;
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -99,6 +99,10 @@ int orte_dss_std_size(size_t *size, void *src, orte_data_type_t type)
|
||||
*size = sizeof(uint64_t);
|
||||
break;
|
||||
|
||||
case ORTE_STD_CNTR:
|
||||
*size = sizeof(orte_std_cntr_t);
|
||||
break;
|
||||
|
||||
case ORTE_DATA_TYPE:
|
||||
*size = sizeof(orte_data_type_t);
|
||||
break;
|
||||
|
@ -57,14 +57,22 @@ OBJ_CLASS_DECLARATION(orte_data_value_t);
|
||||
#define ORTE_DSS_STRUCTURED true
|
||||
#define ORTE_DSS_UNSTRUCTURED false
|
||||
|
||||
/**
|
||||
/**
|
||||
* buffer type
|
||||
*/
|
||||
typedef uint8_t orte_dss_buffer_type_t;
|
||||
#define ORTE_DSS_BUFFER_FULLY_DESC 0x01
|
||||
#define ORTE_DSS_BUFFER_NON_DESC 0x02
|
||||
|
||||
/**
|
||||
* Structure for holding a buffer to be used with the RML or OOB
|
||||
* subsystems.
|
||||
*/
|
||||
struct orte_buffer_t {
|
||||
/** First member must be the object's parent */
|
||||
opal_object_t parent;
|
||||
|
||||
/** type of buffer */
|
||||
orte_dss_buffer_type_t type;
|
||||
/** Start of my memory */
|
||||
char *base_ptr;
|
||||
/** Where the next data will be packed to (within the allocated
|
||||
|
@ -24,13 +24,13 @@
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "opal/types.h"
|
||||
#include "opal/util/output.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
|
||||
#include "orte/dss/dss_internal.h"
|
||||
|
||||
|
||||
#define UNPACK_SIZE_MISMATCH(unpack_type, remote_type, ret) \
|
||||
do { \
|
||||
switch(remote_type) { \
|
||||
@ -69,7 +69,7 @@
|
||||
data in tmpbuf[] is already in host byte order. */
|
||||
#define UNPACK_SIZE_MISMATCH_FOUND(unpack_type, tmptype, tmpdsstype) \
|
||||
do { \
|
||||
size_t i; \
|
||||
orte_std_cntr_t i; \
|
||||
tmptype *tmpbuf = malloc(sizeof(tmptype) * *num_vals); \
|
||||
ret = orte_dss_unpack_buffer(buffer, tmpbuf, num_vals, tmpdsstype); \
|
||||
for (i = 0 ; i < *num_vals ; ++i) { \
|
||||
@ -79,11 +79,11 @@
|
||||
} while (0)
|
||||
|
||||
|
||||
int orte_dss_unpack(orte_buffer_t *buffer, void *dst, size_t *num_vals,
|
||||
int orte_dss_unpack(orte_buffer_t *buffer, void *dst, orte_std_cntr_t *num_vals,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
int ret=ORTE_SUCCESS, rc=ORTE_SUCCESS;
|
||||
size_t local_num, n=1;
|
||||
orte_std_cntr_t local_num, n=1;
|
||||
orte_data_type_t local_type;
|
||||
|
||||
/* check for error */
|
||||
@ -100,34 +100,38 @@ int orte_dss_unpack(orte_buffer_t *buffer, void *dst, size_t *num_vals,
|
||||
return ORTE_ERR_UNPACK_INADEQUATE_SPACE;
|
||||
}
|
||||
|
||||
/* Unpack the declared number of values
|
||||
/** Unpack the declared number of values
|
||||
* REMINDER: it is possible that the buffer is corrupted and that
|
||||
* the DSS will *think* there is a proper size_t variable at the
|
||||
* the DSS will *think* there is a proper orte_std_cntr_t variable at the
|
||||
* beginning of the unpack region - but that the value is bogus (e.g., just
|
||||
* a byte field in a string array that so happens to have a value that
|
||||
* matches the size_t data type flag). Therefore, this error check is
|
||||
* matches the orte_std_cntr_t data type flag). Therefore, this error check is
|
||||
* NOT completely safe. This is true for ALL unpack functions, not just
|
||||
* size_t as used here.
|
||||
* orte_std_cntr_t as used here.
|
||||
*/
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_get_data_type(buffer, &local_type))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
*num_vals = 0;
|
||||
return rc;
|
||||
}
|
||||
if (ORTE_SIZE != local_type) { /* if the length wasn't first, then error */
|
||||
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_FAILURE);
|
||||
*num_vals = 0;
|
||||
return ORTE_ERR_UNPACK_FAILURE;
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC == buffer->type) {
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_get_data_type(buffer, &local_type))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
*num_vals = 0;
|
||||
return rc;
|
||||
}
|
||||
if (ORTE_STD_CNTR != local_type) { /* if the length wasn't first, then error */
|
||||
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_FAILURE);
|
||||
*num_vals = 0;
|
||||
return ORTE_ERR_UNPACK_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
n=1;
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_sizet(buffer, &local_num, &n, ORTE_SIZE))) {
|
||||
rc = orte_dss_unpack_std_cntr(buffer, &local_num, &n, ORTE_STD_CNTR))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
*num_vals = 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* if the storage provided is inadequate, set things up
|
||||
/** if the storage provided is inadequate, set things up
|
||||
* to unpack as much as we can and to return an error code
|
||||
* indicating that everything was not unpacked - the buffer
|
||||
* is left in a state where it can not be further unpacked.
|
||||
@ -136,11 +140,11 @@ int orte_dss_unpack(orte_buffer_t *buffer, void *dst, size_t *num_vals,
|
||||
ORTE_ERROR_LOG(ORTE_ERR_UNPACK_INADEQUATE_SPACE);
|
||||
local_num = *num_vals;
|
||||
ret = ORTE_ERR_UNPACK_INADEQUATE_SPACE;
|
||||
} else if (local_num < *num_vals) { /* more than enough storage */
|
||||
*num_vals = local_num; /* let the user know how many we actually unpacked */
|
||||
} else if (local_num < *num_vals) { /** more than enough storage */
|
||||
*num_vals = local_num; /** let the user know how many we actually unpacked */
|
||||
}
|
||||
|
||||
/* Unpack the value(s) */
|
||||
/** Unpack the value(s) */
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dst, &local_num, type))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
*num_vals = 0;
|
||||
@ -153,23 +157,27 @@ int orte_dss_unpack(orte_buffer_t *buffer, void *dst, size_t *num_vals,
|
||||
return rc;
|
||||
}
|
||||
|
||||
int orte_dss_unpack_buffer(orte_buffer_t *buffer, void *dst, size_t *num_vals,
|
||||
int orte_dss_unpack_buffer(orte_buffer_t *buffer, void *dst, orte_std_cntr_t *num_vals,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
int rc;
|
||||
orte_data_type_t local_type;
|
||||
orte_dss_type_info_t *info;
|
||||
orte_std_cntr_t n=1;
|
||||
|
||||
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_buffer( %p, %p, %lu, %d )\n", buffer, dst, *num_vals, (int)type ) );
|
||||
/* Unpack the declared data type */
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_get_data_type(buffer, &local_type))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
/* if the data types don't match, then return an error */
|
||||
if (type != local_type) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_PACK_MISMATCH);
|
||||
return ORTE_ERR_PACK_MISMATCH;
|
||||
|
||||
/** Unpack the declared data type */
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC == buffer->type) {
|
||||
if (ORTE_SUCCESS != (rc = orte_dss_get_data_type(buffer, &local_type))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
/* if the data types don't match, then return an error */
|
||||
if (type != local_type) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_PACK_MISMATCH);
|
||||
return ORTE_ERR_PACK_MISMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
/* Lookup the unpack function for this type and call it */
|
||||
@ -193,27 +201,40 @@ int orte_dss_unpack_buffer(orte_buffer_t *buffer, void *dst, size_t *num_vals,
|
||||
* BOOL
|
||||
*/
|
||||
int orte_dss_unpack_bool(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
orte_data_type_t remote_type;
|
||||
|
||||
/* see what type was actually packed */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
/* if the buffer is fully described, then we can do some magic to handle
|
||||
* the heterogeneous case. if not, then we can only shoot blind - it is the
|
||||
* user's responsibility to ensure we are in a homogeneous environment.
|
||||
*/
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC == buffer->type) {
|
||||
/* see what type was actually packed */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (remote_type == DSS_TYPE_BOOL) {
|
||||
/* fast path it if the sizes are the same */
|
||||
/* Turn around and unpack the real type */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_BOOL))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(bool, remote_type, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (remote_type == DSS_TYPE_BOOL) {
|
||||
/* fast path it if the sizes are the same */
|
||||
/* Turn around and unpack the real type */
|
||||
if (ORTE_SUCCESS != (
|
||||
ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_BOOL))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(bool, remote_type, ret);
|
||||
/* if we get here, then this buffer is NOT fully described. just unpack it
|
||||
* using the local size - user gets the pain if it's wrong
|
||||
*/
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_BOOL))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -223,29 +244,42 @@ int orte_dss_unpack_bool(orte_buffer_t *buffer, void *dest,
|
||||
* INT
|
||||
*/
|
||||
int orte_dss_unpack_int(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
orte_data_type_t remote_type;
|
||||
|
||||
/* see what type was actually packed */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
/* if the buffer is fully described, then we can do some magic to handle
|
||||
* the heterogeneous case. if not, then we can only shoot blind - it is the
|
||||
* user's responsibility to ensure we are in a homogeneous environment.
|
||||
*/
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC == buffer->type) {
|
||||
/* see what type was actually packed */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (remote_type == DSS_TYPE_INT) {
|
||||
/* fast path it if the sizes are the same */
|
||||
/* Turn around and unpack the real type */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_INT))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(int, remote_type, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (remote_type == DSS_TYPE_INT) {
|
||||
/* fast path it if the sizes are the same */
|
||||
/* Turn around and unpack the real type */
|
||||
if (ORTE_SUCCESS != (
|
||||
ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_INT))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(int, remote_type, ret);
|
||||
/* if we get here, then this buffer is NOT fully described. just unpack it
|
||||
* using the local size - user gets the pain if it's wrong
|
||||
*/
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_INT))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -253,29 +287,42 @@ int orte_dss_unpack_int(orte_buffer_t *buffer, void *dest,
|
||||
* SIZE_T
|
||||
*/
|
||||
int orte_dss_unpack_sizet(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
orte_data_type_t remote_type;
|
||||
|
||||
/* see what type was actually packed */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
/* if the buffer is fully described, then we can do some magic to handle
|
||||
* the heterogeneous case. if not, then we can only shoot blind - it is the
|
||||
* user's responsibility to ensure we are in a homogeneous environment.
|
||||
*/
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC == buffer->type) {
|
||||
/* see what type was actually packed */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (remote_type == DSS_TYPE_SIZE_T) {
|
||||
/* fast path it if the sizes are the same */
|
||||
/* Turn around and unpack the real type */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_SIZE_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(size_t, remote_type, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (remote_type == DSS_TYPE_SIZE_T) {
|
||||
/* fast path it if the sizes are the same */
|
||||
/* Turn around and unpack the real type */
|
||||
if (ORTE_SUCCESS != (
|
||||
ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_SIZE_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(size_t, remote_type, ret);
|
||||
/* if we get here, then this buffer is NOT fully described. just unpack it
|
||||
* using the local size - user gets the pain if it's wrong
|
||||
*/
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_SIZE_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -283,29 +330,42 @@ int orte_dss_unpack_sizet(orte_buffer_t *buffer, void *dest,
|
||||
* PID_T
|
||||
*/
|
||||
int orte_dss_unpack_pid(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
orte_data_type_t remote_type;
|
||||
|
||||
/* see what type was actually packed */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
/* if the buffer is fully described, then we can do some magic to handle
|
||||
* the heterogeneous case. if not, then we can only shoot blind - it is the
|
||||
* user's responsibility to ensure we are in a homogeneous environment.
|
||||
*/
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC == buffer->type) {
|
||||
/* see what type was actually packed */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (remote_type == DSS_TYPE_PID_T) {
|
||||
/* fast path it if the sizes are the same */
|
||||
/* Turn around and unpack the real type */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_PID_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(pid_t, remote_type, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (remote_type == DSS_TYPE_PID_T) {
|
||||
/* fast path it if the sizes are the same */
|
||||
/* Turn around and unpack the real type */
|
||||
if (ORTE_SUCCESS != (
|
||||
ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_PID_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(pid_t, remote_type, ret);
|
||||
/* if we get here, then this buffer is NOT fully described. just unpack it
|
||||
* using the local size - user gets the pain if it's wrong
|
||||
*/
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_PID_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -316,7 +376,7 @@ int orte_dss_unpack_pid(orte_buffer_t *buffer, void *dest,
|
||||
* NULL
|
||||
*/
|
||||
int orte_dss_unpack_null(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type)
|
||||
{
|
||||
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_null * %d\n", (int)*num_vals ) );
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -338,7 +398,7 @@ int orte_dss_unpack_null(orte_buffer_t *buffer, void *dest,
|
||||
* BYTE, CHAR, INT8
|
||||
*/
|
||||
int orte_dss_unpack_byte(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type)
|
||||
{
|
||||
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_byte * %d\n", (int)*num_vals ) );
|
||||
/* check to see if there's enough data in buffer */
|
||||
@ -357,9 +417,9 @@ int orte_dss_unpack_byte(orte_buffer_t *buffer, void *dest,
|
||||
}
|
||||
|
||||
int orte_dss_unpack_int16(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type)
|
||||
{
|
||||
size_t i;
|
||||
orte_std_cntr_t i;
|
||||
uint16_t tmp, *desttmp = (uint16_t*) dest;
|
||||
|
||||
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_int16 * %d\n", (int)*num_vals ) );
|
||||
@ -380,9 +440,9 @@ int orte_dss_unpack_int16(orte_buffer_t *buffer, void *dest,
|
||||
}
|
||||
|
||||
int orte_dss_unpack_int32(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type)
|
||||
{
|
||||
size_t i;
|
||||
orte_std_cntr_t i;
|
||||
uint32_t tmp, *desttmp = (uint32_t*) dest;
|
||||
|
||||
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_int32 * %d\n", (int)*num_vals ) );
|
||||
@ -403,9 +463,9 @@ int orte_dss_unpack_int32(orte_buffer_t *buffer, void *dest,
|
||||
}
|
||||
|
||||
int orte_dss_unpack_int64(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type)
|
||||
{
|
||||
size_t i;
|
||||
orte_std_cntr_t i;
|
||||
uint64_t tmp, *desttmp = (uint64_t*) dest;
|
||||
|
||||
OPAL_OUTPUT( ( orte_dss_verbose, "orte_dss_unpack_int64 * %d\n", (int)*num_vals ) );
|
||||
@ -426,10 +486,10 @@ int orte_dss_unpack_int64(orte_buffer_t *buffer, void *dest,
|
||||
}
|
||||
|
||||
int orte_dss_unpack_string(orte_buffer_t *buffer, void *dest,
|
||||
size_t *num_vals, orte_data_type_t type)
|
||||
orte_std_cntr_t *num_vals, orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
size_t i, len, n=1;
|
||||
orte_std_cntr_t i, len, n=1;
|
||||
char **sdest = (char**) dest;
|
||||
|
||||
for (i = 0; i < (*num_vals); ++i) {
|
||||
@ -458,111 +518,145 @@ int orte_dss_unpack_string(orte_buffer_t *buffer, void *dest,
|
||||
|
||||
/* UNPACK FUNCTIONS FOR GENERIC ORTE TYPES */
|
||||
|
||||
/*
|
||||
* ORTE_STD_CNTR
|
||||
*/
|
||||
int orte_dss_unpack_std_cntr(orte_buffer_t *buffer, void *dest, orte_std_cntr_t *num_vals,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
orte_data_type_t remote_type;
|
||||
|
||||
/* if the buffer is fully described, then we can do some magic to handle
|
||||
* the heterogeneous case. if not, then we can only shoot blind - it is the
|
||||
* user's responsibility to ensure we are in a homogeneous environment.
|
||||
*/
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC == buffer->type) {
|
||||
/* see what type was actually packed */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (remote_type == ORTE_STD_CNTR_T) {
|
||||
/* fast path it if the sizes are the same */
|
||||
/* Turn around and unpack the real type */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_STD_CNTR_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(orte_std_cntr_t, remote_type, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* if we get here, then this buffer is NOT fully described. just unpack it
|
||||
* using the local size - user gets the pain if it's wrong
|
||||
*/
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_STD_CNTR_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* ORTE_DATA_TYPE
|
||||
*/
|
||||
int orte_dss_unpack_data_type(orte_buffer_t *buffer, void *dest, size_t *num,
|
||||
int orte_dss_unpack_data_type(orte_buffer_t *buffer, void *dest, orte_std_cntr_t *num_vals,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
size_t required;
|
||||
int rc;
|
||||
|
||||
required = sizeof(orte_data_type_t);
|
||||
switch (required) {
|
||||
|
||||
case 1:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_byte(buffer, dest, num, ORTE_BYTE))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
int ret;
|
||||
orte_data_type_t remote_type;
|
||||
|
||||
/* if the buffer is fully described, then we can do some magic to handle
|
||||
* the heterogeneous case. if not, then we can only shoot blind - it is the
|
||||
* user's responsibility to ensure we are in a homogeneous environment.
|
||||
*/
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC == buffer->type) {
|
||||
/* see what type was actually packed */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (remote_type == ORTE_DATA_TYPE_T) {
|
||||
/* fast path it if the sizes are the same */
|
||||
/* Turn around and unpack the real type */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_DATA_TYPE_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_int16(buffer, dest, num, ORTE_INT16))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_int32(buffer, dest, num, ORTE_INT32))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_int64(buffer, dest, num, ORTE_INT64))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(orte_data_type_t, remote_type, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
/* if we get here, then this buffer is NOT fully described. just unpack it
|
||||
* using the local size - user gets the pain if it's wrong
|
||||
*/
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_DATA_TYPE_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* ORTE_DAEMON_CMD
|
||||
*/
|
||||
int orte_dss_unpack_daemon_cmd(orte_buffer_t *buffer, void *dest, size_t *num,
|
||||
int orte_dss_unpack_daemon_cmd(orte_buffer_t *buffer, void *dest, orte_std_cntr_t *num_vals,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
size_t required;
|
||||
int rc;
|
||||
|
||||
required = sizeof(orte_daemon_cmd_flag_t);
|
||||
switch (required) {
|
||||
|
||||
case 1:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_byte(buffer, dest, num, ORTE_BYTE))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
int ret;
|
||||
orte_data_type_t remote_type;
|
||||
|
||||
/* if the buffer is fully described, then we can do some magic to handle
|
||||
* the heterogeneous case. if not, then we can only shoot blind - it is the
|
||||
* user's responsibility to ensure we are in a homogeneous environment.
|
||||
*/
|
||||
if (ORTE_DSS_BUFFER_FULLY_DESC == buffer->type) {
|
||||
/* see what type was actually packed */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_peek_type(buffer, &remote_type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (remote_type == ORTE_DAEMON_CMD_T) {
|
||||
/* fast path it if the sizes are the same */
|
||||
/* Turn around and unpack the real type */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_DAEMON_CMD_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_int16(buffer, dest, num, ORTE_INT16))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_int32(buffer, dest, num, ORTE_INT32))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if (ORTE_SUCCESS != (
|
||||
rc = orte_dss_unpack_int64(buffer, dest, num, ORTE_INT64))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
} else {
|
||||
/* slow path - types are different sizes */
|
||||
UNPACK_SIZE_MISMATCH(orte_daemon_cmd_flag_t, remote_type, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
/* if we get here, then this buffer is NOT fully described. just unpack it
|
||||
* using the local size - user gets the pain if it's wrong
|
||||
*/
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_DAEMON_CMD_T))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* ORTE_DATA_VALUE
|
||||
*/
|
||||
int orte_dss_unpack_data_value(orte_buffer_t *buffer, void *dest, size_t *num,
|
||||
int orte_dss_unpack_data_value(orte_buffer_t *buffer, void *dest, orte_std_cntr_t *num,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
orte_dss_type_info_t *info;
|
||||
orte_data_value_t **ddv;
|
||||
size_t i, n;
|
||||
orte_std_cntr_t i, n;
|
||||
size_t nsize;
|
||||
int ret;
|
||||
|
||||
ddv = (orte_data_value_t **) dest;
|
||||
@ -575,17 +669,18 @@ int orte_dss_unpack_data_value(orte_buffer_t *buffer, void *dest, size_t *num,
|
||||
}
|
||||
|
||||
/* see what the data type is */
|
||||
n = 1;
|
||||
if (ORTE_SUCCESS != (ret = orte_dss_get_data_type(buffer, &(ddv[i]->type)))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* get enough memory to hold it */
|
||||
if (ORTE_SUCCESS != (ret = orte_dss.size(&n, NULL, ddv[i]->type))) {
|
||||
if (ORTE_SUCCESS != (ret = orte_dss.size(&nsize, NULL, ddv[i]->type))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
ddv[i]->data = (void*)malloc(n);
|
||||
ddv[i]->data = (void*)malloc(nsize);
|
||||
if (NULL == ddv[i]->data) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
@ -620,11 +715,11 @@ int orte_dss_unpack_data_value(orte_buffer_t *buffer, void *dest, size_t *num,
|
||||
/*
|
||||
* ORTE_BYTE_OBJECT
|
||||
*/
|
||||
int orte_dss_unpack_byte_object(orte_buffer_t *buffer, void *dest, size_t *num,
|
||||
int orte_dss_unpack_byte_object(orte_buffer_t *buffer, void *dest, orte_std_cntr_t *num,
|
||||
orte_data_type_t type)
|
||||
{
|
||||
int ret;
|
||||
size_t i, n, m=1;
|
||||
orte_std_cntr_t i, n, m=1;
|
||||
orte_byte_object_t **dbyteptr;
|
||||
|
||||
dbyteptr = (orte_byte_object_t**)dest;
|
||||
|
@ -30,8 +30,36 @@
|
||||
* Supported datatypes for messaging and storage operations.
|
||||
*/
|
||||
|
||||
typedef uint8_t orte_data_type_t ;
|
||||
#define ORTE_DSS_ID_MAX UINT8_MAX
|
||||
typedef uint8_t orte_data_type_t; /** data type indicators used in ORTE */
|
||||
#define ORTE_DATA_TYPE_T ORTE_UINT8
|
||||
#define ORTE_DSS_ID_MAX UINT8_MAX
|
||||
#define ORTE_DSS_ID_INVALID ORTE_DSS_ID_MAX
|
||||
|
||||
typedef size_t orte_std_cntr_t; /** standard counters used in ORTE */
|
||||
#define ORTE_STD_CNTR_T ORTE_SIZE
|
||||
#define ORTE_STD_CNTR_MAX SIZE_MAX
|
||||
#define ORTE_STD_CNTR_INVALID -1
|
||||
|
||||
/* define a structure to hold generic byte objects */
|
||||
typedef struct {
|
||||
orte_std_cntr_t size;
|
||||
uint8_t *bytes;
|
||||
} orte_byte_object_t;
|
||||
|
||||
/* define the orted command flag type */
|
||||
typedef uint16_t orte_daemon_cmd_flag_t;
|
||||
#define ORTE_DAEMON_CMD_T ORTE_UINT16
|
||||
|
||||
/**
|
||||
* handle differences in iovec
|
||||
*/
|
||||
|
||||
#if defined(__APPLE__) || defined(__WINDOWS__)
|
||||
typedef char* orte_iov_base_ptr_t;
|
||||
#else
|
||||
typedef void* orte_iov_base_ptr_t;
|
||||
#endif
|
||||
|
||||
|
||||
#define ORTE_UNDEF (orte_data_type_t) 0 /**< type hasn't been defined yet */
|
||||
#define ORTE_BYTE (orte_data_type_t) 1 /**< a byte of data */
|
||||
@ -53,7 +81,7 @@ typedef uint8_t orte_data_type_t ;
|
||||
#define ORTE_UINT64 (orte_data_type_t) 15 /**< a 64-bit unsigned integer */
|
||||
|
||||
/* we don't support floating point types */
|
||||
|
||||
|
||||
/* orte-specific typedefs - grouped according to the subystem that handles
|
||||
* their packing/unpacking */
|
||||
/* General types - packing/unpacking handled within DSS */
|
||||
@ -61,48 +89,48 @@ typedef uint8_t orte_data_type_t ;
|
||||
#define ORTE_DATA_TYPE (orte_data_type_t) 17 /**< data type */
|
||||
#define ORTE_NULL (orte_data_type_t) 18 /**< don't interpret data type */
|
||||
#define ORTE_DATA_VALUE (orte_data_type_t) 19 /**< data value */
|
||||
#define ORTE_ARITH_OP (orte_data_type_t) 20 /**< arithmetic operation flag */
|
||||
#define ORTE_STD_CNTR (orte_data_type_t) 21 /**< standard counter type */
|
||||
/* Name Service types */
|
||||
#define ORTE_NAME (orte_data_type_t) 20 /**< an ompi_process_name_t */
|
||||
#define ORTE_VPID (orte_data_type_t) 21 /**< a vpid */
|
||||
#define ORTE_JOBID (orte_data_type_t) 22 /**< a jobid */
|
||||
#define ORTE_JOBGRP (orte_data_type_t) 23 /**< a job group */
|
||||
#define ORTE_CELLID (orte_data_type_t) 24 /**< a cellid */
|
||||
/* SOH types */
|
||||
#define ORTE_NODE_STATE (orte_data_type_t) 25 /**< node status flag */
|
||||
#define ORTE_PROC_STATE (orte_data_type_t) 26 /**< process/resource status */
|
||||
#define ORTE_JOB_STATE (orte_data_type_t) 27 /**< job status flag */
|
||||
#define ORTE_EXIT_CODE (orte_data_type_t) 28 /**< process exit code */
|
||||
#define ORTE_NAME (orte_data_type_t) 22 /**< an orte_process_name_t */
|
||||
#define ORTE_VPID (orte_data_type_t) 23 /**< a vpid */
|
||||
#define ORTE_JOBID (orte_data_type_t) 24 /**< a jobid */
|
||||
#define ORTE_PSET (orte_data_type_t) 25 /**< a process set */
|
||||
#define ORTE_CELLID (orte_data_type_t) 26 /**< a cellid */
|
||||
#define ORTE_NODEID (orte_data_type_t) 27 /**< a node id */
|
||||
/* SMR types */
|
||||
#define ORTE_NODE_STATE (orte_data_type_t) 28 /**< node status flag */
|
||||
#define ORTE_PROC_STATE (orte_data_type_t) 29 /**< process/resource status */
|
||||
#define ORTE_PSET_STATE (orte_data_type_t) 30 /**< process set state */
|
||||
#define ORTE_JOB_STATE (orte_data_type_t) 31 /**< job status flag */
|
||||
#define ORTE_EXIT_CODE (orte_data_type_t) 32 /**< process exit code */
|
||||
/* GPR types */
|
||||
#define ORTE_GPR_KEYVAL (orte_data_type_t) 29 /**< registry key-value pair */
|
||||
#define ORTE_GPR_NOTIFY_ACTION (orte_data_type_t) 30 /**< registry notify action */
|
||||
#define ORTE_GPR_TRIGGER_ACTION (orte_data_type_t) 31 /**< registry trigger action */
|
||||
#define ORTE_GPR_CMD (orte_data_type_t) 32 /**< registry command */
|
||||
#define ORTE_GPR_SUBSCRIPTION_ID (orte_data_type_t) 33 /**< registry notify id tag */
|
||||
#define ORTE_GPR_TRIGGER_ID (orte_data_type_t) 34 /**< registry notify id tag */
|
||||
#define ORTE_GPR_VALUE (orte_data_type_t) 35 /**< registry return value */
|
||||
#define ORTE_GPR_ADDR_MODE (orte_data_type_t) 36 /**< Addressing mode for registry cmds */
|
||||
#define ORTE_GPR_SUBSCRIPTION (orte_data_type_t) 37 /**< describes data returned by subscription */
|
||||
#define ORTE_GPR_TRIGGER (orte_data_type_t) 38 /**< describes trigger conditions */
|
||||
#define ORTE_GPR_NOTIFY_DATA (orte_data_type_t) 39 /**< data returned from a subscription */
|
||||
#define ORTE_GPR_NOTIFY_MSG (orte_data_type_t) 40 /**< notify message containing notify_data objects */
|
||||
#define ORTE_GPR_NOTIFY_MSG_TYPE (orte_data_type_t) 41 /**< notify message type (subscription or trigger) */
|
||||
/* Resource Manager types */
|
||||
#define ORTE_APP_CONTEXT (orte_data_type_t) 42 /**< argv and enviro arrays */
|
||||
#define ORTE_APP_CONTEXT_MAP (orte_data_type_t) 43 /**< application context mapping array */
|
||||
#define ORTE_RAS_NODE (orte_data_type_t) 44 /**< node information */
|
||||
#define ORTE_GPR_KEYVAL (orte_data_type_t) 33 /**< registry key-value pair */
|
||||
#define ORTE_GPR_NOTIFY_ACTION (orte_data_type_t) 34 /**< registry notify action */
|
||||
#define ORTE_GPR_TRIGGER_ACTION (orte_data_type_t) 35 /**< registry trigger action */
|
||||
#define ORTE_GPR_CMD (orte_data_type_t) 36 /**< registry command */
|
||||
#define ORTE_GPR_SUBSCRIPTION_ID (orte_data_type_t) 37 /**< registry notify id tag */
|
||||
#define ORTE_GPR_TRIGGER_ID (orte_data_type_t) 38 /**< registry notify id tag */
|
||||
#define ORTE_GPR_VALUE (orte_data_type_t) 39 /**< registry return value */
|
||||
#define ORTE_GPR_ADDR_MODE (orte_data_type_t) 40 /**< Addressing mode for registry cmds */
|
||||
#define ORTE_GPR_SUBSCRIPTION (orte_data_type_t) 41 /**< describes data returned by subscription */
|
||||
#define ORTE_GPR_TRIGGER (orte_data_type_t) 42 /**< describes trigger conditions */
|
||||
#define ORTE_GPR_NOTIFY_DATA (orte_data_type_t) 43 /**< data returned from a subscription */
|
||||
#define ORTE_GPR_NOTIFY_MSG (orte_data_type_t) 44 /**< notify message containing notify_data objects */
|
||||
#define ORTE_GPR_NOTIFY_MSG_TYPE (orte_data_type_t) 45 /**< notify message type (subscription or trigger) */
|
||||
#define ORTE_GPR_SEARCH (orte_data_type_t) 46 /**< search criteria */
|
||||
#define ORTE_GPR_UPDATE (orte_data_type_t) 47 /**< update data on the registry */
|
||||
/* Resource Manager types */
|
||||
#define ORTE_APP_CONTEXT (orte_data_type_t) 48 /**< argv and enviro arrays */
|
||||
#define ORTE_APP_CONTEXT_MAP (orte_data_type_t) 49 /**< application context mapping array */
|
||||
#define ORTE_NODE_DESC (orte_data_type_t) 50 /**< describes capabilities of nodes */
|
||||
#define ORTE_CELL_DESC (orte_data_type_t) 51 /**< describe attributes of cells */
|
||||
#define ORTE_SLOT_DESC (orte_data_type_t) 52 /**< describes slot allocations/reservations */
|
||||
#define ORTE_RAS_NODE (orte_data_type_t) 53 /**< node information */
|
||||
/* DAEMON communication type */
|
||||
#define ORTE_DAEMON_CMD (orte_data_type_t) 45 /**< command flag for communicating with the daemon */
|
||||
#define ORTE_DAEMON_CMD (orte_data_type_t) 54 /**< command flag for communicating with the daemon */
|
||||
|
||||
/* define the starting point for dynamically assigning data types */
|
||||
#define ORTE_DSS_ID_DYNAMIC 60
|
||||
|
||||
/* define a structure to hold generic byte objects */
|
||||
typedef struct {
|
||||
size_t size;
|
||||
uint8_t *bytes;
|
||||
} orte_byte_object_t;
|
||||
|
||||
/* define the orted command flag type */
|
||||
typedef uint16_t orte_daemon_cmd_flag_t;
|
||||
|
||||
#endif
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user