This source file includes following definitions.
- init
- finalize
- pmix3_pack
- pmix3_unpack
- pmix3_copy
- pmix3_print
- register_type
- data_type_string
- pmix3_bfrop_pack_array
- pmix3_bfrop_pack_modex
- pmix3_bfrop_unpack_array
- pmix3_bfrop_unpack_modex
- pmix3_bfrop_copy_array
- pmix3_bfrop_copy_modex
- pmix3_bfrop_print_array
- pmix3_bfrop_print_modex
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
26
27 #include <src/include/pmix_config.h>
28
29 #include "src/mca/bfrops/base/base.h"
30 #include "bfrop_pmix3.h"
31
32 static pmix_status_t init(void);
33 static void finalize(void);
34 static pmix_status_t pmix3_pack(pmix_buffer_t *buffer,
35 const void *src, int num_vals,
36 pmix_data_type_t type);
37 static pmix_status_t pmix3_unpack(pmix_buffer_t *buffer, void *dest,
38 int32_t *num_vals, pmix_data_type_t type);
39 static pmix_status_t pmix3_copy(void **dest, void *src,
40 pmix_data_type_t type);
41 static pmix_status_t pmix3_print(char **output, char *prefix,
42 void *src, pmix_data_type_t type);
43 static pmix_status_t register_type(const char *name,
44 pmix_data_type_t type,
45 pmix_bfrop_pack_fn_t pack,
46 pmix_bfrop_unpack_fn_t unpack,
47 pmix_bfrop_copy_fn_t copy,
48 pmix_bfrop_print_fn_t print);
49 static const char* data_type_string(pmix_data_type_t type);
50
51 pmix_bfrops_module_t pmix_bfrops_pmix3_module = {
52 .version = "v3",
53 .init = init,
54 .finalize = finalize,
55 .pack = pmix3_pack,
56 .unpack = pmix3_unpack,
57 .copy = pmix3_copy,
58 .print = pmix3_print,
59 .copy_payload = pmix_bfrops_base_copy_payload,
60 .value_xfer = pmix_bfrops_base_value_xfer,
61 .value_load = pmix_bfrops_base_value_load,
62 .value_unload = pmix_bfrops_base_value_unload,
63 .value_cmp = pmix_bfrops_base_value_cmp,
64 .register_type = register_type,
65 .data_type_string = data_type_string
66 };
67
68
69 #define PMIX_MODEX 29
70 #define PMIX_INFO_ARRAY 44
71
72
73 typedef struct pmix_modex_data {
74 char nspace[PMIX_MAX_NSLEN+1];
75 int rank;
76 uint8_t *blob;
77 size_t size;
78 } pmix_modex_data_t;
79
80 static pmix_status_t pmix3_bfrop_pack_array(pmix_pointer_array_t *regtypes,
81 pmix_buffer_t *buffer, const void *src,
82 int32_t num_vals, pmix_data_type_t type);
83 static pmix_status_t pmix3_bfrop_pack_modex(pmix_pointer_array_t *regtypes,
84 pmix_buffer_t *buffer, const void *src,
85 int32_t num_vals, pmix_data_type_t type);
86 static pmix_status_t pmix3_bfrop_unpack_array(pmix_pointer_array_t *regtypes,
87 pmix_buffer_t *buffer, void *dest,
88 int32_t *num_vals, pmix_data_type_t type);
89 static pmix_status_t pmix3_bfrop_unpack_modex(pmix_pointer_array_t *regtypes,
90 pmix_buffer_t *buffer, void *dest,
91 int32_t *num_vals, pmix_data_type_t type);
92 static pmix_status_t pmix3_bfrop_copy_array(pmix_info_array_t **dest,
93 pmix_info_array_t *src,
94 pmix_data_type_t type);
95 static pmix_status_t pmix3_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src,
96 pmix_data_type_t type);
97 static pmix_status_t pmix3_bfrop_print_array(char **output, char *prefix,
98 pmix_info_array_t *src, pmix_data_type_t type);
99 static pmix_status_t pmix3_bfrop_print_modex(char **output, char *prefix,
100 pmix_modex_data_t *src, pmix_data_type_t type);
101
102
103 static pmix_status_t init(void)
104 {
105
106 PMIX_REGISTER_TYPE("PMIX_BOOL", PMIX_BOOL,
107 pmix_bfrops_base_pack_bool,
108 pmix_bfrops_base_unpack_bool,
109 pmix_bfrops_base_std_copy,
110 pmix_bfrops_base_print_bool,
111 &mca_bfrops_v3_component.types);
112
113 PMIX_REGISTER_TYPE("PMIX_BYTE", PMIX_BYTE,
114 pmix_bfrops_base_pack_byte,
115 pmix_bfrops_base_unpack_byte,
116 pmix_bfrops_base_std_copy,
117 pmix_bfrops_base_print_byte,
118 &mca_bfrops_v3_component.types);
119
120 PMIX_REGISTER_TYPE("PMIX_STRING", PMIX_STRING,
121 pmix_bfrops_base_pack_string,
122 pmix_bfrops_base_unpack_string,
123 pmix_bfrops_base_copy_string,
124 pmix_bfrops_base_print_string,
125 &mca_bfrops_v3_component.types);
126
127
128 PMIX_REGISTER_TYPE("PMIX_SIZE", PMIX_SIZE,
129 pmix_bfrops_base_pack_sizet,
130 pmix_bfrops_base_unpack_sizet,
131 pmix_bfrops_base_std_copy,
132 pmix_bfrops_base_print_size,
133 &mca_bfrops_v3_component.types);
134
135 PMIX_REGISTER_TYPE("PMIX_PID", PMIX_PID,
136 pmix_bfrops_base_pack_pid,
137 pmix_bfrops_base_unpack_pid,
138 pmix_bfrops_base_std_copy,
139 pmix_bfrops_base_print_pid,
140 &mca_bfrops_v3_component.types);
141
142 PMIX_REGISTER_TYPE("PMIX_INT", PMIX_INT,
143 pmix_bfrops_base_pack_int,
144 pmix_bfrops_base_unpack_int,
145 pmix_bfrops_base_std_copy,
146 pmix_bfrops_base_print_int,
147 &mca_bfrops_v3_component.types);
148
149
150 PMIX_REGISTER_TYPE("PMIX_INT8", PMIX_INT8,
151 pmix_bfrops_base_pack_byte,
152 pmix_bfrops_base_unpack_byte,
153 pmix_bfrops_base_std_copy,
154 pmix_bfrops_base_print_int8,
155 &mca_bfrops_v3_component.types);
156
157 PMIX_REGISTER_TYPE("PMIX_INT16", PMIX_INT16,
158 pmix_bfrops_base_pack_int16,
159 pmix_bfrops_base_unpack_int16,
160 pmix_bfrops_base_std_copy,
161 pmix_bfrops_base_print_int16,
162 &mca_bfrops_v3_component.types);
163
164 PMIX_REGISTER_TYPE("PMIX_INT32", PMIX_INT32,
165 pmix_bfrops_base_pack_int32,
166 pmix_bfrops_base_unpack_int32,
167 pmix_bfrops_base_std_copy,
168 pmix_bfrops_base_print_int32,
169 &mca_bfrops_v3_component.types);
170
171 PMIX_REGISTER_TYPE("PMIX_INT64", PMIX_INT64,
172 pmix_bfrops_base_pack_int64,
173 pmix_bfrops_base_unpack_int64,
174 pmix_bfrops_base_std_copy,
175 pmix_bfrops_base_print_int64,
176 &mca_bfrops_v3_component.types);
177
178 PMIX_REGISTER_TYPE("PMIX_UINT", PMIX_UINT,
179 pmix_bfrops_base_pack_int,
180 pmix_bfrops_base_unpack_int,
181 pmix_bfrops_base_std_copy,
182 pmix_bfrops_base_print_uint,
183 &mca_bfrops_v3_component.types);
184
185 PMIX_REGISTER_TYPE("PMIX_UINT8", PMIX_UINT8,
186 pmix_bfrops_base_pack_byte,
187 pmix_bfrops_base_unpack_byte,
188 pmix_bfrops_base_std_copy,
189 pmix_bfrops_base_print_uint8,
190 &mca_bfrops_v3_component.types);
191
192 PMIX_REGISTER_TYPE("PMIX_UINT16", PMIX_UINT16,
193 pmix_bfrops_base_pack_int16,
194 pmix_bfrops_base_unpack_int16,
195 pmix_bfrops_base_std_copy,
196 pmix_bfrops_base_print_uint16,
197 &mca_bfrops_v3_component.types);
198
199 PMIX_REGISTER_TYPE("PMIX_UINT32", PMIX_UINT32,
200 pmix_bfrops_base_pack_int32,
201 pmix_bfrops_base_unpack_int32,
202 pmix_bfrops_base_std_copy,
203 pmix_bfrops_base_print_uint32,
204 &mca_bfrops_v3_component.types);
205
206 PMIX_REGISTER_TYPE("PMIX_UINT64", PMIX_UINT64,
207 pmix_bfrops_base_pack_int64,
208 pmix_bfrops_base_unpack_int64,
209 pmix_bfrops_base_std_copy,
210 pmix_bfrops_base_print_uint64,
211 &mca_bfrops_v3_component.types);
212
213 PMIX_REGISTER_TYPE("PMIX_FLOAT", PMIX_FLOAT,
214 pmix_bfrops_base_pack_float,
215 pmix_bfrops_base_unpack_float,
216 pmix_bfrops_base_std_copy,
217 pmix_bfrops_base_print_float,
218 &mca_bfrops_v3_component.types);
219
220 PMIX_REGISTER_TYPE("PMIX_DOUBLE", PMIX_DOUBLE,
221 pmix_bfrops_base_pack_double,
222 pmix_bfrops_base_unpack_double,
223 pmix_bfrops_base_std_copy,
224 pmix_bfrops_base_print_double,
225 &mca_bfrops_v3_component.types);
226
227 PMIX_REGISTER_TYPE("PMIX_TIMEVAL", PMIX_TIMEVAL,
228 pmix_bfrops_base_pack_timeval,
229 pmix_bfrops_base_unpack_timeval,
230 pmix_bfrops_base_std_copy,
231 pmix_bfrops_base_print_timeval,
232 &mca_bfrops_v3_component.types);
233
234 PMIX_REGISTER_TYPE("PMIX_TIME", PMIX_TIME,
235 pmix_bfrops_base_pack_time,
236 pmix_bfrops_base_unpack_time,
237 pmix_bfrops_base_std_copy,
238 pmix_bfrops_base_print_time,
239 &mca_bfrops_v3_component.types);
240
241 PMIX_REGISTER_TYPE("PMIX_STATUS", PMIX_STATUS,
242 pmix_bfrops_base_pack_status,
243 pmix_bfrops_base_unpack_status,
244 pmix_bfrops_base_std_copy,
245 pmix_bfrops_base_print_status,
246 &mca_bfrops_v3_component.types);
247
248 PMIX_REGISTER_TYPE("PMIX_VALUE", PMIX_VALUE,
249 pmix_bfrops_base_pack_value,
250 pmix_bfrops_base_unpack_value,
251 pmix_bfrops_base_copy_value,
252 pmix_bfrops_base_print_value,
253 &mca_bfrops_v3_component.types);
254
255 PMIX_REGISTER_TYPE("PMIX_PROC", PMIX_PROC,
256 pmix_bfrops_base_pack_proc,
257 pmix_bfrops_base_unpack_proc,
258 pmix_bfrops_base_copy_proc,
259 pmix_bfrops_base_print_proc,
260 &mca_bfrops_v3_component.types);
261
262 PMIX_REGISTER_TYPE("PMIX_APP", PMIX_APP,
263 pmix_bfrops_base_pack_app,
264 pmix_bfrops_base_unpack_app,
265 pmix_bfrops_base_copy_app,
266 pmix_bfrops_base_print_app,
267 &mca_bfrops_v3_component.types);
268
269 PMIX_REGISTER_TYPE("PMIX_INFO", PMIX_INFO,
270 pmix_bfrops_base_pack_info,
271 pmix_bfrops_base_unpack_info,
272 pmix_bfrops_base_copy_info,
273 pmix_bfrops_base_print_info,
274 &mca_bfrops_v3_component.types);
275
276 PMIX_REGISTER_TYPE("PMIX_PDATA", PMIX_PDATA,
277 pmix_bfrops_base_pack_pdata,
278 pmix_bfrops_base_unpack_pdata,
279 pmix_bfrops_base_copy_pdata,
280 pmix_bfrops_base_print_pdata,
281 &mca_bfrops_v3_component.types);
282
283 PMIX_REGISTER_TYPE("PMIX_BUFFER", PMIX_BUFFER,
284 pmix_bfrops_base_pack_buf,
285 pmix_bfrops_base_unpack_buf,
286 pmix_bfrops_base_copy_buf,
287 pmix_bfrops_base_print_buf,
288 &mca_bfrops_v3_component.types);
289
290 PMIX_REGISTER_TYPE("PMIX_BYTE_OBJECT", PMIX_BYTE_OBJECT,
291 pmix_bfrops_base_pack_bo,
292 pmix_bfrops_base_unpack_bo,
293 pmix_bfrops_base_copy_bo,
294 pmix_bfrops_base_print_bo,
295 &mca_bfrops_v3_component.types);
296
297 PMIX_REGISTER_TYPE("PMIX_KVAL", PMIX_KVAL,
298 pmix_bfrops_base_pack_kval,
299 pmix_bfrops_base_unpack_kval,
300 pmix_bfrops_base_copy_kval,
301 pmix_bfrops_base_print_kval,
302 &mca_bfrops_v3_component.types);
303
304 PMIX_REGISTER_TYPE("PMIX_MODEX", PMIX_MODEX,
305 pmix3_bfrop_pack_modex,
306 pmix3_bfrop_unpack_modex,
307 pmix3_bfrop_copy_modex,
308 pmix3_bfrop_print_modex,
309 &mca_bfrops_v3_component.types);
310
311
312 PMIX_REGISTER_TYPE("PMIX_PERSIST", PMIX_PERSIST,
313 pmix_bfrops_base_pack_persist,
314 pmix_bfrops_base_unpack_persist,
315 pmix_bfrops_base_std_copy,
316 pmix_bfrops_base_print_persist,
317 &mca_bfrops_v3_component.types);
318
319 PMIX_REGISTER_TYPE("PMIX_POINTER", PMIX_POINTER,
320 pmix_bfrops_base_pack_ptr,
321 pmix_bfrops_base_unpack_ptr,
322 pmix_bfrops_base_std_copy,
323 pmix_bfrops_base_print_ptr,
324 &mca_bfrops_v3_component.types);
325
326 PMIX_REGISTER_TYPE("PMIX_SCOPE", PMIX_SCOPE,
327 pmix_bfrops_base_pack_scope,
328 pmix_bfrops_base_unpack_scope,
329 pmix_bfrops_base_std_copy,
330 pmix_bfrops_base_std_copy,
331 &mca_bfrops_v3_component.types);
332
333 PMIX_REGISTER_TYPE("PMIX_DATA_RANGE", PMIX_DATA_RANGE,
334 pmix_bfrops_base_pack_range,
335 pmix_bfrops_base_unpack_range,
336 pmix_bfrops_base_std_copy,
337 pmix_bfrops_base_print_ptr,
338 &mca_bfrops_v3_component.types);
339
340 PMIX_REGISTER_TYPE("PMIX_COMMAND", PMIX_COMMAND,
341 pmix_bfrops_base_pack_cmd,
342 pmix_bfrops_base_unpack_cmd,
343 pmix_bfrops_base_std_copy,
344 pmix_bfrops_base_print_cmd,
345 &mca_bfrops_v3_component.types);
346
347 PMIX_REGISTER_TYPE("PMIX_INFO_DIRECTIVES", PMIX_INFO_DIRECTIVES,
348 pmix_bfrops_base_pack_info_directives,
349 pmix_bfrops_base_unpack_info_directives,
350 pmix_bfrops_base_std_copy,
351 pmix_bfrops_base_print_info_directives,
352 &mca_bfrops_v3_component.types);
353
354 PMIX_REGISTER_TYPE("PMIX_DATA_TYPE", PMIX_DATA_TYPE,
355 pmix_bfrops_base_pack_datatype,
356 pmix_bfrops_base_unpack_datatype,
357 pmix_bfrops_base_std_copy,
358 pmix_bfrops_base_print_datatype,
359 &mca_bfrops_v3_component.types);
360
361 PMIX_REGISTER_TYPE("PMIX_PROC_STATE", PMIX_PROC_STATE,
362 pmix_bfrops_base_pack_pstate,
363 pmix_bfrops_base_unpack_pstate,
364 pmix_bfrops_base_std_copy,
365 pmix_bfrops_base_print_pstate,
366 &mca_bfrops_v3_component.types);
367
368 PMIX_REGISTER_TYPE("PMIX_PROC_INFO", PMIX_PROC_INFO,
369 pmix_bfrops_base_pack_pinfo,
370 pmix_bfrops_base_unpack_pinfo,
371 pmix_bfrops_base_copy_pinfo,
372 pmix_bfrops_base_print_pinfo,
373 &mca_bfrops_v3_component.types);
374
375 PMIX_REGISTER_TYPE("PMIX_DATA_ARRAY", PMIX_DATA_ARRAY,
376 pmix_bfrops_base_pack_darray,
377 pmix_bfrops_base_unpack_darray,
378 pmix_bfrops_base_copy_darray,
379 pmix_bfrops_base_print_darray,
380 &mca_bfrops_v3_component.types);
381
382 PMIX_REGISTER_TYPE("PMIX_PROC_RANK", PMIX_PROC_RANK,
383 pmix_bfrops_base_pack_rank,
384 pmix_bfrops_base_unpack_rank,
385 pmix_bfrops_base_std_copy,
386 pmix_bfrops_base_print_rank,
387 &mca_bfrops_v3_component.types);
388
389 PMIX_REGISTER_TYPE("PMIX_QUERY", PMIX_QUERY,
390 pmix_bfrops_base_pack_query,
391 pmix_bfrops_base_unpack_query,
392 pmix_bfrops_base_copy_query,
393 pmix_bfrops_base_print_query,
394 &mca_bfrops_v3_component.types);
395
396 PMIX_REGISTER_TYPE("PMIX_COMPRESSED_STRING",
397 PMIX_COMPRESSED_STRING,
398 pmix_bfrops_base_pack_bo,
399 pmix_bfrops_base_unpack_bo,
400 pmix_bfrops_base_copy_bo,
401 pmix_bfrops_base_print_bo,
402 &mca_bfrops_v3_component.types);
403
404 PMIX_REGISTER_TYPE("PMIX_ALLOC_DIRECTIVE",
405 PMIX_ALLOC_DIRECTIVE,
406 pmix_bfrops_base_pack_alloc_directive,
407 pmix_bfrops_base_unpack_alloc_directive,
408 pmix_bfrops_base_std_copy,
409 pmix_bfrops_base_print_alloc_directive,
410 &mca_bfrops_v3_component.types);
411
412 PMIX_REGISTER_TYPE("PMIX_IOF_CHANNEL",
413 PMIX_IOF_CHANNEL,
414 pmix_bfrops_base_pack_iof_channel,
415 pmix_bfrops_base_unpack_iof_channel,
416 pmix_bfrops_base_std_copy,
417 pmix_bfrops_base_print_iof_channel,
418 &mca_bfrops_v3_component.types);
419
420 PMIX_REGISTER_TYPE("PMIX_ENVAR",
421 PMIX_ENVAR,
422 pmix_bfrops_base_pack_envar,
423 pmix_bfrops_base_unpack_envar,
424 pmix_bfrops_base_copy_envar,
425 pmix_bfrops_base_print_envar,
426 &mca_bfrops_v3_component.types);
427
428
429 PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY,
430 pmix3_bfrop_pack_array,
431 pmix3_bfrop_unpack_array,
432 pmix3_bfrop_copy_array,
433 pmix3_bfrop_print_array,
434 &mca_bfrops_v3_component.types);
435
436
437
438 return PMIX_SUCCESS;
439 }
440
441 static void finalize(void)
442 {
443 int n;
444 pmix_bfrop_type_info_t *info;
445
446 for (n=0; n < mca_bfrops_v3_component.types.size; n++) {
447 if (NULL != (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v3_component.types, n))) {
448 PMIX_RELEASE(info);
449 pmix_pointer_array_set_item(&mca_bfrops_v3_component.types, n, NULL);
450 }
451 }
452 }
453
454 static pmix_status_t pmix3_pack(pmix_buffer_t *buffer,
455 const void *src, int num_vals,
456 pmix_data_type_t type)
457 {
458
459 return pmix_bfrops_base_pack(&mca_bfrops_v3_component.types,
460 buffer, src, num_vals, type);
461 }
462
463 static pmix_status_t pmix3_unpack(pmix_buffer_t *buffer, void *dest,
464 int32_t *num_vals, pmix_data_type_t type)
465 {
466
467 return pmix_bfrops_base_unpack(&mca_bfrops_v3_component.types,
468 buffer, dest, num_vals, type);
469 }
470
471 static pmix_status_t pmix3_copy(void **dest, void *src,
472 pmix_data_type_t type)
473 {
474 return pmix_bfrops_base_copy(&mca_bfrops_v3_component.types,
475 dest, src, type);
476 }
477
478 static pmix_status_t pmix3_print(char **output, char *prefix,
479 void *src, pmix_data_type_t type)
480 {
481 return pmix_bfrops_base_print(&mca_bfrops_v3_component.types,
482 output, prefix, src, type);
483 }
484
485 static pmix_status_t register_type(const char *name, pmix_data_type_t type,
486 pmix_bfrop_pack_fn_t pack,
487 pmix_bfrop_unpack_fn_t unpack,
488 pmix_bfrop_copy_fn_t copy,
489 pmix_bfrop_print_fn_t print)
490 {
491 PMIX_REGISTER_TYPE(name, type,
492 pack, unpack,
493 copy, print,
494 &mca_bfrops_v3_component.types);
495 return PMIX_SUCCESS;
496 }
497
498 static const char* data_type_string(pmix_data_type_t type)
499 {
500 return pmix_bfrops_base_data_type_string(&mca_bfrops_v3_component.types, type);
501 }
502
503
504 static pmix_status_t pmix3_bfrop_pack_array(pmix_pointer_array_t *regtypes,
505 pmix_buffer_t *buffer, const void *src,
506 int32_t num_vals, pmix_data_type_t type)
507 {
508 pmix_info_array_t *ptr;
509 int32_t i;
510 pmix_status_t ret;
511
512 ptr = (pmix_info_array_t *) src;
513
514 for (i = 0; i < num_vals; ++i) {
515
516 if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(regtypes, buffer, &ptr[i].size, 1, PMIX_SIZE))) {
517 return ret;
518 }
519 if (0 < ptr[i].size) {
520
521 if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(regtypes, buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) {
522 return ret;
523 }
524 }
525 }
526
527 return PMIX_SUCCESS;
528 }
529
530 static pmix_status_t pmix3_bfrop_pack_modex(pmix_pointer_array_t *regtypes,
531 pmix_buffer_t *buffer, const void *src,
532 int32_t num_vals, pmix_data_type_t type)
533 {
534 pmix_modex_data_t *ptr;
535 int32_t i;
536 pmix_status_t ret;
537
538 ptr = (pmix_modex_data_t *) src;
539
540 for (i = 0; i < num_vals; ++i) {
541 if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(regtypes, buffer, &ptr[i].size, 1, PMIX_SIZE))) {
542 return ret;
543 }
544 if( 0 < ptr[i].size){
545 if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(regtypes, buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) {
546 return ret;
547 }
548 }
549 }
550 return PMIX_SUCCESS;
551 }
552
553
554
555
556
557 static pmix_status_t pmix3_bfrop_unpack_array(pmix_pointer_array_t *regtypes,
558 pmix_buffer_t *buffer, void *dest,
559 int32_t *num_vals, pmix_data_type_t type)
560 {
561 pmix_info_array_t *ptr;
562 int32_t i, n, m;
563 pmix_status_t ret;
564
565 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
566 "pmix3_bfrop_unpack: %d info arrays", *num_vals);
567
568 ptr = (pmix_info_array_t*) dest;
569 n = *num_vals;
570
571 for (i = 0; i < n; ++i) {
572 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
573 "pmix3_bfrop_unpack: init array[%d]", i);
574 memset(&ptr[i], 0, sizeof(pmix_info_array_t));
575
576 m=1;
577 if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) {
578 return ret;
579 }
580 if (0 < ptr[i].size) {
581 ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t));
582 m=ptr[i].size;
583 if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(regtypes, buffer, ptr[i].array, &m, PMIX_INFO))) {
584 return ret;
585 }
586 }
587 }
588 return PMIX_SUCCESS;
589 }
590
591 static pmix_status_t pmix3_bfrop_unpack_modex(pmix_pointer_array_t *regtypes,
592 pmix_buffer_t *buffer, void *dest,
593 int32_t *num_vals, pmix_data_type_t type)
594 {
595 pmix_modex_data_t *ptr;
596 int32_t i, n, m;
597 pmix_status_t ret;
598
599 pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
600 "pmix20_bfrop_unpack: %d modex", *num_vals);
601
602 ptr = (pmix_modex_data_t *) dest;
603 n = *num_vals;
604
605 for (i = 0; i < n; ++i) {
606 memset(&ptr[i], 0, sizeof(pmix_modex_data_t));
607
608 m=1;
609 if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) {
610 return ret;
611 }
612 if (0 < ptr[i].size) {
613 ptr[i].blob = (uint8_t*)malloc(ptr[i].size * sizeof(uint8_t));
614 m=ptr[i].size;
615 if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(regtypes, buffer, ptr[i].blob, &m, PMIX_UINT8))) {
616 return ret;
617 }
618 }
619 }
620 return PMIX_SUCCESS;
621 }
622
623
624
625
626
627 static pmix_status_t pmix3_bfrop_copy_array(pmix_info_array_t **dest,
628 pmix_info_array_t *src,
629 pmix_data_type_t type)
630 {
631 pmix_info_t *d1, *s1;
632
633 *dest = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t));
634 (*dest)->size = src->size;
635 (*dest)->array = (pmix_info_t*)malloc(src->size * sizeof(pmix_info_t));
636 d1 = (pmix_info_t*)(*dest)->array;
637 s1 = (pmix_info_t*)src->array;
638 memcpy(d1, s1, src->size * sizeof(pmix_info_t));
639 return PMIX_SUCCESS;
640 }
641
642 static pmix_status_t pmix3_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src,
643 pmix_data_type_t type)
644 {
645 *dest = (pmix_modex_data_t*)malloc(sizeof(pmix_modex_data_t));
646 if (NULL == *dest) {
647 return PMIX_ERR_OUT_OF_RESOURCE;
648 }
649 (*dest)->blob = NULL;
650 (*dest)->size = 0;
651 if (NULL != src->blob) {
652 (*dest)->blob = (uint8_t*)malloc(src->size * sizeof(uint8_t));
653 if (NULL == (*dest)->blob) {
654 return PMIX_ERR_OUT_OF_RESOURCE;
655 }
656 memcpy((*dest)->blob, src->blob, src->size * sizeof(uint8_t));
657 (*dest)->size = src->size;
658 }
659 return PMIX_SUCCESS;
660 }
661
662
663
664
665 static pmix_status_t pmix3_bfrop_print_array(char **output, char *prefix,
666 pmix_info_array_t *src, pmix_data_type_t type)
667 {
668 size_t j;
669 char *tmp, *tmp2, *tmp3, *pfx;
670 pmix_info_t *s1;
671
672 if (0 > asprintf(&tmp, "%sARRAY SIZE: %ld", prefix, (long)src->size)) {
673 return PMIX_ERR_NOMEM;
674 }
675 if (0 > asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix)) {
676 free(tmp);
677 return PMIX_ERR_NOMEM;
678 }
679 s1 = (pmix_info_t*)src->array;
680
681 for (j=0; j < src->size; j++) {
682 pmix_bfrops_base_print_info(&tmp2, pfx, &s1[j], PMIX_INFO);
683 if (0 > asprintf(&tmp3, "%s%s", tmp, tmp2)) {
684 free(tmp);
685 free(tmp2);
686 return PMIX_ERR_NOMEM;
687 }
688 free(tmp);
689 free(tmp2);
690 tmp = tmp3;
691 }
692 *output = tmp;
693 return PMIX_SUCCESS;
694 }
695
696 static pmix_status_t pmix3_bfrop_print_modex(char **output, char *prefix,
697 pmix_modex_data_t *src, pmix_data_type_t type)
698 {
699 return PMIX_SUCCESS;
700 }
701
702
703