mtd/fs/jffs2 compr.c,1.28,1.29 os-linux.h,1.37,1.38
David Woodhouse
dwmw2 at infradead.org
Thu Nov 20 11:40:37 EST 2003
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv1192
Modified Files:
compr.c os-linux.h
Log Message:
More compression changes for conditional compression support
Index: compr.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- compr.c 18 Nov 2003 21:14:01 -0000 1.28
+++ compr.c 20 Nov 2003 16:40:35 -0000 1.29
@@ -11,21 +11,11 @@
*
*/
-#if defined(__KERNEL__) || defined (__ECOS)
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/types.h>
-#else
-#define KERN_DEBUG
-#define KERN_NOTICE
-#define KERN_WARNING
-#define printk printf
-#include <stdio.h>
-#include <stdint.h>
-#include <errno.h>
-#endif
-
+#include <linux/slab.h>
#include <linux/jffs2.h>
int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen);
@@ -40,7 +30,7 @@
/* jffs2_compress:
* @data: Pointer to uncompressed data
- * @cdata: Pointer to buffer for compressed data
+ * @cdata: Pointer to returned pointer to buffer for compressed data
* @datalen: On entry, holds the amount of data available for compression.
* On exit, expected to hold the amount of data actually compressed.
* @cdatalen: On entry, holds the amount of space available for compressed
@@ -58,6 +48,7 @@
unsigned char jffs2_compress(unsigned char *data_in, unsigned char **cpage_out,
uint32_t *datalen, uint32_t *cdatalen)
{
+#ifdef JFFS2_COMPRESSION
int ret;
*cpage_out = kmalloc(*cdatalen, GFP_KERNEL);
@@ -66,29 +57,33 @@
return JFFS2_COMPR_NONE;
}
+#ifdef JFFS2_USE_ZLIB
ret = jffs2_zlib_compress(data_in, cpage_out, datalen, cdatalen);
if (!ret) {
return JFFS2_COMPR_ZLIB;
}
-#if 0 /* Disabled 23/9/1. With zlib it hardly ever gets a look in */
+#endif
+#ifdef JFFS2_USE_DYNRUBIN
ret = jffs2_dynrubin_compress(data_in, cpage_out, datalen, cdatalen);
if (!ret) {
return JFFS2_COMPR_DYNRUBIN;
}
#endif
-#if 0 /* Disabled 26/2/1. Obsoleted by dynrubin */
+#ifdef JFFS2_USE_RUBINMIPS
ret = jffs2_rubinmips_compress(data_in, cpage_out, datalen, cdatalen);
if (!ret) {
return JFFS2_COMPR_RUBINMIPS;
}
#endif
+#ifdef JFFS2_USE_RTIME
/* rtime does manage to recompress already-compressed data */
ret = jffs2_rtime_compress(data_in, cpage_out, datalen, cdatalen);
if (!ret) {
return JFFS2_COMPR_RTIME;
}
-
+#endif
kfree(*cpage_out);
+#endif /* Compression */
*cpage_out = data_in;
*datalen = *cdatalen;
return JFFS2_COMPR_NONE; /* We failed to compress */
@@ -112,30 +107,27 @@
case JFFS2_COMPR_ZERO:
memset(data_out, 0, datalen);
break;
-
+#ifdef JFFS2_USE_ZLIB
case JFFS2_COMPR_ZLIB:
jffs2_zlib_decompress(cdata_in, data_out, cdatalen, datalen);
break;
-
+#endif
+#ifdef JFFS2_USE_RTIME
case JFFS2_COMPR_RTIME:
jffs2_rtime_decompress(cdata_in, data_out, cdatalen, datalen);
break;
-
+#endif
+#ifdef JFFS2_USE_RUBINMIPS
case JFFS2_COMPR_RUBINMIPS:
-#if 0 /* Disabled 23/9/1 */
jffs2_rubinmips_decompress(cdata_in, data_out, cdatalen, datalen);
-#else
- printk(KERN_WARNING "JFFS2: Rubinmips compression encountered but support not compiled in!\n");
-#endif
break;
+#endif
+#ifdef JFFS2_USE_DYNRUBIN
case JFFS2_COMPR_DYNRUBIN:
-#if 1 /* Phase this one out */
+
jffs2_dynrubin_decompress(cdata_in, data_out, cdatalen, datalen);
-#else
- printk(KERN_WARNING "JFFS2: Dynrubin compression encountered but support not compiled in!\n");
-#endif
break;
-
+#endif
default:
printk(KERN_NOTICE "Unknown JFFS2 compression type 0x%02x\n", comprtype);
return -EIO;
Index: os-linux.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/os-linux.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- os-linux.h 11 Oct 2003 11:47:23 -0000 1.37
+++ os-linux.h 20 Nov 2003 16:40:35 -0000 1.38
@@ -180,7 +180,12 @@
int jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct iovec *vecs,
unsigned long count, loff_t to, size_t *retlen);
-/* super.c */
+/* Compression config */
+#define JFFS2_COMPRESSION
+#undef JFFS2_USE_DYNRUBIN /* Disabled 23/9/1. With zlib it hardly ever gets a look in */
+#undef JFFS2_USE_RUBINMIPS /* Disabled 26/2/1. Obsoleted by dynrubin */
+#define JFFS2_USE_ZLIB
+#define JFFS2_USE_RTIME /* rtime does manage to recompress already-compressed data */
#endif /* __JFFS2_OS_LINUX_H__ */
More information about the linux-mtd-cvs
mailing list