diff options
author | Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> | 2009-05-27 01:05:02 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2009-06-02 00:04:56 -0400 |
commit | 3ce858cb04de8bc83449eac707c8012a1944daca (patch) | |
tree | 0bdf275d63a6f53f01703255d52a6129df9fd3dc /crypto/zlib.c | |
parent | e9736c16da9077728802f42393d18258e6685428 (diff) |
crypto: compress - Return produced bytes in crypto_{,de}compress_{update,final}
If crypto_{,de}compress_{update,final}() succeed, return the actual number of
bytes produced instead of zero, so their users don't have to calculate that
theirselves.
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/zlib.c')
-rw-r--r-- | crypto/zlib.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/crypto/zlib.c b/crypto/zlib.c index 33609bab614e..c3015733c990 100644 --- a/crypto/zlib.c +++ b/crypto/zlib.c | |||
@@ -165,15 +165,15 @@ static int zlib_compress_update(struct crypto_pcomp *tfm, | |||
165 | return -EINVAL; | 165 | return -EINVAL; |
166 | } | 166 | } |
167 | 167 | ||
168 | ret = req->avail_out - stream->avail_out; | ||
168 | pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", | 169 | pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", |
169 | stream->avail_in, stream->avail_out, | 170 | stream->avail_in, stream->avail_out, |
170 | req->avail_in - stream->avail_in, | 171 | req->avail_in - stream->avail_in, ret); |
171 | req->avail_out - stream->avail_out); | ||
172 | req->next_in = stream->next_in; | 172 | req->next_in = stream->next_in; |
173 | req->avail_in = stream->avail_in; | 173 | req->avail_in = stream->avail_in; |
174 | req->next_out = stream->next_out; | 174 | req->next_out = stream->next_out; |
175 | req->avail_out = stream->avail_out; | 175 | req->avail_out = stream->avail_out; |
176 | return 0; | 176 | return ret; |
177 | } | 177 | } |
178 | 178 | ||
179 | static int zlib_compress_final(struct crypto_pcomp *tfm, | 179 | static int zlib_compress_final(struct crypto_pcomp *tfm, |
@@ -195,15 +195,15 @@ static int zlib_compress_final(struct crypto_pcomp *tfm, | |||
195 | return -EINVAL; | 195 | return -EINVAL; |
196 | } | 196 | } |
197 | 197 | ||
198 | ret = req->avail_out - stream->avail_out; | ||
198 | pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", | 199 | pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", |
199 | stream->avail_in, stream->avail_out, | 200 | stream->avail_in, stream->avail_out, |
200 | req->avail_in - stream->avail_in, | 201 | req->avail_in - stream->avail_in, ret); |
201 | req->avail_out - stream->avail_out); | ||
202 | req->next_in = stream->next_in; | 202 | req->next_in = stream->next_in; |
203 | req->avail_in = stream->avail_in; | 203 | req->avail_in = stream->avail_in; |
204 | req->next_out = stream->next_out; | 204 | req->next_out = stream->next_out; |
205 | req->avail_out = stream->avail_out; | 205 | req->avail_out = stream->avail_out; |
206 | return 0; | 206 | return ret; |
207 | } | 207 | } |
208 | 208 | ||
209 | 209 | ||
@@ -280,15 +280,15 @@ static int zlib_decompress_update(struct crypto_pcomp *tfm, | |||
280 | return -EINVAL; | 280 | return -EINVAL; |
281 | } | 281 | } |
282 | 282 | ||
283 | ret = req->avail_out - stream->avail_out; | ||
283 | pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", | 284 | pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", |
284 | stream->avail_in, stream->avail_out, | 285 | stream->avail_in, stream->avail_out, |
285 | req->avail_in - stream->avail_in, | 286 | req->avail_in - stream->avail_in, ret); |
286 | req->avail_out - stream->avail_out); | ||
287 | req->next_in = stream->next_in; | 287 | req->next_in = stream->next_in; |
288 | req->avail_in = stream->avail_in; | 288 | req->avail_in = stream->avail_in; |
289 | req->next_out = stream->next_out; | 289 | req->next_out = stream->next_out; |
290 | req->avail_out = stream->avail_out; | 290 | req->avail_out = stream->avail_out; |
291 | return 0; | 291 | return ret; |
292 | } | 292 | } |
293 | 293 | ||
294 | static int zlib_decompress_final(struct crypto_pcomp *tfm, | 294 | static int zlib_decompress_final(struct crypto_pcomp *tfm, |
@@ -328,15 +328,15 @@ static int zlib_decompress_final(struct crypto_pcomp *tfm, | |||
328 | return -EINVAL; | 328 | return -EINVAL; |
329 | } | 329 | } |
330 | 330 | ||
331 | ret = req->avail_out - stream->avail_out; | ||
331 | pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", | 332 | pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", |
332 | stream->avail_in, stream->avail_out, | 333 | stream->avail_in, stream->avail_out, |
333 | req->avail_in - stream->avail_in, | 334 | req->avail_in - stream->avail_in, ret); |
334 | req->avail_out - stream->avail_out); | ||
335 | req->next_in = stream->next_in; | 335 | req->next_in = stream->next_in; |
336 | req->avail_in = stream->avail_in; | 336 | req->avail_in = stream->avail_in; |
337 | req->next_out = stream->next_out; | 337 | req->next_out = stream->next_out; |
338 | req->avail_out = stream->avail_out; | 338 | req->avail_out = stream->avail_out; |
339 | return 0; | 339 | return ret; |
340 | } | 340 | } |
341 | 341 | ||
342 | 342 | ||