This source file includes following definitions.
- nocompress
- nodecompress
- compress_gzip_register
- compress_gzip_open
- compress_gzip_close
- opal_compress_gzip_component_query
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include "opal_config.h"
16
17 #include "opal/constants.h"
18 #include "opal/mca/compress/compress.h"
19 #include "opal/mca/compress/base/base.h"
20 #include "compress_gzip.h"
21
22
23
24
25 const char *opal_compress_gzip_component_version_string =
26 "OPAL COMPRESS gzip MCA component version " OPAL_VERSION;
27
28
29
30
31 static int compress_gzip_register (void);
32 static int compress_gzip_open(void);
33 static int compress_gzip_close(void);
34
35
36
37
38
39 opal_compress_gzip_component_t mca_compress_gzip_component = {
40
41 {
42
43
44
45 .base_version = {
46 OPAL_COMPRESS_BASE_VERSION_2_0_0,
47
48
49 .mca_component_name = "gzip",
50 MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
51 OPAL_RELEASE_VERSION),
52
53
54 .mca_open_component = compress_gzip_open,
55 .mca_close_component = compress_gzip_close,
56 .mca_query_component = opal_compress_gzip_component_query,
57 .mca_register_component_params = compress_gzip_register
58 },
59 .base_data = {
60
61 MCA_BASE_METADATA_PARAM_CHECKPOINT
62 },
63
64 .verbose = 0,
65 .output_handle = -1,
66 }
67 };
68
69 static bool nocompress(uint8_t *inbytes,
70 size_t inlen,
71 uint8_t **outbytes,
72 size_t *olen)
73 {
74 return false;
75 }
76
77 static bool nodecompress(uint8_t **outbytes, size_t olen,
78 uint8_t *inbytes, size_t len)
79 {
80 return false;
81 }
82
83
84
85
86 static opal_compress_base_module_t loc_module = {
87
88 .init = opal_compress_gzip_module_init,
89
90 .finalize = opal_compress_gzip_module_finalize,
91
92
93 .compress = opal_compress_gzip_compress,
94 .compress_nb = opal_compress_gzip_compress_nb,
95
96
97 .decompress = opal_compress_gzip_decompress,
98 .decompress_nb = opal_compress_gzip_decompress_nb,
99
100 .compress_block = nocompress,
101 .decompress_block = nodecompress
102 };
103
104 static int compress_gzip_register (void)
105 {
106 int ret;
107
108 mca_compress_gzip_component.super.priority = 15;
109 ret = mca_base_component_var_register (&mca_compress_gzip_component.super.base_version,
110 "priority", "Priority of the COMPRESS gzip component "
111 "(default: 15)", MCA_BASE_VAR_TYPE_INT, NULL, 0,
112 MCA_BASE_VAR_FLAG_SETTABLE,
113 OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL_EQ,
114 &mca_compress_gzip_component.super.priority);
115 if (0 > ret) {
116 return ret;
117 }
118
119 mca_compress_gzip_component.super.verbose = 0;
120 ret = mca_base_component_var_register (&mca_compress_gzip_component.super.base_version,
121 "verbose",
122 "Verbose level for the COMPRESS gzip component",
123 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
124 OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
125 &mca_compress_gzip_component.super.verbose);
126 return (0 > ret) ? ret : OPAL_SUCCESS;
127 }
128
129 static int compress_gzip_open(void)
130 {
131
132
133
134 if ( 0 != mca_compress_gzip_component.super.verbose) {
135 mca_compress_gzip_component.super.output_handle = opal_output_open(NULL);
136 opal_output_set_verbosity(mca_compress_gzip_component.super.output_handle,
137 mca_compress_gzip_component.super.verbose);
138 } else {
139 mca_compress_gzip_component.super.output_handle = opal_compress_base_framework.framework_output;
140 }
141
142
143
144
145 opal_output_verbose(10, mca_compress_gzip_component.super.output_handle,
146 "compress:gzip: open()");
147 opal_output_verbose(20, mca_compress_gzip_component.super.output_handle,
148 "compress:gzip: open: priority = %d",
149 mca_compress_gzip_component.super.priority);
150 opal_output_verbose(20, mca_compress_gzip_component.super.output_handle,
151 "compress:gzip: open: verbosity = %d",
152 mca_compress_gzip_component.super.verbose);
153 return OPAL_SUCCESS;
154 }
155
156 static int compress_gzip_close(void)
157 {
158 return OPAL_SUCCESS;
159 }
160
161 int opal_compress_gzip_component_query(mca_base_module_t **module, int *priority)
162 {
163 *module = (mca_base_module_t *)&loc_module;
164 *priority = mca_compress_gzip_component.super.priority;
165
166 return OPAL_SUCCESS;
167 }
168