This source file includes following definitions.
- pmix_bfrops_base_unpack_buffer
- pmix_bfrops_base_unpack
- pmix_bfrops_base_unpack_bool
- pmix_bfrops_base_unpack_int
- pmix_bfrops_base_unpack_sizet
- pmix_bfrops_base_unpack_pid
- pmix_bfrops_base_unpack_byte
- pmix_bfrops_base_unpack_int16
- pmix_bfrops_base_unpack_int32
- pmix_bfrops_base_unpack_datatype
- pmix_bfrops_base_unpack_int64
- pmix_bfrops_base_unpack_string
- pmix_bfrops_base_unpack_float
- pmix_bfrops_base_unpack_double
- pmix_bfrops_base_unpack_timeval
- pmix_bfrops_base_unpack_time
- pmix_bfrops_base_unpack_status
- pmix_bfrops_base_unpack_val
- pmix_bfrops_base_unpack_value
- pmix_bfrops_base_unpack_info
- pmix_bfrops_base_unpack_pdata
- pmix_bfrops_base_unpack_buf
- pmix_bfrops_base_unpack_proc
- pmix_bfrops_base_unpack_app
- pmix_bfrops_base_unpack_kval
- pmix_bfrops_base_unpack_persist
- pmix_bfrops_base_unpack_bo
- pmix_bfrops_base_unpack_ptr
- pmix_bfrops_base_unpack_scope
- pmix_bfrops_base_unpack_range
- pmix_bfrops_base_unpack_cmd
- pmix_bfrops_base_unpack_info_directives
- pmix_bfrops_base_unpack_pstate
- pmix_bfrops_base_unpack_pinfo
- pmix_bfrops_base_unpack_darray
- pmix_bfrops_base_unpack_rank
- pmix_bfrops_base_unpack_query
- pmix_bfrops_base_unpack_alloc_directive
- pmix_bfrops_base_unpack_iof_channel
- pmix_bfrops_base_unpack_envar
- pmix_bfrops_base_unpack_coord
- pmix_bfrops_base_unpack_regattr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 #include <src/include/pmix_config.h>
26
27 #include "src/util/argv.h"
28 #include "src/util/error.h"
29 #include "src/util/output.h"
30 #include "src/include/pmix_globals.h"
31 #include "src/mca/bfrops/bfrops_types.h"
32 #include "src/mca/bfrops/base/base.h"
33
34
35 static pmix_status_t pmix_bfrops_base_unpack_buffer(pmix_pointer_array_t *regtypes,
36 pmix_buffer_t *buffer,
37 void *dst, int32_t *num_vals,
38 pmix_data_type_t type)
39 {
40 pmix_status_t rc;
41 pmix_data_type_t local_type;
42
43 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
44 "pmix_bfrops_base_unpack_buffer( %p, %p, %lu, %d )\n",
45 (void*)buffer, dst, (long unsigned int)*num_vals, (int)type);
46
47
48 if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) {
49 if (PMIX_SUCCESS != (rc = pmix_bfrop_get_data_type(regtypes, buffer, &local_type))) {
50 PMIX_ERROR_LOG(rc);
51 return rc;
52 }
53
54 if (type != local_type) {
55 pmix_output(0, "PMIX bfrop:unpack: got type %d when expecting type %d", local_type, type);
56 return PMIX_ERR_PACK_MISMATCH;
57 }
58 }
59 PMIX_BFROPS_UNPACK_TYPE(rc, buffer, dst, num_vals, type, regtypes);
60 return rc;
61 }
62
63 pmix_status_t pmix_bfrops_base_unpack(pmix_pointer_array_t *regtypes,
64 pmix_buffer_t *buffer,
65 void *dst, int32_t *num_vals,
66 pmix_data_type_t type)
67 {
68 pmix_status_t rc, ret;
69 int32_t local_num, n=1;
70 pmix_data_type_t local_type;
71
72
73 if (NULL == buffer || NULL == dst || NULL == num_vals) {
74 return PMIX_ERR_BAD_PARAM;
75 }
76
77
78
79
80 if (0 == *num_vals) {
81 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
82 "pmix_bfrop_unpack: inadequate space ( %p, %p, %lu, %d )\n",
83 (void*)buffer, dst, (long unsigned int)*num_vals, (int)type);
84 return PMIX_ERR_UNPACK_INADEQUATE_SPACE;
85 }
86
87
88
89
90
91
92
93
94
95
96 if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) {
97 if (PMIX_SUCCESS != (rc = pmix_bfrop_get_data_type(regtypes, buffer, &local_type))) {
98 *num_vals = 0;
99
100
101 return rc;
102 }
103 if (PMIX_INT32 != local_type) {
104 *num_vals = 0;
105 PMIX_ERROR_LOG(PMIX_ERR_UNPACK_FAILURE);
106 return PMIX_ERR_UNPACK_FAILURE;
107 }
108 }
109
110 n=1;
111 PMIX_BFROPS_UNPACK_TYPE(rc, buffer, &local_num, &n, PMIX_INT32, regtypes);
112 if (PMIX_SUCCESS != rc) {
113 *num_vals = 0;
114
115
116 return rc;
117 }
118 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
119 "pmix_bfrop_unpack: found %d values for %d provided storage",
120 local_num, *num_vals);
121
122
123
124
125
126
127 if (local_num > *num_vals) {
128 local_num = *num_vals;
129 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
130 "pmix_bfrop_unpack: inadequate space ( %p, %p, %lu, %d )\n",
131 (void*)buffer, dst, (long unsigned int)*num_vals, (int)type);
132 ret = PMIX_ERR_UNPACK_INADEQUATE_SPACE;
133 } else {
134 *num_vals = local_num;
135 ret = PMIX_SUCCESS;
136 }
137
138
139 if (PMIX_SUCCESS != (rc = pmix_bfrops_base_unpack_buffer(regtypes, buffer, dst, &local_num, type))) {
140 *num_vals = 0;
141 ret = rc;
142 }
143
144 return ret;
145 }
146
147
148
149
150
151
152 pmix_status_t pmix_bfrops_base_unpack_bool(pmix_pointer_array_t *regtypes,
153 pmix_buffer_t *buffer, void *dest,
154 int32_t *num_vals, pmix_data_type_t type)
155 {
156 int32_t i;
157 uint8_t *src;
158 bool *dst;
159
160 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
161 "pmix_bfrop_unpack_bool * %d\n", (int)*num_vals);
162
163
164 if (pmix_bfrop_too_small(buffer, *num_vals)) {
165 return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
166 }
167
168
169 src = (uint8_t*)buffer->unpack_ptr;
170 dst = (bool*)dest;
171
172 for (i=0; i < *num_vals; i++) {
173 if (src[i]) {
174 dst[i] = true;
175 } else {
176 dst[i] = false;
177 }
178 }
179
180
181 buffer->unpack_ptr += *num_vals;
182
183 return PMIX_SUCCESS;
184 }
185
186
187
188
189 pmix_status_t pmix_bfrops_base_unpack_int(pmix_pointer_array_t *regtypes,
190 pmix_buffer_t *buffer, void *dest,
191 int32_t *num_vals, pmix_data_type_t type)
192 {
193 pmix_status_t ret;
194 pmix_data_type_t remote_type;
195
196 if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &remote_type))) {
197 return ret;
198 }
199
200 if (remote_type == BFROP_TYPE_INT) {
201
202
203 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, BFROP_TYPE_INT, regtypes);
204 } else {
205
206 PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, int, remote_type, ret);
207 }
208
209 return ret;
210 }
211
212
213
214
215 pmix_status_t pmix_bfrops_base_unpack_sizet(pmix_pointer_array_t *regtypes,
216 pmix_buffer_t *buffer, void *dest,
217 int32_t *num_vals, pmix_data_type_t type)
218 {
219 pmix_status_t ret;
220 pmix_data_type_t remote_type;
221
222 if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer,
223 &remote_type))) {
224 PMIX_ERROR_LOG(ret);
225 return ret;
226 }
227
228 if (remote_type == BFROP_TYPE_SIZE_T) {
229
230
231 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, BFROP_TYPE_SIZE_T,
232 regtypes);
233 if (PMIX_SUCCESS != ret) {
234 PMIX_ERROR_LOG(ret);
235 }
236 } else {
237
238 PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, size_t, remote_type, ret);
239 }
240 return ret;
241 }
242
243
244
245
246 pmix_status_t pmix_bfrops_base_unpack_pid(pmix_pointer_array_t *regtypes,
247 pmix_buffer_t *buffer, void *dest,
248 int32_t *num_vals, pmix_data_type_t type)
249 {
250 pmix_status_t ret;
251 pmix_data_type_t remote_type;
252
253 if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &remote_type))) {
254 return ret;
255 }
256
257 if (remote_type == BFROP_TYPE_PID_T) {
258
259
260 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, BFROP_TYPE_PID_T, regtypes);
261 } else {
262
263 PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, pid_t, remote_type, ret);
264 }
265
266 return ret;
267 }
268
269
270
271
272
273
274
275 pmix_status_t pmix_bfrops_base_unpack_byte(pmix_pointer_array_t *regtypes,
276 pmix_buffer_t *buffer, void *dest,
277 int32_t *num_vals, pmix_data_type_t type)
278 {
279 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
280 "pmix_bfrop_unpack_byte * %d\n", (int)*num_vals);
281
282
283 if (pmix_bfrop_too_small(buffer, *num_vals)) {
284 return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
285 }
286
287
288 memcpy(dest, buffer->unpack_ptr, *num_vals);
289
290
291 buffer->unpack_ptr += *num_vals;
292
293 return PMIX_SUCCESS;
294 }
295
296 pmix_status_t pmix_bfrops_base_unpack_int16(pmix_pointer_array_t *regtypes,
297 pmix_buffer_t *buffer, void *dest,
298 int32_t *num_vals, pmix_data_type_t type)
299 {
300 int32_t i;
301 uint16_t tmp, *desttmp = (uint16_t*) dest;
302
303 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
304 "pmix_bfrop_unpack_int16 * %d\n", (int)*num_vals);
305
306
307 if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(tmp))) {
308 return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
309 }
310
311
312 for (i = 0; i < (*num_vals); ++i) {
313 memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) );
314 tmp = pmix_ntohs(tmp);
315 memcpy(&desttmp[i], &tmp, sizeof(tmp));
316 buffer->unpack_ptr += sizeof(tmp);
317 }
318
319 return PMIX_SUCCESS;
320 }
321
322 pmix_status_t pmix_bfrops_base_unpack_int32(pmix_pointer_array_t *regtypes,
323 pmix_buffer_t *buffer, void *dest,
324 int32_t *num_vals, pmix_data_type_t type)
325 {
326 int32_t i;
327 uint32_t tmp, *desttmp = (uint32_t*) dest;
328
329 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
330 "pmix_bfrop_unpack_int32 * %d\n", (int)*num_vals);
331
332
333 if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(tmp))) {
334 return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
335 }
336
337
338 for (i = 0; i < (*num_vals); ++i) {
339 memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) );
340 tmp = ntohl(tmp);
341 memcpy(&desttmp[i], &tmp, sizeof(tmp));
342 buffer->unpack_ptr += sizeof(tmp);
343 }
344
345 return PMIX_SUCCESS;
346 }
347
348 pmix_status_t pmix_bfrops_base_unpack_datatype(pmix_pointer_array_t *regtypes,
349 pmix_buffer_t *buffer, void *dest,
350 int32_t *num_vals, pmix_data_type_t type)
351 {
352 pmix_status_t ret;
353
354 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_INT16, regtypes);
355 return ret;
356 }
357
358 pmix_status_t pmix_bfrops_base_unpack_int64(pmix_pointer_array_t *regtypes,
359 pmix_buffer_t *buffer, void *dest,
360 int32_t *num_vals, pmix_data_type_t type)
361 {
362 int32_t i;
363 uint64_t tmp, *desttmp = (uint64_t*) dest;
364
365 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
366 "pmix_bfrop_unpack_int64 * %d\n", (int)*num_vals);
367
368
369 if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(tmp))) {
370 return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
371 }
372
373
374 for (i = 0; i < (*num_vals); ++i) {
375 memcpy( &(tmp), buffer->unpack_ptr, sizeof(tmp) );
376 tmp = pmix_ntoh64(tmp);
377 memcpy(&desttmp[i], &tmp, sizeof(tmp));
378 buffer->unpack_ptr += sizeof(tmp);
379 }
380
381 return PMIX_SUCCESS;
382 }
383
384 pmix_status_t pmix_bfrops_base_unpack_string(pmix_pointer_array_t *regtypes,
385 pmix_buffer_t *buffer, void *dest,
386 int32_t *num_vals, pmix_data_type_t type)
387 {
388 pmix_status_t ret;
389 int32_t i, len, n=1;
390 char **sdest = (char**) dest;
391
392 for (i = 0; i < (*num_vals); ++i) {
393 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &len, &n, PMIX_INT32, regtypes);
394 if (PMIX_SUCCESS != ret) {
395 return ret;
396 }
397 if (0 == len) {
398 sdest[i] = NULL;
399 } else {
400 sdest[i] = (char*)malloc(len);
401 if (NULL == sdest[i]) {
402 return PMIX_ERR_OUT_OF_RESOURCE;
403 }
404 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, sdest[i], &len, PMIX_BYTE, regtypes);
405 if (PMIX_SUCCESS != ret) {
406 return ret;
407 }
408 }
409 }
410
411 return PMIX_SUCCESS;
412 }
413
414 pmix_status_t pmix_bfrops_base_unpack_float(pmix_pointer_array_t *regtypes,
415 pmix_buffer_t *buffer, void *dest,
416 int32_t *num_vals, pmix_data_type_t type)
417 {
418 int32_t i, n;
419 float *desttmp = (float*) dest, tmp;
420 pmix_status_t ret;
421 char *convert;
422
423 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
424 "pmix_bfrop_unpack_float * %d\n", (int)*num_vals);
425
426
427 for (i = 0; i < (*num_vals); ++i) {
428 n=1;
429 convert = NULL;
430 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &convert, &n, PMIX_STRING, regtypes);
431 if (PMIX_SUCCESS != ret) {
432 return ret;
433 }
434 if (NULL != convert) {
435 tmp = strtof(convert, NULL);
436 memcpy(&desttmp[i], &tmp, sizeof(tmp));
437 free(convert);
438 }
439 }
440 return PMIX_SUCCESS;
441 }
442
443 pmix_status_t pmix_bfrops_base_unpack_double(pmix_pointer_array_t *regtypes,
444 pmix_buffer_t *buffer, void *dest,
445 int32_t *num_vals, pmix_data_type_t type)
446 {
447 int32_t i, n;
448 double *desttmp = (double*) dest, tmp;
449 pmix_status_t ret;
450 char *convert;
451
452 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
453 "pmix_bfrop_unpack_double * %d\n", (int)*num_vals);
454
455
456 for (i = 0; i < (*num_vals); ++i) {
457 n=1;
458 convert = NULL;
459 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &convert, &n, PMIX_STRING, regtypes);
460 if (PMIX_SUCCESS != ret) {
461 return ret;
462 }
463 if (NULL != convert) {
464 tmp = strtod(convert, NULL);
465 memcpy(&desttmp[i], &tmp, sizeof(tmp));
466 free(convert);
467 }
468 }
469 return PMIX_SUCCESS;
470 }
471
472 pmix_status_t pmix_bfrops_base_unpack_timeval(pmix_pointer_array_t *regtypes,
473 pmix_buffer_t *buffer, void *dest,
474 int32_t *num_vals, pmix_data_type_t type)
475 {
476 int32_t i, n;
477 int64_t tmp[2];
478 struct timeval *desttmp = (struct timeval *) dest, tt;
479 pmix_status_t ret;
480
481 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
482 "pmix_bfrop_unpack_timeval * %d\n", (int)*num_vals);
483
484
485 for (i = 0; i < (*num_vals); ++i) {
486 n=2;
487 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, tmp, &n, PMIX_INT64, regtypes);
488 if (PMIX_SUCCESS != ret) {
489 return ret;
490 }
491 tt.tv_sec = tmp[0];
492 tt.tv_usec = tmp[1];
493 memcpy(&desttmp[i], &tt, sizeof(tt));
494 }
495 return PMIX_SUCCESS;
496 }
497
498 pmix_status_t pmix_bfrops_base_unpack_time(pmix_pointer_array_t *regtypes,
499 pmix_buffer_t *buffer, void *dest,
500 int32_t *num_vals, pmix_data_type_t type)
501 {
502 int32_t i, n;
503 time_t *desttmp = (time_t *) dest, tmp;
504 pmix_status_t ret;
505 uint64_t ui64;
506
507
508
509
510
511 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
512 "pmix_bfrop_unpack_time * %d\n", (int)*num_vals);
513
514
515 for (i = 0; i < (*num_vals); ++i) {
516 n=1;
517 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ui64, &n, PMIX_UINT64, regtypes);
518 if (PMIX_SUCCESS != ret) {
519 return ret;
520 }
521 tmp = (time_t)ui64;
522 memcpy(&desttmp[i], &tmp, sizeof(tmp));
523 }
524 return PMIX_SUCCESS;
525 }
526
527
528 pmix_status_t pmix_bfrops_base_unpack_status(pmix_pointer_array_t *regtypes,
529 pmix_buffer_t *buffer, void *dest,
530 int32_t *num_vals, pmix_data_type_t type)
531 {
532 pmix_status_t ret;
533
534 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
535 "pmix_bfrop_unpack_status * %d\n", (int)*num_vals);
536
537
538 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_INT32, regtypes);
539 return ret;
540 }
541
542
543
544
545
546
547
548 pmix_status_t pmix_bfrops_base_unpack_val(pmix_pointer_array_t *regtypes,
549 pmix_buffer_t *buffer,
550 pmix_value_t *val)
551 {
552 int m;
553 pmix_status_t ret = PMIX_SUCCESS;
554
555 m = 1;
556 switch (val->type) {
557 case PMIX_UNDEF:
558 break;
559 case PMIX_PROC:
560
561 PMIX_PROC_CREATE(val->data.proc, m);
562 if (NULL == val->data.proc) {
563 return PMIX_ERR_NOMEM;
564 }
565 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, val->data.proc, &m, PMIX_PROC, regtypes);
566 break;
567 case PMIX_PROC_INFO:
568
569 PMIX_PROC_INFO_CREATE(val->data.pinfo, 1);
570 if (NULL == val->data.pinfo) {
571 return PMIX_ERR_NOMEM;
572 }
573 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, val->data.pinfo, &m, PMIX_PROC_INFO, regtypes);
574 break;
575 case PMIX_DATA_ARRAY:
576
577 val->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t));
578 if (NULL == val->data.darray) {
579 return PMIX_ERR_NOMEM;
580 }
581 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, val->data.darray, &m, PMIX_DATA_ARRAY, regtypes);
582 break;
583 case PMIX_COORD:
584 val->data.coord = (pmix_coord_t*)malloc(sizeof(pmix_coord_t));
585 if (NULL == val->data.coord) {
586 return PMIX_ERR_NOMEM;
587 }
588 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, val->data.coord, &m, PMIX_COORD, regtypes);
589 return ret;
590 default:
591 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &val->data, &m, val->type, regtypes);
592 if (PMIX_ERR_UNKNOWN_DATA_TYPE == ret) {
593 pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type);
594 }
595 }
596
597 return ret;
598 }
599
600 pmix_status_t pmix_bfrops_base_unpack_value(pmix_pointer_array_t *regtypes,
601 pmix_buffer_t *buffer, void *dest,
602 int32_t *num_vals, pmix_data_type_t type)
603 {
604 pmix_value_t *ptr;
605 int32_t i, n;
606 pmix_status_t ret;
607
608 ptr = (pmix_value_t *) dest;
609 n = *num_vals;
610
611 for (i = 0; i < n; ++i) {
612
613 if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &ptr[i].type))) {
614 PMIX_ERROR_LOG(ret);
615 return ret;
616 }
617
618 if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(regtypes, buffer, &ptr[i])) ) {
619 PMIX_ERROR_LOG(ret);
620 return ret;
621 }
622 }
623 return PMIX_SUCCESS;
624 }
625
626 pmix_status_t pmix_bfrops_base_unpack_info(pmix_pointer_array_t *regtypes,
627 pmix_buffer_t *buffer, void *dest,
628 int32_t *num_vals, pmix_data_type_t type)
629 {
630 pmix_info_t *ptr;
631 int32_t i, n, m;
632 pmix_status_t ret;
633 char *tmp;
634
635 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
636 "pmix_bfrop_unpack: %d info", *num_vals);
637
638 ptr = (pmix_info_t *) dest;
639 n = *num_vals;
640
641 for (i = 0; i < n; ++i) {
642 memset(ptr[i].key, 0, sizeof(ptr[i].key));
643 memset(&ptr[i].value, 0, sizeof(pmix_value_t));
644
645 m=1;
646 tmp = NULL;
647 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes);
648 if (PMIX_SUCCESS != ret) {
649 PMIX_ERROR_LOG(ret);
650 return ret;
651 }
652 if (NULL == tmp) {
653 return PMIX_ERROR;
654 }
655 pmix_strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN);
656 free(tmp);
657
658 m=1;
659 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].flags, &m, PMIX_INFO_DIRECTIVES, regtypes);
660 if (PMIX_SUCCESS != ret) {
661 return ret;
662 }
663
664
665
666 if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &ptr[i].value.type))) {
667 return ret;
668 }
669 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
670 "pmix_bfrop_unpack: info type %d", ptr[i].value.type);
671 m=1;
672 if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(regtypes, buffer, &ptr[i].value))) {
673 return ret;
674 }
675 }
676 return PMIX_SUCCESS;
677 }
678
679 pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_pointer_array_t *regtypes,
680 pmix_buffer_t *buffer, void *dest,
681 int32_t *num_vals, pmix_data_type_t type)
682 {
683 pmix_pdata_t *ptr;
684 int32_t i, n, m;
685 pmix_status_t ret;
686 char *tmp;
687
688 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
689 "pmix_bfrop_unpack: %d pdata", *num_vals);
690
691 ptr = (pmix_pdata_t *) dest;
692 n = *num_vals;
693
694 for (i = 0; i < n; ++i) {
695 PMIX_PDATA_CONSTRUCT(&ptr[i]);
696
697 m=1;
698 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].proc, &m, PMIX_PROC, regtypes);
699 if (PMIX_SUCCESS != ret) {
700 return ret;
701 }
702
703 m=1;
704 tmp = NULL;
705 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes);
706 if (PMIX_SUCCESS != ret) {
707 return ret;
708 }
709 if (NULL == tmp) {
710 PMIX_ERROR_LOG(PMIX_ERROR);
711 return PMIX_ERROR;
712 }
713 pmix_strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN);
714 free(tmp);
715
716
717
718 if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &ptr[i].value.type))) {
719 PMIX_ERROR_LOG(ret);
720 return ret;
721 }
722 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
723 "pmix_bfrop_unpack: pdata type %d %s", ptr[i].value.type, ptr[i].value.data.string);
724 m=1;
725 if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(regtypes, buffer, &ptr[i].value))) {
726 PMIX_ERROR_LOG(ret);
727 return ret;
728 }
729 }
730 return PMIX_SUCCESS;
731 }
732
733 pmix_status_t pmix_bfrops_base_unpack_buf(pmix_pointer_array_t *regtypes,
734 pmix_buffer_t *buffer, void *dest,
735 int32_t *num_vals, pmix_data_type_t type)
736 {
737 pmix_buffer_t *ptr;
738 int32_t i, n, m;
739 pmix_status_t ret;
740 size_t nbytes;
741
742 ptr = (pmix_buffer_t *) dest;
743 n = *num_vals;
744
745 for (i = 0; i < n; ++i) {
746 PMIX_CONSTRUCT(&ptr[i], pmix_buffer_t);
747
748 m=1;
749 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].type, &m, PMIX_BYTE, regtypes);
750 if (PMIX_SUCCESS != ret) {
751 return ret;
752 }
753
754 m=1;
755 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &nbytes, &m, PMIX_SIZE, regtypes);
756 if (PMIX_SUCCESS != ret) {
757 return ret;
758 }
759 m = nbytes;
760
761 if (0 < nbytes) {
762 ptr[i].base_ptr = (char*)malloc(nbytes);
763 if (NULL == ptr[i].base_ptr) {
764 return PMIX_ERR_NOMEM;
765 }
766
767 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].base_ptr, &m, PMIX_BYTE, regtypes);
768 if (PMIX_SUCCESS != ret) {
769 return ret;
770 }
771 }
772 ptr[i].pack_ptr = ptr[i].base_ptr + m;
773 ptr[i].unpack_ptr = ptr[i].base_ptr;
774 ptr[i].bytes_allocated = nbytes;
775 ptr[i].bytes_used = m;
776 }
777 return PMIX_SUCCESS;
778 }
779
780 pmix_status_t pmix_bfrops_base_unpack_proc(pmix_pointer_array_t *regtypes,
781 pmix_buffer_t *buffer, void *dest,
782 int32_t *num_vals, pmix_data_type_t type)
783 {
784 pmix_proc_t *ptr;
785 int32_t i, n, m;
786 pmix_status_t ret;
787 char *tmp;
788
789 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
790 "pmix_bfrop_unpack: %d procs", *num_vals);
791
792 ptr = (pmix_proc_t *) dest;
793 n = *num_vals;
794
795 for (i = 0; i < n; ++i) {
796 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
797 "pmix_bfrop_unpack: init proc[%d]", i);
798 memset(&ptr[i], 0, sizeof(pmix_proc_t));
799
800 m=1;
801 tmp = NULL;
802 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes);
803 if (PMIX_SUCCESS != ret) {
804 return ret;
805 }
806 if (NULL == tmp) {
807 PMIX_ERROR_LOG(PMIX_ERROR);
808 return PMIX_ERROR;
809 }
810 pmix_strncpy(ptr[i].nspace, tmp, PMIX_MAX_NSLEN);
811 free(tmp);
812
813 m=1;
814 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].rank, &m, PMIX_PROC_RANK, regtypes);
815 if (PMIX_SUCCESS != ret) {
816 return ret;
817 }
818 }
819 return PMIX_SUCCESS;
820 }
821
822 pmix_status_t pmix_bfrops_base_unpack_app(pmix_pointer_array_t *regtypes,
823 pmix_buffer_t *buffer, void *dest,
824 int32_t *num_vals, pmix_data_type_t type)
825 {
826 pmix_app_t *ptr;
827 int32_t i, k, n, m;
828 pmix_status_t ret;
829 int32_t nval;
830 char *tmp;
831
832 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
833 "pmix_bfrop_unpack: %d apps", *num_vals);
834
835 ptr = (pmix_app_t *) dest;
836 n = *num_vals;
837
838 for (i = 0; i < n; ++i) {
839
840 PMIX_APP_CONSTRUCT(&ptr[i]);
841
842 m=1;
843 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].cmd, &m, PMIX_STRING, regtypes);
844 if (PMIX_SUCCESS != ret) {
845 return ret;
846 }
847
848 m=1;
849 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &nval, &m, PMIX_INT32, regtypes);
850 if (PMIX_SUCCESS != ret) {
851 return ret;
852 }
853
854 for (k=0; k < nval; k++) {
855 m=1;
856 tmp = NULL;
857 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes);
858 if (PMIX_SUCCESS != ret) {
859 return ret;
860 }
861 if (NULL == tmp) {
862 return PMIX_ERROR;
863 }
864 pmix_argv_append_nosize(&ptr[i].argv, tmp);
865 free(tmp);
866 }
867
868 m=1;
869 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &nval, &m, PMIX_INT32, regtypes);
870 if (PMIX_SUCCESS != ret) {
871 return ret;
872 }
873 for (k=0; k < nval; k++) {
874 m=1;
875 tmp = NULL;
876 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes);
877 if (PMIX_SUCCESS != ret) {
878 return ret;
879 }
880 if (NULL == tmp) {
881 return PMIX_ERROR;
882 }
883 pmix_argv_append_nosize(&ptr[i].env, tmp);
884 free(tmp);
885 }
886
887 m=1;
888 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].cwd, &m, PMIX_STRING, regtypes);
889 if (PMIX_SUCCESS != ret) {
890 return ret;
891 }
892
893 m=1;
894 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].maxprocs, &m, PMIX_INT, regtypes);
895 if (PMIX_SUCCESS != ret) {
896 return ret;
897 }
898
899 m=1;
900 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].ninfo, &m, PMIX_SIZE, regtypes);
901 if (PMIX_SUCCESS != ret) {
902 return ret;
903 }
904 if (0 < ptr[i].ninfo) {
905 PMIX_INFO_CREATE(ptr[i].info, ptr[i].ninfo);
906 m = ptr[i].ninfo;
907 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].info, &m, PMIX_INFO, regtypes);
908 if (PMIX_SUCCESS != ret) {
909 return ret;
910 }
911 }
912 }
913 return PMIX_SUCCESS;
914 }
915
916 pmix_status_t pmix_bfrops_base_unpack_kval(pmix_pointer_array_t *regtypes,
917 pmix_buffer_t *buffer, void *dest,
918 int32_t *num_vals, pmix_data_type_t type)
919 {
920 pmix_kval_t *ptr;
921 int32_t i, n, m;
922 pmix_status_t ret;
923
924 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
925 "pmix_bfrop_unpack: %d kvals", *num_vals);
926
927 ptr = (pmix_kval_t*) dest;
928 n = *num_vals;
929
930 for (i = 0; i < n; ++i) {
931 PMIX_CONSTRUCT(&ptr[i], pmix_kval_t);
932
933 m = 1;
934 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].key, &m, PMIX_STRING, regtypes);
935 if (PMIX_SUCCESS != ret) {
936 return ret;
937 }
938
939 ptr[i].value = (pmix_value_t*)malloc(sizeof(pmix_value_t));
940
941 m = 1;
942 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].value, &m, PMIX_VALUE, regtypes);
943 if (PMIX_SUCCESS != ret) {
944 return ret;
945 }
946 }
947 return PMIX_SUCCESS;
948 }
949
950 pmix_status_t pmix_bfrops_base_unpack_persist(pmix_pointer_array_t *regtypes,
951 pmix_buffer_t *buffer, void *dest,
952 int32_t *num_vals, pmix_data_type_t type)
953 {
954 pmix_status_t ret;
955 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_BYTE, regtypes);
956 return ret;
957 }
958
959 pmix_status_t pmix_bfrops_base_unpack_bo(pmix_pointer_array_t *regtypes,
960 pmix_buffer_t *buffer, void *dest,
961 int32_t *num_vals, pmix_data_type_t type)
962 {
963 pmix_byte_object_t *ptr;
964 int32_t i, n, m;
965 pmix_status_t ret;
966
967 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
968 "pmix_bfrop_unpack: %d byte_object", *num_vals);
969
970 ptr = (pmix_byte_object_t *) dest;
971 n = *num_vals;
972
973 for (i = 0; i < n; ++i) {
974 memset(&ptr[i], 0, sizeof(pmix_byte_object_t));
975
976 m=1;
977 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].size, &m, PMIX_SIZE, regtypes);
978 if (PMIX_SUCCESS != ret) {
979 return ret;
980 }
981 if (0 < ptr[i].size) {
982 ptr[i].bytes = (char*)malloc(ptr[i].size * sizeof(char));
983 m=ptr[i].size;
984 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].bytes, &m, PMIX_BYTE, regtypes);
985 if (PMIX_SUCCESS != ret) {
986 return ret;
987 }
988 }
989 }
990 return PMIX_SUCCESS;
991 }
992
993 pmix_status_t pmix_bfrops_base_unpack_ptr(pmix_pointer_array_t *regtypes,
994 pmix_buffer_t *buffer, void *dest,
995 int32_t *num_vals, pmix_data_type_t type)
996 {
997 uint8_t foo=1;
998 int32_t cnt=1;
999 pmix_status_t ret;
1000
1001
1002
1003 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &foo, &cnt, PMIX_UINT8, regtypes);
1004 return ret;
1005 }
1006
1007 pmix_status_t pmix_bfrops_base_unpack_scope(pmix_pointer_array_t *regtypes,
1008 pmix_buffer_t *buffer, void *dest,
1009 int32_t *num_vals, pmix_data_type_t type)
1010 {
1011 pmix_status_t ret;
1012 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT8, regtypes);
1013 return ret;
1014 }
1015
1016 pmix_status_t pmix_bfrops_base_unpack_range(pmix_pointer_array_t *regtypes,
1017 pmix_buffer_t *buffer, void *dest,
1018 int32_t *num_vals, pmix_data_type_t type)
1019 {
1020 pmix_status_t ret;
1021 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT8, regtypes);
1022 return ret;
1023 }
1024
1025 pmix_status_t pmix_bfrops_base_unpack_cmd(pmix_pointer_array_t *regtypes,
1026 pmix_buffer_t *buffer, void *dest,
1027 int32_t *num_vals, pmix_data_type_t type)
1028 {
1029 pmix_status_t ret;
1030 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT8, regtypes);
1031 return ret;
1032 }
1033
1034 pmix_status_t pmix_bfrops_base_unpack_info_directives(pmix_pointer_array_t *regtypes,
1035 pmix_buffer_t *buffer, void *dest,
1036 int32_t *num_vals, pmix_data_type_t type)
1037 {
1038 pmix_status_t ret;
1039 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT32, regtypes);
1040 return ret;
1041 }
1042
1043 pmix_status_t pmix_bfrops_base_unpack_pstate(pmix_pointer_array_t *regtypes,
1044 pmix_buffer_t *buffer, void *dest,
1045 int32_t *num_vals, pmix_data_type_t type)
1046 {
1047 pmix_status_t ret;
1048 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT8, regtypes);
1049 return ret;
1050 }
1051
1052
1053 pmix_status_t pmix_bfrops_base_unpack_pinfo(pmix_pointer_array_t *regtypes,
1054 pmix_buffer_t *buffer, void *dest,
1055 int32_t *num_vals, pmix_data_type_t type)
1056 {
1057 pmix_proc_info_t *ptr;
1058 int32_t i, n, m;
1059 pmix_status_t ret;
1060
1061 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
1062 "pmix_bfrop_unpack: %d pinfo", *num_vals);
1063
1064 ptr = (pmix_proc_info_t *) dest;
1065 n = *num_vals;
1066
1067 for (i = 0; i < n; ++i) {
1068 PMIX_PROC_INFO_CONSTRUCT(&ptr[i]);
1069
1070 m=1;
1071 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].proc, &m, PMIX_PROC, regtypes);
1072 if (PMIX_SUCCESS != ret) {
1073 return ret;
1074 }
1075
1076 m=1;
1077 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].hostname, &m, PMIX_STRING, regtypes);
1078 if (PMIX_SUCCESS != ret) {
1079 return ret;
1080 }
1081
1082 m=1;
1083 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].executable_name, &m, PMIX_STRING, regtypes);
1084 if (PMIX_SUCCESS != ret) {
1085 return ret;
1086 }
1087
1088 m=1;
1089 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].pid, &m, PMIX_PID, regtypes);
1090 if (PMIX_SUCCESS != ret) {
1091 return ret;
1092 }
1093
1094 m=1;
1095 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].state, &m, PMIX_PROC_STATE, regtypes);
1096 if (PMIX_SUCCESS != ret) {
1097 return ret;
1098 }
1099 }
1100 return PMIX_SUCCESS;
1101 }
1102
1103 pmix_status_t pmix_bfrops_base_unpack_darray(pmix_pointer_array_t *regtypes,
1104 pmix_buffer_t *buffer, void *dest,
1105 int32_t *num_vals, pmix_data_type_t type)
1106 {
1107 pmix_data_array_t *ptr;
1108 int32_t i, n, m;
1109 pmix_status_t ret;
1110 pmix_data_type_t t;
1111
1112 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
1113 "pmix_bfrop_unpack: %d data arrays", *num_vals);
1114
1115 ptr = (pmix_data_array_t *) dest;
1116 n = *num_vals;
1117
1118 for (i = 0; i < n; ++i) {
1119 memset(&ptr[i], 0, sizeof(pmix_data_array_t));
1120
1121 m=1;
1122 if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &ptr[i].type))) {
1123 return ret;
1124 }
1125
1126 m=1;
1127 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].size, &m, PMIX_SIZE, regtypes);
1128 if (PMIX_SUCCESS != ret) {
1129 return ret;
1130 }
1131 if (0 == ptr[i].size || PMIX_UNDEF == ptr[i].type) {
1132
1133 continue;
1134 }
1135
1136 m = ptr[i].size;
1137 t = ptr[i].type;
1138
1139 PMIX_DATA_ARRAY_CONSTRUCT(&ptr[i], m, t);
1140 if (NULL == ptr[i].array) {
1141 return PMIX_ERR_NOMEM;
1142 }
1143 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].array, &m, t, regtypes);
1144 if (PMIX_SUCCESS != ret) {
1145 return ret;
1146 }
1147 }
1148 return PMIX_SUCCESS;
1149 }
1150
1151 pmix_status_t pmix_bfrops_base_unpack_rank(pmix_pointer_array_t *regtypes,
1152 pmix_buffer_t *buffer, void *dest,
1153 int32_t *num_vals, pmix_data_type_t type)
1154 {
1155 pmix_status_t ret;
1156 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT32, regtypes);
1157 return ret;
1158 }
1159
1160 pmix_status_t pmix_bfrops_base_unpack_query(pmix_pointer_array_t *regtypes,
1161 pmix_buffer_t *buffer, void *dest,
1162 int32_t *num_vals, pmix_data_type_t type)
1163 {
1164 pmix_query_t *ptr;
1165 int32_t i, n, m;
1166 pmix_status_t ret;
1167 int32_t nkeys;
1168
1169 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
1170 "pmix_bfrop_unpack: %d queries", *num_vals);
1171
1172 ptr = (pmix_query_t *) dest;
1173 n = *num_vals;
1174
1175 for (i = 0; i < n; ++i) {
1176 PMIX_QUERY_CONSTRUCT(&ptr[i]);
1177
1178 m=1;
1179 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &nkeys, &m, PMIX_INT32, regtypes);
1180 if (PMIX_SUCCESS != ret) {
1181 return ret;
1182 }
1183 if (0 < nkeys) {
1184
1185 if (NULL == (ptr[i].keys = (char**)calloc(nkeys+1, sizeof(char*)))) {
1186 return PMIX_ERR_NOMEM;
1187 }
1188
1189 m=nkeys;
1190 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].keys, &m, PMIX_STRING, regtypes);
1191 if (PMIX_SUCCESS != ret) {
1192 return ret;
1193 }
1194 }
1195
1196 m=1;
1197 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].nqual, &m, PMIX_SIZE, regtypes);
1198 if (PMIX_SUCCESS != ret) {
1199 return ret;
1200 }
1201 if (0 < ptr[i].nqual) {
1202
1203 PMIX_INFO_CREATE(ptr[i].qualifiers, ptr[i].nqual);
1204 m = ptr[i].nqual;
1205 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].qualifiers, &m, PMIX_INFO, regtypes);
1206 if (PMIX_SUCCESS != ret) {
1207 return ret;
1208 }
1209 }
1210 }
1211 return PMIX_SUCCESS;
1212 }
1213
1214 pmix_status_t pmix_bfrops_base_unpack_alloc_directive(pmix_pointer_array_t *regtypes,
1215 pmix_buffer_t *buffer, void *dest,
1216 int32_t *num_vals, pmix_data_type_t type)
1217 {
1218 pmix_status_t ret;
1219 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT8, regtypes);
1220 return ret;
1221 }
1222
1223 pmix_status_t pmix_bfrops_base_unpack_iof_channel(pmix_pointer_array_t *regtypes,
1224 pmix_buffer_t *buffer, void *dest,
1225 int32_t *num_vals, pmix_data_type_t type)
1226 {
1227 pmix_status_t ret;
1228 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT16, regtypes);
1229 return ret;
1230 }
1231
1232 pmix_status_t pmix_bfrops_base_unpack_envar(pmix_pointer_array_t *regtypes,
1233 pmix_buffer_t *buffer, void *dest,
1234 int32_t *num_vals, pmix_data_type_t type)
1235 {
1236 pmix_envar_t *ptr;
1237 int32_t i, n, m;
1238 pmix_status_t ret;
1239
1240 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
1241 "pmix_bfrop_unpack: %d envars", *num_vals);
1242
1243 ptr = (pmix_envar_t *) dest;
1244 n = *num_vals;
1245
1246 for (i = 0; i < n; ++i) {
1247 PMIX_ENVAR_CONSTRUCT(&ptr[i]);
1248
1249 m=1;
1250 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].envar, &m, PMIX_STRING, regtypes);
1251 if (PMIX_SUCCESS != ret) {
1252 return ret;
1253 }
1254
1255 m=1;
1256 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].value, &m, PMIX_STRING, regtypes);
1257 if (PMIX_SUCCESS != ret) {
1258 return ret;
1259 }
1260
1261 m=1;
1262 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].separator, &m, PMIX_BYTE, regtypes);
1263 if (PMIX_SUCCESS != ret) {
1264 return ret;
1265 }
1266 }
1267 return PMIX_SUCCESS;
1268 }
1269
1270 pmix_status_t pmix_bfrops_base_unpack_coord(pmix_pointer_array_t *regtypes,
1271 pmix_buffer_t *buffer, void *dest,
1272 int32_t *num_vals, pmix_data_type_t type)
1273 {
1274 pmix_coord_t *ptr;
1275 int32_t i, n, m;
1276 pmix_status_t ret;
1277
1278 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
1279 "pmix_bfrop_unpack: %d coordinates", *num_vals);
1280
1281 ptr = (pmix_coord_t *) dest;
1282 n = *num_vals;
1283
1284 for (i = 0; i < n; ++i) {
1285
1286 m=1;
1287 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].x, &m, PMIX_INT, regtypes);
1288 if (PMIX_SUCCESS != ret) {
1289 return ret;
1290 }
1291
1292 m=1;
1293 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].y, &m, PMIX_INT, regtypes);
1294 if (PMIX_SUCCESS != ret) {
1295 return ret;
1296 }
1297
1298 m=1;
1299 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].z, &m, PMIX_INT, regtypes);
1300 if (PMIX_SUCCESS != ret) {
1301 return ret;
1302 }
1303 }
1304 return PMIX_SUCCESS;
1305 }
1306
1307 pmix_status_t pmix_bfrops_base_unpack_regattr(pmix_pointer_array_t *regtypes,
1308 pmix_buffer_t *buffer, void *dest,
1309 int32_t *num_vals, pmix_data_type_t type)
1310 {
1311 pmix_regattr_t *ptr;
1312 int32_t i, n, m, nd;
1313 pmix_status_t ret;
1314 char *tmp;
1315
1316 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
1317 "pmix_bfrop_unpack: %d regattrs", *num_vals);
1318
1319 ptr = (pmix_regattr_t *) dest;
1320 n = *num_vals;
1321
1322 for (i = 0; i < n; ++i) {
1323 PMIX_REGATTR_CONSTRUCT(&ptr[i]);
1324
1325 m=1;
1326 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].name, &m, PMIX_STRING, regtypes);
1327 if (PMIX_SUCCESS != ret) {
1328 return ret;
1329 }
1330
1331 m=1;
1332 tmp = NULL;
1333 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes);
1334 if (PMIX_SUCCESS != ret) {
1335 PMIX_ERROR_LOG(ret);
1336 return ret;
1337 }
1338 if (NULL == tmp) {
1339 return PMIX_ERROR;
1340 }
1341 pmix_strncpy(ptr[i].string, tmp, PMIX_MAX_KEYLEN);
1342 free(tmp);
1343
1344 m=1;
1345 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].type, &m, PMIX_DATA_TYPE, regtypes);
1346 if (PMIX_SUCCESS != ret) {
1347 PMIX_ERROR_LOG(ret);
1348 return ret;
1349 }
1350
1351 m=1;
1352 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].ninfo, &m, PMIX_SIZE, regtypes);
1353 if (PMIX_SUCCESS != ret) {
1354 PMIX_ERROR_LOG(ret);
1355 return ret;
1356 }
1357 if (0 < ptr[i].ninfo) {
1358
1359 PMIX_INFO_CREATE(ptr[i].info, ptr[i].ninfo);
1360 m = ptr[i].ninfo;
1361 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].info, &m, PMIX_INFO, regtypes);
1362 if (PMIX_SUCCESS != ret) {
1363 PMIX_ERROR_LOG(ret);
1364 return ret;
1365 }
1366 }
1367
1368 m=1;
1369 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &nd, &m, PMIX_INT32, regtypes);
1370 if (PMIX_SUCCESS != ret) {
1371 PMIX_ERROR_LOG(ret);
1372 return ret;
1373 }
1374 if (0 < nd) {
1375
1376 if (NULL == (ptr[i].description = (char**)calloc(nd+1, sizeof(char*)))) {
1377 return PMIX_ERR_NOMEM;
1378 }
1379 m=nd;
1380 PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].description, &m, PMIX_STRING, regtypes);
1381 if (PMIX_SUCCESS != ret) {
1382 PMIX_ERROR_LOG(ret);
1383 return ret;
1384 }
1385 }
1386 }
1387 return PMIX_SUCCESS;
1388 }