mtd/fs/jffs2 compr_zlib.c,1.19,1.20
Joakim Tjernlund
jocke at infradead.org
Fri Jan 10 03:44:52 EST 2003
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv1829
Modified Files:
compr_zlib.c
Log Message:
Skip the adler32 checksum when uncompressing. It is crc32 checked anyway
Index: compr_zlib.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr_zlib.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- compr_zlib.c 9 Jan 2003 13:55:03 -0000 1.19
+++ compr_zlib.c 10 Jan 2003 08:44:48 -0000 1.20
@@ -21,6 +21,7 @@
#include <linux/slab.h>
#include <linux/jffs2.h>
#include <linux/zlib.h>
+#include <linux/zutil.h>
#include <asm/semaphore.h>
#include "nodelist.h"
@@ -133,13 +134,24 @@
down(&inflate_sem);
- if (Z_OK != zlib_inflateInit(&inf_strm)) {
+ if (Z_OK != zlib_inflateInit2(&inf_strm, -MAX_WBITS)) {
printk(KERN_WARNING "inflateInit failed\n");
up(&inflate_sem);
return;
}
- inf_strm.next_in = data_in;
- inf_strm.avail_in = srclen;
+ /* skip header and checksum test */
+ if( (data_in[0] & 0x0f) != Z_DEFLATED){
+ printk("unknown compression method\n");
+ up(&inflate_sem);
+ return;
+ }
+ if(data_in[1] & PRESET_DICT){
+ printk("dictionary not preset\n");
+ up(&inflate_sem);
+ return;
+ }
+ inf_strm.next_in = data_in + 2;
+ inf_strm.avail_in = srclen - 2;
inf_strm.total_in = 0;
inf_strm.next_out = cpage_out;
More information about the linux-mtd-cvs
mailing list