aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/compress.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs/compress.c')
-rw-r--r--fs/ubifs/compress.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/ubifs/compress.c b/fs/ubifs/compress.c
index 2bfa0953335d..565cb56d7225 100644
--- a/fs/ubifs/compress.c
+++ b/fs/ubifs/compress.c
@@ -92,8 +92,8 @@ struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
92 * Note, if the input buffer was not compressed, it is copied to the output 92 * Note, if the input buffer was not compressed, it is copied to the output
93 * buffer and %UBIFS_COMPR_NONE is returned in @compr_type. 93 * buffer and %UBIFS_COMPR_NONE is returned in @compr_type.
94 */ 94 */
95void ubifs_compress(const void *in_buf, int in_len, void *out_buf, int *out_len, 95void ubifs_compress(const struct ubifs_info *c, const void *in_buf,
96 int *compr_type) 96 int in_len, void *out_buf, int *out_len, int *compr_type)
97{ 97{
98 int err; 98 int err;
99 struct ubifs_compressor *compr = ubifs_compressors[*compr_type]; 99 struct ubifs_compressor *compr = ubifs_compressors[*compr_type];
@@ -112,9 +112,9 @@ void ubifs_compress(const void *in_buf, int in_len, void *out_buf, int *out_len,
112 if (compr->comp_mutex) 112 if (compr->comp_mutex)
113 mutex_unlock(compr->comp_mutex); 113 mutex_unlock(compr->comp_mutex);
114 if (unlikely(err)) { 114 if (unlikely(err)) {
115 ubifs_warn("cannot compress %d bytes, compressor %s, error %d, leave data uncompressed", 115 ubifs_warn(c, "cannot compress %d bytes, compressor %s, error %d, leave data uncompressed",
116 in_len, compr->name, err); 116 in_len, compr->name, err);
117 goto no_compr; 117 goto no_compr;
118 } 118 }
119 119
120 /* 120 /*
@@ -144,21 +144,21 @@ no_compr:
144 * The length of the uncompressed data is returned in @out_len. This functions 144 * The length of the uncompressed data is returned in @out_len. This functions
145 * returns %0 on success or a negative error code on failure. 145 * returns %0 on success or a negative error code on failure.
146 */ 146 */
147int ubifs_decompress(const void *in_buf, int in_len, void *out_buf, 147int ubifs_decompress(const struct ubifs_info *c, const void *in_buf,
148 int *out_len, int compr_type) 148 int in_len, void *out_buf, int *out_len, int compr_type)
149{ 149{
150 int err; 150 int err;
151 struct ubifs_compressor *compr; 151 struct ubifs_compressor *compr;
152 152
153 if (unlikely(compr_type < 0 || compr_type >= UBIFS_COMPR_TYPES_CNT)) { 153 if (unlikely(compr_type < 0 || compr_type >= UBIFS_COMPR_TYPES_CNT)) {
154 ubifs_err("invalid compression type %d", compr_type); 154 ubifs_err(c, "invalid compression type %d", compr_type);
155 return -EINVAL; 155 return -EINVAL;
156 } 156 }
157 157
158 compr = ubifs_compressors[compr_type]; 158 compr = ubifs_compressors[compr_type];
159 159
160 if (unlikely(!compr->capi_name)) { 160 if (unlikely(!compr->capi_name)) {
161 ubifs_err("%s compression is not compiled in", compr->name); 161 ubifs_err(c, "%s compression is not compiled in", compr->name);
162 return -EINVAL; 162 return -EINVAL;
163 } 163 }
164 164
@@ -175,7 +175,7 @@ int ubifs_decompress(const void *in_buf, int in_len, void *out_buf,
175 if (compr->decomp_mutex) 175 if (compr->decomp_mutex)
176 mutex_unlock(compr->decomp_mutex); 176 mutex_unlock(compr->decomp_mutex);
177 if (err) 177 if (err)
178 ubifs_err("cannot decompress %d bytes, compressor %s, error %d", 178 ubifs_err(c, "cannot decompress %d bytes, compressor %s, error %d",
179 in_len, compr->name, err); 179 in_len, compr->name, err);
180 180
181 return err; 181 return err;
@@ -193,8 +193,8 @@ static int __init compr_init(struct ubifs_compressor *compr)
193 if (compr->capi_name) { 193 if (compr->capi_name) {
194 compr->cc = crypto_alloc_comp(compr->capi_name, 0, 0); 194 compr->cc = crypto_alloc_comp(compr->capi_name, 0, 0);
195 if (IS_ERR(compr->cc)) { 195 if (IS_ERR(compr->cc)) {
196 ubifs_err("cannot initialize compressor %s, error %ld", 196 pr_err("UBIFS error (pid %d): cannot initialize compressor %s, error %ld",
197 compr->name, PTR_ERR(compr->cc)); 197 current->pid, compr->name, PTR_ERR(compr->cc));
198 return PTR_ERR(compr->cc); 198 return PTR_ERR(compr->cc);
199 } 199 }
200 } 200 }