mtd/fs/jffs2 compr.c, 1.38, 1.39 compr.h, 1.3, 1.4 compr_lzari.c, 1.1, 1.2 compr_lzo.c, 1.1, 1.2 compr_rtime.c, 1.12, 1.13 compr_rubin.c, 1.18, 1.19 compr_zlib.c, 1.26, 1.27

havasi at infradead.org havasi at infradead.org
Wed Jun 23 11:00:20 EDT 2004


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/home/havasi/mtd/fs/jffs2

Modified Files:
	compr.c compr.h compr_lzari.c compr_lzo.c compr_rtime.c 
	compr_rubin.c compr_zlib.c 
Log Message:
Preparing for model file support.

Nothing relevant change, just the two following:
- one additional parameter for (de)compress: "void *model"
  (not used yet)
- replace printk() with JFFS2_PRINT macro. It can be used by compressor modules, too.



Index: compr.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- compr.c	17 Jun 2004 16:31:14 -0000	1.38
+++ compr.c	23 Jun 2004 14:59:46 -0000	1.39
@@ -74,7 +74,7 @@
         case JFFS2_COMPR_MODE_PRIORITY:
                 output_buf = JFFS2_MALLOC(*cdatalen);
                 if (!output_buf) {
-                        printk("JFFS2: No memory for compressor allocation. Compression failed.\n");
+                        JFFS2_PRINT("JFFS2: No memory for compressor allocation. Compression failed.\n");
                         goto out;
                 }
                 orig_slen = *datalen;
@@ -89,7 +89,7 @@
                         COMPRESSOR_LIST_UNLOCK;
                         *datalen  = orig_slen;
                         *cdatalen = orig_dlen;
-                        compr_ret = this->compress(data_in, output_buf, datalen, cdatalen);
+                        compr_ret = this->compress(data_in, output_buf, datalen, cdatalen, NULL);
                         COMPRESSOR_LIST_LOCK;
                         this->usecount--;
                         if (!compr_ret) {
@@ -124,7 +124,7 @@
                                 tmp_buf = JFFS2_MALLOC(orig_dlen);
                                 COMPRESSOR_LIST_LOCK;
                                 if (!tmp_buf) {
-                                        printk("JFFS2: No memory for compressor allocation. (%d bytes)\n",orig_dlen);
+                                        JFFS2_PRINT("JFFS2: No memory for compressor allocation. (%d bytes)\n",orig_dlen);
                                         continue;
                                 }
                                 else {
@@ -136,7 +136,7 @@
                         COMPRESSOR_LIST_UNLOCK;
                         *datalen  = orig_slen;
                         *cdatalen = orig_dlen;
-                        compr_ret = this->compress(data_in, this->compr_buf, datalen, cdatalen);
+                        compr_ret = this->compress(data_in, this->compr_buf, datalen, cdatalen, NULL);
                         COMPRESSOR_LIST_LOCK;
                         this->usecount--;
                         if (!compr_ret) {
@@ -161,7 +161,7 @@
                 COMPRESSOR_LIST_UNLOCK;
                 break;
         default:
-                printk("JFFS2: unknow compression mode.\n");
+                JFFS2_PRINT("JFFS2: unknow compression mode.\n");
         }
  out:
         if (ret == JFFS2_COMPR_NONE) {
@@ -198,10 +198,10 @@
                         if (comprtype == this->compr) {
                                 this->usecount++;
                                 COMPRESSOR_LIST_UNLOCK;
-                                ret = this->decompress(cdata_in, data_out, cdatalen, datalen);
+                                ret = this->decompress(cdata_in, data_out, cdatalen, datalen, NULL);
                                 COMPRESSOR_LIST_LOCK;
                                 if (ret) {
-                                        printk("Decompressor \"%s\" returned %d\n", this->name, ret);
+                                        JFFS2_PRINT("Decompressor \"%s\" returned %d\n", this->name, ret);
                                 }
                                 else {
                                         this->stat_decompr_blocks++;
@@ -211,7 +211,7 @@
                                 return ret;
                         }
                 }
-		printk("JFFS2 compression type 0x%02x not avaiable.\n", comprtype);
+		JFFS2_PRINT("JFFS2 compression type 0x%02x not avaiable.\n", comprtype);
                 COMPRESSOR_LIST_UNLOCK;
 		return -EIO;
 	}
@@ -223,7 +223,7 @@
         struct jffs2_compressor *this;
 
         if (!comp->name) {
-                printk("NULL compressor name at registering JFFS2 compressor. Failed.\n");
+                JFFS2_PRINT("NULL compressor name at registering JFFS2 compressor. Failed.\n");
                 return -1;
         }
         comp->compr_buf_size=0;
@@ -233,7 +233,7 @@
         comp->stat_compr_new_size=0;
         comp->stat_compr_blocks=0;
         comp->stat_decompr_blocks=0;
-        D1(printk("Registering JFFS2 compressor \"%s\"\n", comp->name));
+        D1(JFFS2_PRINT("Registering JFFS2 compressor \"%s\"\n", comp->name));
 
         COMPRESSOR_LIST_LOCK;
 
@@ -246,7 +246,7 @@
         list_add_tail(&comp->list, &jffs2_compressor_list);
 out:
         D2(list_for_each_entry(this, &jffs2_compressor_list, list) {
-                printk("Compressor \"%s\", prio %d\n", this->name, this->priority);
+                JFFS2_PRINT("Compressor \"%s\", prio %d\n", this->name, this->priority);
         })
 
         COMPRESSOR_LIST_UNLOCK;
@@ -258,19 +258,19 @@
 {
         D2(struct jffs2_compressor *this;)
 
-        D1(printk("Unregistering JFFS2 compressor \"%s\"\n", comp->name));
+        D1(JFFS2_PRINT("Unregistering JFFS2 compressor \"%s\"\n", comp->name));
 
         COMPRESSOR_LIST_LOCK;
 
         if (comp->usecount) {
                 COMPRESSOR_LIST_UNLOCK;
-                printk("JFFS2: Compressor modul is in use. Unregister failed.\n");
+                JFFS2_PRINT("JFFS2: Compressor modul is in use. Unregister failed.\n");
                 return -1;
         }
         list_del(&comp->list);
 
         D2(list_for_each_entry(this, &jffs2_compressor_list, list) {
-                printk("Compressor \"%s\", prio %d\n", this->name, this->priority);
+                JFFS2_PRINT("Compressor \"%s\", prio %d\n", this->name, this->priority);
         })
         COMPRESSOR_LIST_UNLOCK;
         return 0;
@@ -367,7 +367,7 @@
                 }
         }
         COMPRESSOR_LIST_UNLOCK;
-        printk("JFFS2: compressor %s not found.\n",name);
+        JFFS2_PRINT("JFFS2: compressor %s not found.\n",name);
         return 1;
 }
 
@@ -393,7 +393,7 @@
                 }
         }
         COMPRESSOR_LIST_UNLOCK;
-        printk("JFFS2: compressor %s not found.\n",name);        
+        JFFS2_PRINT("JFFS2: compressor %s not found.\n",name);        
         return 1;
 reinsert:
         /* list is sorted in the order of priority, so if
@@ -442,13 +442,13 @@
 /* Setting default compression mode */
 #ifdef CONFIG_JFFS2_CMODE_NONE
         jffs2_compression_mode = JFFS2_COMPR_MODE_NONE;
-        D1(printk("JFFS2: default compression mode: none\n");)
+        D1(JFFS2_PRINT("JFFS2: default compression mode: none\n");)
 #else
 #ifdef CONFIG_JFFS2_CMODE_SIZE
         jffs2_compression_mode = JFFS2_COMPR_MODE_SIZE;
-        D1(printk("JFFS2: default compression mode: size\n");)
+        D1(JFFS2_PRINT("JFFS2: default compression mode: size\n");)
 #else
-        D1(printk("JFFS2: default compression mode: priority\n");)
+        D1(JFFS2_PRINT("JFFS2: default compression mode: priority\n");)
 #endif
 #endif
         return 0;

Index: compr.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- compr.h	25 May 2004 11:31:52 -0000	1.3
+++ compr.h	23 Jun 2004 14:59:47 -0000	1.4
@@ -46,6 +46,8 @@
 #define JFFS2_MALLOC_BIG(a)         vmalloc(a)
 #define JFFS2_FREE_BIG(a)           vfree(a)
 
+#define JFFS2_PRINT(...)            printk(__VA_ARGS__)
+
 void jffs2_set_compression_mode(int mode);
 int jffs2_get_compression_mode(void);
 
@@ -55,9 +57,9 @@
         char *name;
         char compr;                /* JFFS2_COMPR_XXX */
         int (*compress)(unsigned char *data_in, unsigned char *cpage_out,
-                        uint32_t *srclen, uint32_t *destlen);
+                        uint32_t *srclen, uint32_t *destlen, void *model);
         int (*decompress)(unsigned char *cdata_in, unsigned char *data_out,
-                        uint32_t cdatalen, uint32_t datalen);
+                        uint32_t cdatalen, uint32_t datalen, void *model);
         int usecount;
         int disabled;              /* if seted the compressor won't compress */
         unsigned char *compr_buf;  /* used by size compr. mode */

Index: compr_lzari.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr_lzari.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- compr_lzari.c	25 May 2004 11:31:52 -0000	1.1
+++ compr_lzari.c	23 Jun 2004 14:59:47 -0000	1.2
@@ -673,15 +673,11 @@
 
 int jffs2_lzari_compress (unsigned char *input,
 			unsigned char *output, uint32_t *sourcelen,
-			uint32_t *dstlen);
-
-int jffs2_lzari_estimate (uint32_t *est_rtime, uint32_t *est_wtime, uint32_t *est_size,
-			unsigned char *cdata_in, unsigned char *data_out,
-			uint32_t cdatalen, uint32_t datalen);
+			uint32_t *dstlen, void *model);
 
 int jffs2_lzari_decompress (unsigned char *input,
 			  unsigned char *output, uint32_t sourcelen,
-			  uint32_t dstlen);
+			  uint32_t dstlen, void *model);
 
 struct jffs2_compressor jffs2_lzari_comp = {
 	.priority = JFFS2_LZARI_PRIORITY,
@@ -698,21 +694,14 @@
 
 int jffs2_lzari_compress (unsigned char *input,
 			unsigned char *output, uint32_t *sourcelen,
-			uint32_t *dstlen)
+			uint32_t *dstlen, void *model)
 {
 	return Encode(input, output, (unsigned long *)sourcelen, (unsigned long *)dstlen);
 }
 
-int jffs2_lzari_estimate (uint32_t *est_rtime, uint32_t *est_wtime, uint32_t *est_size,
-			unsigned char *cdata_in, unsigned char *data_out,
-			uint32_t cdatalen, uint32_t datalen)
-{
-	return 0;
-}
-
 int jffs2_lzari_decompress (unsigned char *input,
 			  unsigned char *output, uint32_t sourcelen,
-			  uint32_t dstlen)
+			  uint32_t dstlen, void *model)
 {
     return Decode(input, output, sourcelen, dstlen);
 }

Index: compr_lzo.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr_lzo.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- compr_lzo.c	25 May 2004 11:31:52 -0000	1.1
+++ compr_lzo.c	23 Jun 2004 14:59:47 -0000	1.2
@@ -2213,15 +2213,11 @@
 
 int jffs2_lzo_compress (unsigned char *input,
 			unsigned char *output, uint32_t *sourcelen,
-			uint32_t *dstlen);
-
-int jffs2_lzo_estimate (uint32_t *est_rtime, uint32_t *est_wtime, uint32_t *est_size,
-			unsigned char *cdata_in, unsigned char *data_out,
-			uint32_t cdatalen, uint32_t datalen);
+			uint32_t *dstlen, void *model);
 
 int jffs2_lzo_decompress (unsigned char *input,
 			  unsigned char *output, uint32_t sourcelen,
-			  uint32_t dstlen);
+			  uint32_t dstlen, void *model);
 
 static struct jffs2_compressor jffs2_lzo_comp = {
 	.priority = JFFS2_LZO_PRIORITY,
@@ -2280,7 +2276,7 @@
 
 int jffs2_lzo_compress (unsigned char *input,
 			unsigned char *output, uint32_t *sourcelen,
-			uint32_t *dstlen)
+			uint32_t *dstlen, void *model)
 {
 	lzo_uint csize = *dstlen; /*BLOCKSIZE;*/
 	lzo_uint isize = *sourcelen;
@@ -2309,16 +2305,9 @@
 	}
 }
 
-int jffs2_lzo_estimate (uint32_t *est_rtime, uint32_t *est_wtime, uint32_t *est_size,
-			unsigned char *cdata_in, unsigned char *data_out,
-			uint32_t cdatalen, uint32_t datalen)
-{
-	return 0;
-}
-
 int jffs2_lzo_decompress (unsigned char *input,
 			  unsigned char *output, uint32_t sourcelen,
-			  uint32_t dstlen)
+			  uint32_t dstlen, void *model)
 {
 	lzo_uint outlen = dstlen;
 	return lzo1x_decompress (input, sourcelen, output, &outlen, NULL);

Index: compr_rtime.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr_rtime.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- compr_rtime.c	25 May 2004 11:12:31 -0000	1.12
+++ compr_rtime.c	23 Jun 2004 14:59:47 -0000	1.13
@@ -30,7 +30,7 @@
 
 /* _compress returns the compressed size, -1 if bigger */
 int jffs2_rtime_compress(unsigned char *data_in, unsigned char *cpage_out, 
-		   uint32_t *sourcelen, uint32_t *dstlen)
+		   uint32_t *sourcelen, uint32_t *dstlen, void *model)
 {
 	short positions[256];
 	int outpos = 0;
@@ -70,7 +70,7 @@
 
 
 int jffs2_rtime_decompress(unsigned char *data_in, unsigned char *cpage_out,
-		      uint32_t srclen, uint32_t destlen)
+		      uint32_t srclen, uint32_t destlen, void *model)
 {
 	short positions[256];
 	int outpos = 0;

Index: compr_rubin.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr_rubin.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- compr_rubin.c	25 May 2004 11:12:31 -0000	1.18
+++ compr_rubin.c	23 Jun 2004 14:59:47 -0000	1.19
@@ -223,13 +223,13 @@
 #if 0
 /* _compress returns the compressed size, -1 if bigger */
 int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out, 
-		   uint32_t *sourcelen, uint32_t *dstlen)
+		   uint32_t *sourcelen, uint32_t *dstlen, void *model)
 {
 	return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen);
 }
 #endif
 int jffs2_dynrubin_compress(unsigned char *data_in, unsigned char *cpage_out, 
-		   uint32_t *sourcelen, uint32_t *dstlen)
+		   uint32_t *sourcelen, uint32_t *dstlen, void *model)
 {
 	int bits[8];
 	unsigned char histo[256];
@@ -307,14 +307,14 @@
 
 
 int jffs2_rubinmips_decompress(unsigned char *data_in, unsigned char *cpage_out, 
-		   uint32_t sourcelen, uint32_t dstlen)
+		   uint32_t sourcelen, uint32_t dstlen, void *model)
 {
 	rubin_do_decompress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen);
         return 0;
 }
 
 int jffs2_dynrubin_decompress(unsigned char *data_in, unsigned char *cpage_out, 
-		   uint32_t sourcelen, uint32_t dstlen)
+		   uint32_t sourcelen, uint32_t dstlen, void *model)
 {
 	int bits[8];
 	int c;

Index: compr_zlib.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr_zlib.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- compr_zlib.c	25 May 2004 11:12:31 -0000	1.26
+++ compr_zlib.c	23 Jun 2004 14:59:47 -0000	1.27
@@ -70,7 +70,7 @@
 #endif /* __KERNEL__ */
 
 int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, 
-		   uint32_t *sourcelen, uint32_t *dstlen)
+		   uint32_t *sourcelen, uint32_t *dstlen, void *model)
 {
 	int ret;
 
@@ -136,7 +136,7 @@
 }
 
 int jffs2_zlib_decompress(unsigned char *data_in, unsigned char *cpage_out,
-		      uint32_t srclen, uint32_t destlen)
+		      uint32_t srclen, uint32_t destlen, void *model)
 {
 	int ret;
 	int wbits = MAX_WBITS;





More information about the linux-mtd-cvs mailing list