This source file includes following definitions.
- orte_dt_copy_std_cntr
- orte_dt_copy_job
- orte_dt_copy_node
- orte_dt_copy_proc
- orte_dt_copy_app_context
- orte_dt_copy_proc_state
- orte_dt_copy_job_state
- orte_dt_copy_node_state
- orte_dt_copy_exit_code
- orte_dt_copy_map
- orte_dt_copy_tag
- orte_dt_copy_daemon_cmd
- orte_dt_copy_iof_tag
- orte_dt_copy_attr
- orte_dt_copy_sig
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 #include "orte_config.h"
  24 
  25 #ifdef HAVE_SYS_TYPES_H
  26 #include <sys/types.h>
  27 #endif
  28 #include <string.h>
  29 
  30 #include "opal/util/argv.h"
  31 #include "opal/dss/dss.h"
  32 
  33 #include "orte/mca/errmgr/errmgr.h"
  34 #include "orte/runtime/data_type_support/orte_dt_support.h"
  35 
  36 
  37 int orte_dt_copy_std_cntr(orte_std_cntr_t **dest, orte_std_cntr_t *src, opal_data_type_t type)
  38 {
  39     orte_std_cntr_t *val;
  40 
  41     val = (orte_std_cntr_t*)malloc(sizeof(orte_std_cntr_t));
  42     if (NULL == val) {
  43         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
  44         return ORTE_ERR_OUT_OF_RESOURCE;
  45     }
  46 
  47     *val = *src;
  48     *dest = val;
  49 
  50     return ORTE_SUCCESS;
  51 }
  52 
  53 
  54 
  55 
  56 int orte_dt_copy_job(orte_job_t **dest, orte_job_t *src, opal_data_type_t type)
  57 {
  58     (*dest) = src;
  59     OBJ_RETAIN(src);
  60 
  61     return ORTE_SUCCESS;
  62 }
  63 
  64 
  65 
  66 
  67 int orte_dt_copy_node(orte_node_t **dest, orte_node_t *src, opal_data_type_t type)
  68 {
  69     orte_node_t *node;
  70 
  71     node = OBJ_NEW(orte_node_t);
  72     node->name = strdup(src->name);
  73     node->state = src->state;
  74     node->slots = src->slots;
  75     node->slots_inuse = src->slots_inuse;
  76     node->slots_max = src->slots_max;
  77     node->topology = src->topology;
  78     node->flags = src->flags;
  79     (*dest) = node;
  80 
  81     return ORTE_SUCCESS;
  82 }
  83 
  84 
  85 
  86 
  87 int orte_dt_copy_proc(orte_proc_t **dest, orte_proc_t *src, opal_data_type_t type)
  88 {
  89     (*dest) = src;
  90     OBJ_RETAIN(src);
  91     return ORTE_SUCCESS;
  92 }
  93 
  94 
  95 
  96 
  97 int orte_dt_copy_app_context(orte_app_context_t **dest, orte_app_context_t *src, opal_data_type_t type)
  98 {
  99     opal_value_t *kv, *kvnew;
 100 
 101     
 102     *dest = OBJ_NEW(orte_app_context_t);
 103     if (NULL == *dest) {
 104         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 105         return ORTE_ERR_OUT_OF_RESOURCE;
 106     }
 107 
 108     
 109     (*dest)->idx = src->idx;
 110     if (NULL != src->app) {
 111         (*dest)->app = strdup(src->app);
 112     }
 113     (*dest)->num_procs = src->num_procs;
 114     (*dest)->argv = opal_argv_copy(src->argv);
 115     (*dest)->env = opal_argv_copy(src->env);
 116     if (NULL != src->cwd) {
 117         (*dest)->cwd = strdup(src->cwd);
 118     }
 119 
 120     OPAL_LIST_FOREACH(kv, &src->attributes, opal_value_t) {
 121         opal_dss.copy((void**)&kvnew, kv, OPAL_VALUE);
 122         opal_list_append(&(*dest)->attributes, &kvnew->super);
 123     }
 124 
 125     return ORTE_SUCCESS;
 126 }
 127 
 128 int orte_dt_copy_proc_state(orte_proc_state_t **dest, orte_proc_state_t *src, opal_data_type_t type)
 129 {
 130     orte_proc_state_t *ps;
 131 
 132     ps = (orte_proc_state_t*)malloc(sizeof(orte_proc_state_t));
 133     if (NULL == ps) {
 134         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 135         return ORTE_ERR_OUT_OF_RESOURCE;
 136     }
 137 
 138     *ps = *src;
 139     *dest = ps;
 140 
 141     return ORTE_SUCCESS;
 142 }
 143 
 144 int orte_dt_copy_job_state(orte_job_state_t **dest, orte_job_state_t *src, opal_data_type_t type)
 145 {
 146     orte_job_state_t *ps;
 147 
 148     ps = (orte_job_state_t*)malloc(sizeof(orte_job_state_t));
 149     if (NULL == ps) {
 150         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 151         return ORTE_ERR_OUT_OF_RESOURCE;
 152     }
 153 
 154     *ps = *src;
 155     *dest = ps;
 156 
 157     return ORTE_SUCCESS;
 158 }
 159 
 160 int orte_dt_copy_node_state(orte_node_state_t **dest, orte_node_state_t *src, opal_data_type_t type)
 161 {
 162     orte_node_state_t *ps;
 163 
 164     ps = (orte_node_state_t*)malloc(sizeof(orte_node_state_t));
 165     if (NULL == ps) {
 166         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 167         return ORTE_ERR_OUT_OF_RESOURCE;
 168     }
 169 
 170     *ps = *src;
 171     *dest = ps;
 172 
 173     return ORTE_SUCCESS;
 174 }
 175 
 176 int orte_dt_copy_exit_code(orte_exit_code_t **dest, orte_exit_code_t *src, opal_data_type_t type)
 177 {
 178     orte_exit_code_t *ps;
 179 
 180     ps = (orte_exit_code_t*)malloc(sizeof(orte_exit_code_t));
 181     if (NULL == ps) {
 182         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 183         return ORTE_ERR_OUT_OF_RESOURCE;
 184     }
 185 
 186     *ps = *src;
 187     *dest = ps;
 188 
 189     return ORTE_SUCCESS;
 190 }
 191 
 192 
 193 
 194 
 195 int orte_dt_copy_map(orte_job_map_t **dest, orte_job_map_t *src, opal_data_type_t type)
 196 {
 197     orte_std_cntr_t i;
 198 
 199     if (NULL == src) {
 200         *dest = NULL;
 201         return ORTE_SUCCESS;
 202     }
 203 
 204     
 205     *dest = OBJ_NEW(orte_job_map_t);
 206     if (NULL == *dest) {
 207         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 208         return ORTE_ERR_OUT_OF_RESOURCE;
 209     }
 210 
 211     
 212     (*dest)->mapping = src->mapping;
 213     (*dest)->ranking = src->ranking;
 214     (*dest)->binding = src->binding;
 215     if (NULL != src->ppr) {
 216         (*dest)->ppr = strdup(src->ppr);
 217     }
 218     (*dest)->display_map = src->display_map;
 219     (*dest)->num_new_daemons = src->num_new_daemons;
 220     (*dest)->daemon_vpid_start = src->daemon_vpid_start;
 221     (*dest)->num_nodes = src->num_nodes;
 222 
 223     
 224 
 225 
 226     (*dest)->nodes->lowest_free = src->nodes->lowest_free;
 227     (*dest)->nodes->number_free = src->nodes->number_free;
 228     (*dest)->nodes->size = src->nodes->size;
 229     (*dest)->nodes->max_size = src->nodes->max_size;
 230     (*dest)->nodes->block_size = src->nodes->block_size;
 231     for (i=0; i < src->nodes->size; i++) {
 232         (*dest)->nodes->addr[i] = src->nodes->addr[i];
 233     }
 234 
 235     return ORTE_SUCCESS;
 236 }
 237 
 238 
 239 
 240 
 241 int orte_dt_copy_tag(orte_rml_tag_t **dest, orte_rml_tag_t *src, opal_data_type_t type)
 242 {
 243     orte_rml_tag_t *tag;
 244 
 245     if (NULL == src) {
 246         *dest = NULL;
 247         return ORTE_SUCCESS;
 248     }
 249 
 250     
 251     tag = (orte_rml_tag_t*)malloc(sizeof(orte_rml_tag_t));
 252     if (NULL == tag) {
 253         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 254         return ORTE_ERR_OUT_OF_RESOURCE;
 255     }
 256 
 257     
 258     *tag = *src;
 259     *dest = tag;
 260 
 261     return ORTE_SUCCESS;
 262 }
 263 
 264 int orte_dt_copy_daemon_cmd(orte_daemon_cmd_flag_t **dest, orte_daemon_cmd_flag_t *src, opal_data_type_t type)
 265 {
 266     size_t datasize;
 267 
 268     datasize = sizeof(orte_daemon_cmd_flag_t);
 269 
 270     *dest = (orte_daemon_cmd_flag_t*)malloc(datasize);
 271     if (NULL == *dest) {
 272         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 273         return ORTE_ERR_OUT_OF_RESOURCE;
 274     }
 275 
 276     memcpy(*dest, src, datasize);
 277 
 278     return ORTE_SUCCESS;
 279 }
 280 
 281 int orte_dt_copy_iof_tag(orte_iof_tag_t **dest, orte_iof_tag_t *src, opal_data_type_t type)
 282 {
 283     size_t datasize;
 284 
 285     datasize = sizeof(orte_iof_tag_t);
 286 
 287     *dest = (orte_iof_tag_t*)malloc(datasize);
 288     if (NULL == *dest) {
 289         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 290         return ORTE_ERR_OUT_OF_RESOURCE;
 291     }
 292 
 293     memcpy(*dest, src, datasize);
 294 
 295     return ORTE_SUCCESS;
 296 }
 297 
 298 int orte_dt_copy_attr(orte_attribute_t **dest, orte_attribute_t *src, opal_data_type_t type)
 299 {
 300     *dest = OBJ_NEW(orte_attribute_t);
 301     if (NULL == *dest) {
 302         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 303         return ORTE_ERR_OUT_OF_RESOURCE;
 304     }
 305     (*dest)->key = src->key;
 306     (*dest)->type = src->type;
 307 
 308     memcpy(&(*dest)->data, &src->data, sizeof(src->data));
 309 
 310     return ORTE_SUCCESS;
 311 }
 312 
 313 int orte_dt_copy_sig(orte_grpcomm_signature_t **dest, orte_grpcomm_signature_t *src, opal_data_type_t type)
 314 {
 315     *dest = OBJ_NEW(orte_grpcomm_signature_t);
 316     if (NULL == *dest) {
 317         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 318         return ORTE_ERR_OUT_OF_RESOURCE;
 319     }
 320     (*dest)->sz = src->sz;
 321     (*dest)->signature = (orte_process_name_t*)malloc(src->sz * sizeof(orte_process_name_t));
 322     if (NULL == (*dest)->signature) {
 323         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 324         OBJ_RELEASE(*dest);
 325         return ORTE_ERR_OUT_OF_RESOURCE;
 326     }
 327     memcpy((*dest)->signature, src->signature, src->sz * sizeof(orte_process_name_t));
 328     return ORTE_SUCCESS;
 329 }