1
2
3
4
5
6
7
8
9
10
11
12
13 #ifndef PMIX_COMPRESS_BASE_H
14 #define PMIX_COMPRESS_BASE_H
15
16 #include "pmix_config.h"
17 #include "src/mca/pcompress/pcompress.h"
18 #include "src/util/pmix_environ.h"
19
20 #include "src/mca/base/base.h"
21
22
23
24
25
26 #if defined(c_plusplus) || defined(__cplusplus)
27 extern "C" {
28 #endif
29
30
31
32 #define PMIX_STRING_SIZE_CHECK(s) \
33 (PMIX_STRING == (s)->type && NULL != (s)->data.string && pmix_compress_base.compress_limit < strlen((s)->data.string))
34
35 #define PMIX_VALUE_COMPRESSED_STRING_UNPACK(s) \
36 do { \
37 char *tmp; \
38 \
39 if (PMIX_COMPRESSED_STRING == (s)->type) { \
40 pmix_compress.decompress_string(&tmp, (uint8_t*)(s)->data.bo.bytes, \
41 (s)->data.bo.size); \
42 if (NULL == tmp) { \
43 PMIX_ERROR_LOG(PMIX_ERR_NOMEM); \
44 rc = PMIX_ERR_NOMEM; \
45 PMIX_VALUE_RELEASE(s); \
46 val = NULL; \
47 } else { \
48 PMIX_VALUE_DESTRUCT(s); \
49 (s)->data.string = tmp; \
50 (s)->type = PMIX_STRING; \
51 } \
52 } \
53 } while(0)
54
55 typedef struct {
56 size_t compress_limit;
57 } pmix_compress_base_t;
58
59 PMIX_EXPORT extern pmix_compress_base_t pmix_compress_base;
60
61
62
63
64
65
66
67
68
69 PMIX_EXPORT int pmix_compress_base_select(void);
70
71
72
73
74 PMIX_EXPORT extern pmix_mca_base_framework_t pmix_pcompress_base_framework;
75 PMIX_EXPORT extern pmix_compress_base_module_t pmix_compress;
76
77
78
79
80 PMIX_EXPORT int pmix_compress_base_tar_create(char ** target);
81 PMIX_EXPORT int pmix_compress_base_tar_extract(char ** target);
82
83 #if defined(c_plusplus) || defined(__cplusplus)
84 }
85 #endif
86
87 #endif