Re: [RFC] CryptoAPI & Compression

From: Herbert Xu
Date: Tue Apr 19 2005 - 17:12:46 EST


On Tue, Apr 19, 2005 at 04:51:56PM +0400, Artem B. Bityuckiy wrote:
>
> JFFS2 wants the following from pcompress():
> 1. compressible data: compress it; the offered formerly algorithm works
> just fine here.

Yes but the existing JFFS algorithm does a lot more than that. It tries
to pack as much data as possible into the output buffer.

> 2. non-compressible data: do not compress it, leave it uncompressed; the
> offered algorithm works fine here too - it returns an error.

If all you need is to compress what's compressible you don't need
pcompress at all. You just need to call the normal compress method
with the input length clamped by the output buffer size. If the
function returns OK then it's compressible, otherwise it isn't.

You can even do the existing JFFS loop this way too.
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/