Add array types to opal_value_t
This commit was SVN r32656.
Этот коммит содержится в:
родитель
9500939042
Коммит
d13fb37ef9
@ -816,6 +816,294 @@ int opal_dss_pack_value(opal_buffer_t *buffer, const void *src,
|
||||
case OPAL_PTR:
|
||||
/* just ignore these values */
|
||||
break;
|
||||
case OPAL_FLOAT_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.fval_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.fval_array.data,
|
||||
ptr[i]->data.fval_array.size,
|
||||
OPAL_FLOAT))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_DOUBLE_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.dval_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.dval_array.data,
|
||||
ptr[i]->data.dval_array.size,
|
||||
OPAL_DOUBLE))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_STRING_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.string_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.string_array.data,
|
||||
ptr[i]->data.string_array.size,
|
||||
OPAL_STRING))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_BOOL_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.flag_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.flag_array.data,
|
||||
ptr[i]->data.flag_array.size,
|
||||
OPAL_BOOL))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_SIZE_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.size_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.size_array.data,
|
||||
ptr[i]->data.size_array.size,
|
||||
OPAL_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_BYTE_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.byte_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.byte_array.data,
|
||||
ptr[i]->data.byte_array.size,
|
||||
OPAL_BYTE))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.integer_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.integer_array.data,
|
||||
ptr[i]->data.integer_array.size,
|
||||
OPAL_INT))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT8_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.int8_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.int8_array.data,
|
||||
ptr[i]->data.int8_array.size,
|
||||
OPAL_INT8))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT16_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.int16_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.int16_array.data,
|
||||
ptr[i]->data.int16_array.size,
|
||||
OPAL_INT16))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT32_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.int32_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.int32_array.data,
|
||||
ptr[i]->data.int32_array.size,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT64_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.int64_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.int64_array.data,
|
||||
ptr[i]->data.int64_array.size,
|
||||
OPAL_INT64))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.uint_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.uint_array.data,
|
||||
ptr[i]->data.uint_array.size,
|
||||
OPAL_UINT))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT8_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.uint8_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.uint8_array.data,
|
||||
ptr[i]->data.uint8_array.size,
|
||||
OPAL_UINT8))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT16_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.uint16_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.uint16_array.data,
|
||||
ptr[i]->data.uint16_array.size,
|
||||
OPAL_UINT16))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT32_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.uint32_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.uint32_array.data,
|
||||
ptr[i]->data.uint32_array.size,
|
||||
OPAL_UINT32))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT64_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.uint64_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.uint64_array.data,
|
||||
ptr[i]->data.uint64_array.size,
|
||||
OPAL_UINT64))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_PID_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.pid_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.pid_array.data,
|
||||
ptr[i]->data.pid_array.size,
|
||||
OPAL_PID))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_TIMEVAL_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
&ptr[i]->data.tv_array.size,
|
||||
1,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_pack_buffer(buffer,
|
||||
ptr[i]->data.tv_array.data,
|
||||
ptr[i]->data.tv_array.size,
|
||||
OPAL_TIMEVAL))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opal_output(0, "PACK-OPAL-VALUE: UNSUPPORTED TYPE %d", (int)ptr[i]->type);
|
||||
return OPAL_ERROR;
|
||||
|
@ -57,10 +57,16 @@ int opal_dss_print_byte(char **output, char *prefix, uint8_t *src, opal_data_typ
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_BYTE\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_BYTE\tValue: %x", prefix, *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -76,10 +82,16 @@ int opal_dss_print_string(char **output, char *prefix, char *src, opal_data_type
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_STRING\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_STRING\tValue: %s", prefx, src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -95,10 +107,16 @@ int opal_dss_print_size(char **output, char *prefix, size_t *src, opal_data_type
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_SIZE\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_SIZE\tValue: %lu", prefx, (unsigned long) *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -114,11 +132,16 @@ int opal_dss_print_pid(char **output, char *prefix, pid_t *src, opal_data_type_t
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_PID\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_PID\tValue: %lu", prefx, (unsigned long) *src);
|
||||
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
@ -133,10 +156,16 @@ int opal_dss_print_bool(char **output, char *prefix, bool *src, opal_data_type_t
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_BOOL\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_BOOL\tValue: %s", prefx, *src ? "TRUE" : "FALSE");
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -152,10 +181,16 @@ int opal_dss_print_int(char **output, char *prefix, int *src, opal_data_type_t t
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_INT\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_INT\tValue: %ld", prefx, (long) *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -171,10 +206,16 @@ int opal_dss_print_uint(char **output, char *prefix, int *src, opal_data_type_t
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_UINT\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_UINT\tValue: %lu", prefx, (unsigned long) *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -190,10 +231,16 @@ int opal_dss_print_uint8(char **output, char *prefix, uint8_t *src, opal_data_ty
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_UINT8\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_UINT8\tValue: %u", prefx, (unsigned int) *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -209,10 +256,16 @@ int opal_dss_print_uint16(char **output, char *prefix, uint16_t *src, opal_data_
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_UINT16\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_UINT16\tValue: %u", prefx, (unsigned int) *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -228,10 +281,16 @@ int opal_dss_print_uint32(char **output, char *prefix, uint32_t *src, opal_data_
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_UINT32\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_UINT32\tValue: %u", prefx, (unsigned int) *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -247,10 +306,16 @@ int opal_dss_print_int8(char **output, char *prefix, int8_t *src, opal_data_type
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_INT8\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_INT8\tValue: %d", prefx, (int) *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -266,10 +331,16 @@ int opal_dss_print_int16(char **output, char *prefix, int16_t *src, opal_data_ty
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_INT16\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_INT16\tValue: %d", prefx, (int) *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -285,10 +356,16 @@ int opal_dss_print_int32(char **output, char *prefix, int32_t *src, opal_data_ty
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_INT32\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_INT32\tValue: %d", prefx, (int) *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -309,6 +386,9 @@ int opal_dss_print_uint64(char **output, char *prefix,
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_UINT64\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
@ -317,6 +397,9 @@ int opal_dss_print_uint64(char **output, char *prefix,
|
||||
#else
|
||||
asprintf(output, "%sData type: OPAL_UINT64\tValue: unsupported", prefx);
|
||||
#endif /* HAVE_INT64_T */
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -338,6 +421,9 @@ int opal_dss_print_int64(char **output, char *prefix,
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_INT64\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
@ -346,6 +432,9 @@ int opal_dss_print_int64(char **output, char *prefix,
|
||||
#else
|
||||
asprintf(output, "%sData type: OPAL_INT64\tValue: unsupported", prefx);
|
||||
#endif /* HAVE_INT64_T */
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -362,10 +451,16 @@ int opal_dss_print_float(char **output, char *prefix,
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_FLOAT\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_FLOAT\tValue: %f", prefx, *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -382,10 +477,16 @@ int opal_dss_print_double(char **output, char *prefix,
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_DOUBLE\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_DOUBLE\tValue: %f", prefx, *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -403,6 +504,9 @@ int opal_dss_print_time(char **output, char *prefix,
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_TIME\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
@ -410,6 +514,9 @@ int opal_dss_print_time(char **output, char *prefix,
|
||||
t[strlen(t)-1] = '\0'; // remove trailing newline
|
||||
|
||||
asprintf(output, "%sData type: OPAL_TIME\tValue: %s", prefx, t);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -426,11 +533,17 @@ int opal_dss_print_timeval(char **output, char *prefix,
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_TIMEVAL\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_TIMEVAL\tValue: %ld.%06ld", prefx,
|
||||
(long)src->tv_sec, (long)src->tv_usec);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -446,10 +559,16 @@ int opal_dss_print_null(char **output, char *prefix, void *src, opal_data_type_t
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_NULL\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_NULL", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -471,10 +590,16 @@ int opal_dss_print_data_type(char **output, char *prefix, opal_data_type_t *src,
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_DATA_TYPE\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_DATA_TYPE\tValue: %lu", prefx, (unsigned long) *src);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
@ -492,10 +617,16 @@ int opal_dss_print_byte_object(char **output, char *prefix, opal_byte_object_t *
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_BYTE_OBJECT\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
asprintf(output, "%sData type: OPAL_BYTE_OBJECT\tSize: %lu", prefx, (unsigned long) src->size);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -514,6 +645,9 @@ int opal_dss_print_pstat(char **output, char *prefix, opal_pstats_t *src, opal_d
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_PSTATS\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
asprintf(output, "%sOPAL_PSTATS SAMPLED AT: %ld.%06ld\n%snode: %s rank: %d pid: %d cmd: %s state: %c pri: %d #threads: %d Processor: %d\n"
|
||||
@ -521,6 +655,9 @@ int opal_dss_print_pstat(char **output, char *prefix, opal_pstats_t *src, opal_d
|
||||
prefx, (long)src->sample_time.tv_sec, (long)src->sample_time.tv_usec,
|
||||
prefx, src->node, src->rank, src->pid, src->cmd, src->state[0], src->priority, src->num_threads, src->processor,
|
||||
prefx, (long)src->time.tv_sec, (long)src->time.tv_usec, src->percent_cpu, src->vsize, src->peak_vsize, src->rss);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -539,6 +676,9 @@ int opal_dss_print_node_stat(char **output, char *prefix, opal_node_stats_t *src
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_NODE_STATS\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
asprintf(output, "%sOPAL_NODE_STATS SAMPLED AT: %ld.%06ld\n%sTotal Mem: %5.2f Free Mem: %5.2f Buffers: %5.2f Cached: %5.2f\n"
|
||||
@ -548,6 +688,9 @@ int opal_dss_print_node_stat(char **output, char *prefix, opal_node_stats_t *src
|
||||
prefx, src->total_mem, src->free_mem, src->buffers, src->cached,
|
||||
prefx, src->swap_cached, src->swap_total, src->swap_free, src->mapped,
|
||||
prefx, src->la, src->la5, src->la15);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -557,20 +700,27 @@ int opal_dss_print_node_stat(char **output, char *prefix, opal_node_stats_t *src
|
||||
*/
|
||||
int opal_dss_print_value(char **output, char *prefix, opal_value_t *src, opal_data_type_t type)
|
||||
{
|
||||
char *prefx;
|
||||
char *prefx, *t2;
|
||||
int i;
|
||||
|
||||
/* deal with NULL prefix */
|
||||
if (NULL == prefix) asprintf(&prefx, " ");
|
||||
else prefx = strdup(prefix);
|
||||
else prefx = prefix;
|
||||
|
||||
/* if src is NULL, just print data type and return */
|
||||
if (NULL == src) {
|
||||
asprintf(output, "%sData type: OPAL_VALUE\tValue: NULL pointer", prefx);
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
switch (src->type) {
|
||||
case OPAL_BOOL:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BOOL\tKey: %s\tValue: %s",
|
||||
prefx, src->key, src->data.flag ? "true" : "false");
|
||||
break;
|
||||
case OPAL_BYTE:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE\tKey: %s\tValue: %x",
|
||||
prefx, src->key, src->data.byte);
|
||||
@ -646,12 +796,189 @@ int opal_dss_print_value(char **output, char *prefix, opal_value_t *src, opal_da
|
||||
case OPAL_PTR:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PTR\tKey: %s", prefx, src->key);
|
||||
break;
|
||||
case OPAL_FLOAT_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_FLOAT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.fval_array.size);
|
||||
for (i = 0; i < src->data.fval_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%f", *output, prefx, src->data.fval_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_DOUBLE_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_DOUBLE_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.dval_array.size);
|
||||
for (i = 0; i < src->data.dval_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%f", *output, prefx, src->data.dval_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_STRING_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_STRING_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.string_array.size);
|
||||
for (i = 0; i < src->data.string_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%s", *output, prefx, src->data.string_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_BOOL_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BOOL_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.flag_array.size);
|
||||
for (i = 0; i < src->data.flag_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%s", *output, prefx, src->data.flag_array.data[i] ? "true" : "false");
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_SIZE_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_SIZE_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.size_array.size);
|
||||
for (i = 0; i < src->data.size_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%lu", *output, prefx, (unsigned long)src->data.size_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_BYTE_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.byte_array.size);
|
||||
for (i = 0; i < src->data.byte_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%x", *output, prefx, (uint8_t)src->data.byte_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.integer_array.size);
|
||||
for (i = 0; i < src->data.integer_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%d", *output, prefx, src->data.integer_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT8_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT8_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.int8_array.size);
|
||||
for (i = 0; i < src->data.int8_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%d", *output, prefx, (int)src->data.int8_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT16_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT16_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.int16_array.size);
|
||||
for (i = 0; i < src->data.int16_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%d", *output, prefx, (int)src->data.int16_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT32_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT32_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.int32_array.size);
|
||||
for (i = 0; i < src->data.int32_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%d", *output, prefx, src->data.int32_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT64_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT64_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.int64_array.size);
|
||||
for (i = 0; i < src->data.int64_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%ld", *output, prefx, (long)src->data.int64_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.uint_array.size);
|
||||
for (i = 0; i < src->data.uint_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%u", *output, prefx, src->data.uint_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT8_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT8_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.uint8_array.size);
|
||||
for (i = 0; i < src->data.uint8_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.uint8_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT16_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT16_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.uint16_array.size);
|
||||
for (i = 0; i < src->data.uint16_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.uint16_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT32_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT32_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.uint32_array.size);
|
||||
for (i = 0; i < src->data.uint32_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.uint32_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT64_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT64_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.uint64_array.size);
|
||||
for (i = 0; i < src->data.uint64_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%lu", *output, prefx, (unsigned long)src->data.uint64_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_BYTE_OBJECT_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE_OBJECT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.bo_array.size);
|
||||
for (i = 0; i < src->data.bo_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\tData: %s\tSize: %lu ", *output, prefx,
|
||||
(NULL == src->data.bo_array.data[i].bytes) ? "NULL" : "NON-NULL",
|
||||
(unsigned long)src->data.bo_array.data[i].size);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_PID_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PID_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.pid_array.size);
|
||||
for (i = 0; i < src->data.pid_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.pid_array.data[i]);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
case OPAL_TIMEVAL_ARRAY:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_TIMEVAL_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
||||
prefx, src->key, src->data.tv_array.size);
|
||||
for (i = 0; i < src->data.tv_array.size; i++) {
|
||||
asprintf(&t2, "%s\n%s\t%ld.%06ld", *output, prefx,
|
||||
(long)src->data.tv_array.data[i].tv_sec,
|
||||
(long)src->data.tv_array.data[i].tv_usec);
|
||||
free(*output);
|
||||
*output = t2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
asprintf(output, "%sOPAL_VALUE: Data type: UNKNOWN\tKey: %s\tValue: UNPRINTABLE",
|
||||
prefx, src->key);
|
||||
break;
|
||||
}
|
||||
if (prefx != prefix) {
|
||||
free(prefx);
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -86,14 +86,127 @@ typedef struct {
|
||||
#define OPAL_VALUE (opal_data_type_t) 26 /**< opal value structure */
|
||||
#define OPAL_BUFFER (opal_data_type_t) 27 /**< pack the remaining contents of a buffer as an object */
|
||||
#define OPAL_PTR (opal_data_type_t) 28 /**< pointer to void* */
|
||||
|
||||
/* OPAL Dynamic */
|
||||
#define OPAL_DSS_ID_DYNAMIC (opal_data_type_t) 30
|
||||
/* OPAL Array types */
|
||||
#define OPAL_FLOAT_ARRAY (opal_data_type_t) 31
|
||||
#define OPAL_DOUBLE_ARRAY (opal_data_type_t) 32
|
||||
#define OPAL_STRING_ARRAY (opal_data_type_t) 33
|
||||
#define OPAL_BOOL_ARRAY (opal_data_type_t) 34
|
||||
#define OPAL_SIZE_ARRAY (opal_data_type_t) 35
|
||||
#define OPAL_BYTE_ARRAY (opal_data_type_t) 36
|
||||
#define OPAL_INT_ARRAY (opal_data_type_t) 37
|
||||
#define OPAL_INT8_ARRAY (opal_data_type_t) 38
|
||||
#define OPAL_INT16_ARRAY (opal_data_type_t) 39
|
||||
#define OPAL_INT32_ARRAY (opal_data_type_t) 40
|
||||
#define OPAL_INT64_ARRAY (opal_data_type_t) 41
|
||||
#define OPAL_UINT_ARRAY (opal_data_type_t) 42
|
||||
#define OPAL_UINT8_ARRAY (opal_data_type_t) 43
|
||||
#define OPAL_UINT16_ARRAY (opal_data_type_t) 44
|
||||
#define OPAL_UINT32_ARRAY (opal_data_type_t) 45
|
||||
#define OPAL_UINT64_ARRAY (opal_data_type_t) 46
|
||||
#define OPAL_BYTE_OBJECT_ARRAY (opal_data_type_t) 47
|
||||
#define OPAL_PID_ARRAY (opal_data_type_t) 48
|
||||
#define OPAL_TIMEVAL_ARRAY (opal_data_type_t) 49
|
||||
|
||||
|
||||
/* define the results values for comparisons so we can change them in only one place */
|
||||
#define OPAL_VALUE1_GREATER +1
|
||||
#define OPAL_VALUE2_GREATER -1
|
||||
#define OPAL_EQUAL 0
|
||||
|
||||
/* List types for opal_value_t, needs number of elements and a pointer */
|
||||
/* float array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
float *data;
|
||||
} opal_float_array_t;
|
||||
/* double array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
double *data;
|
||||
} opal_double_array_t;
|
||||
/* string array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
char **data;
|
||||
} opal_string_array_t;
|
||||
/* bool array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
bool *data;
|
||||
} opal_bool_array_t;
|
||||
/* size array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
size_t *data;
|
||||
} opal_size_array_t;
|
||||
/* opal byte object array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
opal_byte_object_t *data;
|
||||
} opal_byte_object_array_t;
|
||||
/* int array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
int *data;
|
||||
} opal_int_array_t;
|
||||
/* int8 array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
int8_t *data;
|
||||
} opal_int8_array_t;
|
||||
/* int16 array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
int16_t *data;
|
||||
} opal_int16_array_t;
|
||||
/* int32 array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
int32_t *data;
|
||||
} opal_int32_array_t;
|
||||
/* int64 array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
int64_t *data;
|
||||
} opal_int64_array_t;
|
||||
/* uint array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
unsigned int *data;
|
||||
} opal_uint_array_t;
|
||||
/* uint8 array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
uint8_t *data;
|
||||
} opal_uint8_array_t;
|
||||
/* uint16 array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
uint16_t *data;
|
||||
} opal_uint16_array_t;
|
||||
/* uint32 array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
uint32_t *data;
|
||||
} opal_uint32_array_t;
|
||||
/* uint64 array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
uint64_t *data;
|
||||
} opal_uint64_array_t;
|
||||
/* pid array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
pid_t *data;
|
||||
} opal_pid_array_t;
|
||||
/* timeval array object */
|
||||
typedef struct {
|
||||
int32_t size;
|
||||
struct timeval *data;
|
||||
} opal_timeval_array_t;
|
||||
|
||||
/* Data value object */
|
||||
typedef struct {
|
||||
opal_list_item_t super; /* required for this to be on lists */
|
||||
@ -119,6 +232,25 @@ typedef struct {
|
||||
float fval;
|
||||
double dval;
|
||||
struct timeval tv;
|
||||
opal_bool_array_t flag_array;
|
||||
opal_uint8_array_t byte_array;
|
||||
opal_string_array_t string_array;
|
||||
opal_size_array_t size_array;
|
||||
opal_int_array_t integer_array;
|
||||
opal_int8_array_t int8_array;
|
||||
opal_int16_array_t int16_array;
|
||||
opal_int32_array_t int32_array;
|
||||
opal_int64_array_t int64_array;
|
||||
opal_uint_array_t uint_array;
|
||||
opal_uint8_array_t uint8_array;
|
||||
opal_uint16_array_t uint16_array;
|
||||
opal_uint32_array_t uint32_array;
|
||||
opal_uint64_array_t uint64_array;
|
||||
opal_byte_object_array_t bo_array;
|
||||
opal_float_array_t fval_array;
|
||||
opal_double_array_t dval_array;
|
||||
opal_pid_array_t pid_array;
|
||||
opal_timeval_array_t tv_array;
|
||||
void *ptr; // never packed or passed anywhere
|
||||
} data;
|
||||
} opal_value_t;
|
||||
|
@ -670,6 +670,7 @@ static int unpack_disk_stats(opal_buffer_t *buffer, opal_node_stats_t *ns)
|
||||
/* unpack them */
|
||||
for (i=0; i < n; i++) {
|
||||
dk = OBJ_NEW(opal_diskstats_t);
|
||||
assert(dk);
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &dk->disk, &m, OPAL_STRING))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
@ -774,6 +775,7 @@ static int unpack_net_stats(opal_buffer_t *buffer, opal_node_stats_t *ns)
|
||||
/* unpack them */
|
||||
for (i=0; i < n; i++) {
|
||||
net = OBJ_NEW(opal_netstats_t);
|
||||
assert(net);
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &net->net_interface, &m, OPAL_STRING))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
@ -1060,6 +1062,294 @@ int opal_dss_unpack_value(opal_buffer_t *buffer, void *dest,
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_FLOAT_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.fval_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.fval_array.data,
|
||||
&ptr[i]->data.fval_array.size,
|
||||
OPAL_FLOAT))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_DOUBLE_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.dval_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.dval_array.data,
|
||||
&ptr[i]->data.dval_array.size,
|
||||
OPAL_DOUBLE))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_STRING_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.string_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.string_array.data,
|
||||
&ptr[i]->data.string_array.size,
|
||||
OPAL_STRING))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_BOOL_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.flag_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.flag_array.data,
|
||||
&ptr[i]->data.flag_array.size,
|
||||
OPAL_BOOL))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_SIZE_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.size_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.size_array.data,
|
||||
&ptr[i]->data.size_array.size,
|
||||
OPAL_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_BYTE_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.byte_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.byte_array.data,
|
||||
&ptr[i]->data.byte_array.size,
|
||||
OPAL_BYTE))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.integer_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.integer_array.data,
|
||||
&ptr[i]->data.integer_array.size,
|
||||
OPAL_INT))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT8_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.int8_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.int8_array.data,
|
||||
&ptr[i]->data.int8_array.size,
|
||||
OPAL_INT8))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT16_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.int16_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.int16_array.data,
|
||||
&ptr[i]->data.int16_array.size,
|
||||
OPAL_INT16))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT32_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.int32_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.int32_array.data,
|
||||
&ptr[i]->data.int32_array.size,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_INT64_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.int64_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.int64_array.data,
|
||||
&ptr[i]->data.int64_array.size,
|
||||
OPAL_INT64))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.uint_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.uint_array.data,
|
||||
&ptr[i]->data.uint_array.size,
|
||||
OPAL_UINT))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT8_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.uint8_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.uint8_array.data,
|
||||
&ptr[i]->data.uint8_array.size,
|
||||
OPAL_UINT8))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT16_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.uint16_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.uint16_array.data,
|
||||
&ptr[i]->data.uint16_array.size,
|
||||
OPAL_UINT16))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT32_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.uint32_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.uint32_array.data,
|
||||
&ptr[i]->data.uint32_array.size,
|
||||
OPAL_UINT32))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_UINT64_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.uint64_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.uint64_array.data,
|
||||
&ptr[i]->data.uint64_array.size,
|
||||
OPAL_UINT64))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_PID_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.pid_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.pid_array.data,
|
||||
&ptr[i]->data.pid_array.size,
|
||||
OPAL_PID))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case OPAL_TIMEVAL_ARRAY:
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
&ptr[i]->data.tv_array.size,
|
||||
&m,
|
||||
OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_dss_unpack_buffer(buffer,
|
||||
ptr[i]->data.tv_array.data,
|
||||
&ptr[i]->data.tv_array.size,
|
||||
OPAL_TIMEVAL))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
opal_output(0, "PACK-OPAL-VALUE: UNSUPPORTED TYPE");
|
||||
return OPAL_ERROR;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user