13 #include <linux/kernel.h>
14 #include <linux/sched.h>
21 static void *lzo_compress_buf;
24 static void free_workspace(
void)
27 vfree(lzo_compress_buf);
30 static int __init alloc_workspace(
void)
35 if (!lzo_mem || !lzo_compress_buf) {
43 static int jffs2_lzo_compress(
unsigned char *data_in,
unsigned char *cpage_out,
50 ret =
lzo1x_1_compress(data_in, *sourcelen, lzo_compress_buf, &compress_size, lzo_mem);
54 if (compress_size > *dstlen)
57 memcpy(cpage_out, lzo_compress_buf, compress_size);
60 *dstlen = compress_size;
68 static int jffs2_lzo_decompress(
unsigned char *data_in,
unsigned char *cpage_out,
76 if (ret !=
LZO_E_OK || dl != destlen)
86 .compress = &jffs2_lzo_compress,
87 .decompress = &jffs2_lzo_decompress,
95 ret = alloc_workspace();