yaffs Clean up some code
authorCharles Manning <cdhmanning@gmail.com>
Sat, 25 Sep 2010 04:13:43 +0000 (16:13 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Sat, 25 Sep 2010 04:13:43 +0000 (16:13 +1200)
Clean up some code. eg remove some conditional compilation
and obsolete code.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
yaffs_guts.c
yaffs_guts.h
yaffs_nameval.c
yaffs_vfs.c
yaffs_vfs_multi.c
yportenv.h

index f910f386dfdb5a33d86a19b4069ee951d887e804..7e97a5f0eadc0aad888f3ed30c92cf7b1563c3d9 100644 (file)
@@ -431,9 +431,9 @@ static int yaffs_WriteNewChunkWithTagsToNAND(struct yaffs_DeviceStruct *dev,
                /* let's give it a try */
                attempts++;
 
                /* let's give it a try */
                attempts++;
 
-#ifdef CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED
-               bi->skipErasedCheck = 0;
-#endif
+               if(dev->param.alwaysCheckErased)
+                       bi->skipErasedCheck = 0;
+
                if (!bi->skipErasedCheck) {
                        erasedOk = yaffs_CheckChunkErased(dev, chunk);
                        if (erasedOk != YAFFS_OK) {
                if (!bi->skipErasedCheck) {
                        erasedOk = yaffs_CheckChunkErased(dev, chunk);
                        if (erasedOk != YAFFS_OK) {
index f7e9a0c7a92812184c667541782b46fec1913956..4dc70a2af828e17b74f3d13f78fc4e0cc9baab8f 100644 (file)
@@ -601,7 +601,7 @@ struct yaffs_DeviceParamStruct {
 #ifdef CONFIG_YAFFS_AUTO_UNICODE
        int autoUnicode;
 #endif
 #ifdef CONFIG_YAFFS_AUTO_UNICODE
        int autoUnicode;
 #endif
-       
+       int alwaysCheckErased; /* Force chunk erased check always on */
 };
 
 typedef struct yaffs_DeviceParamStruct yaffs_DeviceParam;
 };
 
 typedef struct yaffs_DeviceParamStruct yaffs_DeviceParam;
index 2081f21dacd3a3e21e666c00fcecc0d3c59400d6..a4ed2973526ba259375199b480f01d7c49298dcd 100644 (file)
@@ -190,37 +190,6 @@ int nval_list(const char *xb, int xb_size, char *buf, int bsize)
        return ncopied;
 }
 
        return ncopied;
 }
 
-#if 0
-int nval_load(char *xb, int xb_size, const char *src, int src_size)
-{
-       int tx_size;
-       int used;
-       
-       tx_size = xb_size;
-       if(tx_size > src_size)
-               tx_size = src_size;
-
-       memcpy(xb,src,tx_size);
-       used = nval_used(xb, xb_size);
-       
-       if( used < xb_size)
-               memset(xb+ used, 0, xb_size - used);
-       return used;    
-}
-
-int nval_save(const char *xb, int xb_size, char *dest, int dest_size)
-{
-       int tx_size;
-       
-       tx_size = xb_size;
-       if(tx_size > dest_size)
-               tx_size = dest_size;
-
-       memcpy(dest,xb,tx_size);
-       return tx_size;
-}
-#endif
-
 
 int nval_hasvalues(const char *xb, int xb_size)
 {
 
 int nval_hasvalues(const char *xb, int xb_size)
 {
index e6a1c2101b78f8ed8567cc080d7659b2be912dab..3b25d0792826c8271c226d2f54da0231f3780182 100644 (file)
@@ -2448,6 +2448,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
        param->refreshPeriod = 500;
 #endif
 
        param->refreshPeriod = 500;
 #endif
 
+#ifdef CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED
+       param->alwaysCheckErased = 1;
+#endif
+
        if(options.empty_lost_and_found_overridden)
                param->emptyLostAndFound = options.empty_lost_and_found;
 
        if(options.empty_lost_and_found_overridden)
                param->emptyLostAndFound = options.empty_lost_and_found;
 
@@ -2638,6 +2642,7 @@ static char *yaffs_dump_dev_part0(char *buf, yaffs_Device * dev)
        buf += sprintf(buf, "refreshPeriod...... %d\n", dev->param.refreshPeriod);
        buf += sprintf(buf, "nShortOpCaches..... %d\n", dev->param.nShortOpCaches);
        buf += sprintf(buf, "nReservedBlocks.... %d\n", dev->param.nReservedBlocks);
        buf += sprintf(buf, "refreshPeriod...... %d\n", dev->param.refreshPeriod);
        buf += sprintf(buf, "nShortOpCaches..... %d\n", dev->param.nShortOpCaches);
        buf += sprintf(buf, "nReservedBlocks.... %d\n", dev->param.nReservedBlocks);
+       buf += sprintf(buf, "alwaysCheckErased...%d\n", dev->param.alwaysCheckErased);
 
        buf += sprintf(buf, "\n");
 
 
        buf += sprintf(buf, "\n");
 
index 11ddc750b7a79f3d9ca5dcd275ff0c735e798999..c61da67da12f952edba6b5ae51f8996ddeb5dcd3 100644 (file)
@@ -2950,6 +2950,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
        param->refreshPeriod = 500;
 #endif
 
        param->refreshPeriod = 500;
 #endif
 
+#ifdef CONFIG_YAFFS__ALWAYS_CHECK_CHUNK_ERASED
+       param->alwaysCheckErased = 1;
+#endif
+
        if(options.empty_lost_and_found_overridden)
                param->emptyLostAndFound = options.empty_lost_and_found;
 
        if(options.empty_lost_and_found_overridden)
                param->emptyLostAndFound = options.empty_lost_and_found;
 
@@ -3195,6 +3199,7 @@ static char *yaffs_dump_dev_part0(char *buf, yaffs_Device * dev)
        buf += sprintf(buf, "refreshPeriod...... %d\n", dev->param.refreshPeriod);
        buf += sprintf(buf, "nShortOpCaches..... %d\n", dev->param.nShortOpCaches);
        buf += sprintf(buf, "nReservedBlocks.... %d\n", dev->param.nReservedBlocks);
        buf += sprintf(buf, "refreshPeriod...... %d\n", dev->param.refreshPeriod);
        buf += sprintf(buf, "nShortOpCaches..... %d\n", dev->param.nShortOpCaches);
        buf += sprintf(buf, "nReservedBlocks.... %d\n", dev->param.nReservedBlocks);
+       buf += sprintf(buf, "alwaysCheckErased.. %d\n", dev->param.alwaysCheckErased);
 
        buf += sprintf(buf, "\n");
 
 
        buf += sprintf(buf, "\n");
 
index cb79d9b2ccc3c2b360663a14e191fae2f096571c..83203c88ce6751008b70a26d995167ee795de71d 100644 (file)
@@ -41,6 +41,7 @@
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
 #include <linux/config.h>
 #endif
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
 #include <linux/config.h>
 #endif
+
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/sched.h>