13 #if !defined(__KERNEL__) && !defined(__ECOS)
14 #error "The userspace support got too messy and was removed. Update your mkfs.jffs2"
17 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19 #include <linux/kernel.h>
32 #define STREAM_END_SPACE 12
50 jffs2_dbg(1,
"Allocated %d bytes for deflate workspace\n",
57 jffs2_dbg(1,
"Allocated %d bytes for inflate workspace\n",
68 #define alloc_workspaces() (0)
69 #define free_workspaces() do { } while(0)
72 static int jffs2_zlib_compress(
unsigned char *data_in,
73 unsigned char *cpage_out,
84 pr_warn(
"deflateInit failed\n");
98 jffs2_dbg(1,
"calling deflate with avail_in %d, avail_out %d\n",
101 jffs2_dbg(1,
"deflate returned with avail_in %d, avail_out %d, total_in %ld, total_out %ld\n",
105 jffs2_dbg(1,
"deflate in loop returned %d\n", ret);
117 jffs2_dbg(1,
"final deflate returned %d\n", ret);
123 jffs2_dbg(1,
"zlib compressed %ld bytes into %ld; failing\n",
129 jffs2_dbg(1,
"zlib compressed %ld bytes into %ld\n",
140 static int jffs2_zlib_decompress(
unsigned char *data_in,
141 unsigned char *cpage_out,
161 !(((data_in[0]<<8) + data_in[1]) % 31)) {
163 jffs2_dbg(2,
"inflate skipping adler32\n");
164 wbits = -((data_in[0] >> 4) + 8);
169 jffs2_dbg(1,
"inflate not skipping adler32\n");
174 pr_warn(
"inflateInit failed\n");
193 .compress = &jffs2_zlib_compress,
194 .decompress = &jffs2_zlib_decompress,
195 #ifdef JFFS2_ZLIB_DISABLED