JFFS2 compression

Ferenc Havasi havasi at inf.u-szeged.hu
Wed Oct 20 07:53:17 EDT 2004


Hi Artem,

> I have several different buffers. I want to compose one JFFS2 node from 
> them. As I understand, I need to allocate one big temporary buffer, copy 
> my small buffers to it, and then compress the big buffer. After this I 
> will be able to uncompress the compression buffer in one step.
> 
> But, it would be very very nice if I can compress each small buffer to 
> one compression buffer and later be able to uncompress the resulting 
> compression buffer in one step. Can I do so?

If the "one step" means that you would like to use only one 
jffs2_decompress/... call than the answer is no.

But I can imagine a solution, where you can call jffs2_compress 
separatedly for the small buffers, and you can uncompress it using a loop.

The compression buffer can be something like the following:
   - original_size_of_small_buffer1
   - compressed_size_of_small_buffer1
   - comprtype (return value of jffs2_compress)
   - compressed data1
   - original_size_of_small_buffer2
   - compressed_size_of_small_buffer2
   - comprtype (return value of jffs2_compress)
   - compressed data2
   ...

I don't know it is OK for you or not.

Bye,
Ferenc

P.S.: In this solution you may have to allign all data to 4 bytes.




More information about the linux-mtd mailing list