⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gpr_data_type_unpacking_fns.c

📁 MPI stands for the Message Passing Interface. Written by the MPI Forum (a large committee comprising
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana *                         University Research and Technology *                         Corporation.  All rights reserved. * Copyright (c) 2004-2005 The University of Tennessee and The University *                         of Tennessee Research Foundation.  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/trace.h"#include "orte/mca/errmgr/errmgr.h"#include "orte/dss/dss_internal.h"#include "orte/mca/gpr/base/base.h"/* * GPR CMD */int orte_gpr_base_unpack_cmd(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    OPAL_TRACE(4);    if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_CMD_T))) {        ORTE_ERROR_LOG(rc);    }    return rc;}/* * SUBSCRIPTION ID */int orte_gpr_base_unpack_subscription_id(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    OPAL_TRACE(4);    if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_SUBSCRIPTION_ID_T))) {        ORTE_ERROR_LOG(rc);    }    return rc;}/* * TRIGGER ID */int orte_gpr_base_unpack_trigger_id(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    OPAL_TRACE(4);    if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_TRIGGER_ID_T))) {        ORTE_ERROR_LOG(rc);    }    return rc;}/* * NOTIFY ACTION */int orte_gpr_base_unpack_notify_action(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    OPAL_TRACE(4);    if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_NOTIFY_ACTION_T))) {        ORTE_ERROR_LOG(rc);    }    return rc;}/* * TRIGGER ACTION */int orte_gpr_base_unpack_trigger_action(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    OPAL_TRACE(4);    if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_TRIGGER_ACTION_T))) {        ORTE_ERROR_LOG(rc);    }    return rc;}/* * NOTIFY MSG TYPE */int orte_gpr_base_unpack_notify_msg_type(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    OPAL_TRACE(4);    if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_NOTIFY_MSG_TYPE_T))) {        ORTE_ERROR_LOG(rc);    }    return rc;}/* * ADDR MODE */int orte_gpr_base_unpack_addr_mode(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    OPAL_TRACE(4);    if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, dest, num_vals, ORTE_GPR_ADDR_MODE_T))) {        ORTE_ERROR_LOG(rc);    }    return rc;}/* * KEYVAL */int orte_gpr_base_unpack_keyval(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    orte_gpr_keyval_t **keyval;    orte_std_cntr_t i, max_n;    OPAL_TRACE(4);    /* unpack into an array of keyval objects */    keyval = (orte_gpr_keyval_t**) dest;    for (i=0; i < *num_vals; i++) {        /* allocate the memory storage */        keyval[i] = OBJ_NEW(orte_gpr_keyval_t);        if (NULL == keyval[i]) {            ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);            return ORTE_ERR_OUT_OF_RESOURCE;        }        /* unpack the key */        max_n=1;        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(keyval[i]->key),                    &max_n, ORTE_STRING))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* unpack the data value */        max_n=1;        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(keyval[i]->value),                                                         &max_n, ORTE_DATA_VALUE))) {            ORTE_ERROR_LOG(rc);            return rc;        }    }    return ORTE_SUCCESS;}/* * VALUE */int orte_gpr_base_unpack_value(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    orte_gpr_value_t **values;    orte_std_cntr_t i, max_n=1;    OPAL_TRACE(4);    /* unpack into array of value objects */    values = (orte_gpr_value_t**) dest;    for (i=0; i < *num_vals; i++) {        /* create the value object */        values[i] = OBJ_NEW(orte_gpr_value_t);        if (NULL == values[i]) {            ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);            return ORTE_ERR_OUT_OF_RESOURCE;        }        /* unpack the address mode */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(values[i]->addr_mode),                    &max_n, ORTE_GPR_ADDR_MODE))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* unpack the segment name */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(values[i]->segment),                    &max_n, ORTE_STRING))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* get the number of tokens */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(values[i]->num_tokens),                    &max_n, ORTE_STD_CNTR))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* if there are tokens, allocate the required space for the char * pointers */        if (0 < values[i]->num_tokens) {            values[i]->tokens = (char **)malloc(values[i]->num_tokens * sizeof(char*));            if (NULL == values[i]->tokens) {                ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);                return ORTE_ERR_OUT_OF_RESOURCE;            }            /* and unpack them */            if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, values[i]->tokens,                        &(values[i]->num_tokens), ORTE_STRING))) {                ORTE_ERROR_LOG(rc);                return rc;            }        }        /* get the number of keyval pairs */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(values[i]->cnt),                    &max_n, ORTE_STD_CNTR))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* if there are keyvals, allocate the required space for the keyval object pointers */        if(0 < values[i]->cnt) {            values[i]->keyvals = (orte_gpr_keyval_t**)malloc(values[i]->cnt * sizeof(orte_gpr_keyval_t*));            if (NULL == values[i]->keyvals) {                ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);                return ORTE_ERR_OUT_OF_RESOURCE;            }            /* unpack the keyval pairs */            if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, values[i]->keyvals,                    &(values[i]->cnt), ORTE_GPR_KEYVAL))) {                ORTE_ERROR_LOG(rc);                return rc;            }        }    }    return ORTE_SUCCESS;}/* * SUBSCRIPTION */int orte_gpr_base_unpack_subscription(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    orte_gpr_subscription_t **subs;    orte_std_cntr_t i, max_n=1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -