changeset 1757:c4a8f3019f9c

* cdl/jffs2.cdl: Fixed outdated definitions for compression options. * src/fs-ecos.c: Added missing calls for jffs2_compressors_init() and jffs2_compressors_exit()
author asl
date Sun, 19 Sep 2004 14:28:45 +0000
parents b2a8f9509f6f
children 696f7f5b9236
files packages/fs/jffs2/current/ChangeLog packages/fs/jffs2/current/cdl/jffs2.cdl packages/fs/jffs2/current/src/fs-ecos.c
diffstat 3 files changed, 65 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/packages/fs/jffs2/current/ChangeLog
+++ b/packages/fs/jffs2/current/ChangeLog
@@ -1,3 +1,10 @@
+2004-09-16  Dirk Eibach  <eibach@gdsys.de>
+2004-09-19  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* cdl/jffs2.cdl: Fixed outdated definitions for compression options.
+	* src/fs-ecos.c: Added missing calls for jffs2_compressors_init()
+        and jffs2_compressors_exit() 
+
 2004-08-13  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/compr.h: Committed this file which if forgot yesterday.
--- a/packages/fs/jffs2/current/cdl/jffs2.cdl
+++ b/packages/fs/jffs2/current/cdl/jffs2.cdl
@@ -119,7 +119,7 @@ cdl_package CYGPKG_FS_JFFS2 {
             fairly verbose output. Level 2 is insanely loquacious."
     }
 
-    cdl_option CYGOPT_FS_JFFS2_COMPRESS {
+    cdl_component CYGOPT_FS_JFFS2_COMPRESS {
         display         "Compress data"
         flavor          bool
         define          JFFS2_COMPRESSION
@@ -130,47 +130,56 @@ cdl_package CYGPKG_FS_JFFS2 {
             selecting this option increases the amount of RAM required and
             slows down read and write operations considerably if you have a
             slow CPU."
-    }
 
-    cdl_option CYGOPT_FS_JFFS2_COMPRESS_ZLIB {
-        display         "Compress data using zlib"
-        flavor          bool
-        define          JFFS2_USE_ZLIB
-        requires        CYGPKG_COMPRESS_ZLIB
-        requires        CYGOPT_FS_JFFS2_COMPRESS
-        compile         compr_zlib.c
-        default_value   1
-        description     "
-            Use zlib for compression of data. This is the slowest of the
-            compression options available but the most effective."
-    }
+        cdl_option CYGOPT_FS_JFFS2_COMPRESS_ZLIB {
+            display         "Compress data using zlib"
+            flavor          bool
+            define          CONFIG_JFFS2_ZLIB
+            requires        CYGPKG_COMPRESS_ZLIB
+            compile         compr_zlib.c
+            default_value   1
+            description     "
+                Use zlib for compression of data. This is the slowest of the
+                compression options available but the most effective."
+        }
+
+        cdl_option CYGOPT_FS_JFFS2_COMPRESS_RTIME {
+            display         "Compress data using rtime"
+            flavor          bool
+            define          CONFIG_JFFS2_RTIME
+            compile         compr_rtime.c
+            default_value   1
+            description     "
+                Use the rtime algorithm for compression of data. This 
+                simple algorithm often manages to squeeze and extra few
+                bytes from data already compressed with gzip."
+        }
 
-    cdl_option CYGOPT_FS_JFFS2_COMPRESS_RTIME {
-        display         "Compress data using rtime"
-        flavor          bool
-        define          JFFS2_USE_RTIME
-        requires        CYGOPT_FS_JFFS2_COMPRESS
-        compile         compr_rtime.c
-        default_value   1
-        description     "
-            Use the rtime algorithm for compression of data. This 
-            simple algorithm often manages to squeeze and extra few
-            bytes from data already compressed with gzip."
+        cdl_option CYGOPT_FS_JFFS2_COMPRESS_RUBIN {
+            display         "Compress data using rubin"
+            flavor          bool
+            define          CONFIG_JFFS2_RUBIN
+            requires        CYGOPT_FS_JFFS2_COMPRESS
+            compile         compr_rubin.c
+            description     "
+                Use the rubin algorithm for compression of data. This 
+                simple algorithm is faster than zlib but not quite as
+                effective."
+        }
+        cdl_option CYGOPT_FS_JFFS2_COMPRESS_CMODE {
+            display         "Set the default compression mode"
+            flavor          data
+            default_value   { "PRIORITY" }
+            legal_values    { "NONE" "PRIORITY" "SIZE" }
+            define          CONFIG_JFFS2_CMODE
+            description     "
+                You can set here the default compression mode of JFFS2 from 
+                the avaiable compression modes. NONE causes no compression to
+                be performed. PRIORITY tries the compressors in a predefined
+                order and chooses the first successfull one. SIZE tries all 
+                compressors and chooses the one which has the smallest result"
+        }
     }
-
-    cdl_option CYGOPT_FS_JFFS2_COMPRESS_RUBIN {
-        display         "Compress data using rubin"
-        flavor          bool
-        define          JFFS2_USE_RTIME
-        requires        CYGOPT_FS_JFFS2_COMPRESS
-        compile         compr_rubin.c
-        default_value   !CYGOPT_FS_JFFS2_COMPRESS_ZLIB
-        description     "
-            Use the rubin algorithm for compression of data. This 
-            simple algorithm is faster than zlib but not quite as
-            effective."
-    }
-
     cdl_option CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE {
         display         "Memory pool size"
         flavor          data
--- a/packages/fs/jffs2/current/src/fs-ecos.c
+++ b/packages/fs/jffs2/current/src/fs-ecos.c
@@ -21,6 +21,7 @@
 #include <linux/pagemap.h>
 #include <linux/crc32.h>
 #include "nodelist.h"
+#include "compr.h"
 
 #include <errno.h>
 #include <string.h>
@@ -543,14 +544,18 @@ static int jffs2_mount(cyg_fstab_entry *
 			return ENOMEM;
 		}
 		memset(c->inocache_list, 0, sizeof(struct jffs2_inode_cache *) * INOCACHE_HASHSIZE);
-                if (n_fs_mounted++ == 0)
+                if (n_fs_mounted++ == 0) {
                         jffs2_create_slab_caches(); // No error check, cannot fail
+			jffs2_compressors_init(); 
+		}
 
 		err = jffs2_read_super(jffs2_sb);
 
 		if (err) {
-                        if (--n_fs_mounted == 0)
+                        if (--n_fs_mounted == 0) {
                                 jffs2_destroy_slab_caches();
+				jffs2_compressors_exit();
+			}
                         
 			free(jffs2_sb);
 			free(c->inocache_list);
@@ -662,8 +667,10 @@ static int jffs2_umount(cyg_mtab_entry *
 	} else {
 		jffs2_sb->s_mount_count--;
         }
-        if (--n_fs_mounted == 0)
+        if (--n_fs_mounted == 0) {
                 jffs2_destroy_slab_caches();        
+		jffs2_compressors_exit();
+	}
 	return ENOERR;
 }