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 f910f38..7e97a5f 100644 (file)
@@ -431,9 +431,9 @@ static int yaffs_WriteNewChunkWithTagsToNAND(struct yaffs_DeviceStruct *dev,
                /* 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) {
index f7e9a0c..4dc70a2 100644 (file)
@@ -601,7 +601,7 @@ struct yaffs_DeviceParamStruct {
 #ifdef CONFIG_YAFFS_AUTO_UNICODE
        int autoUnicode;
 #endif
-       
+       int alwaysCheckErased; /* Force chunk erased check always on */
 };
 
 typedef struct yaffs_DeviceParamStruct yaffs_DeviceParam;
index 2081f21..a4ed297 100644 (file)
@@ -190,37 +190,6 @@ int nval_list(const char *xb, int xb_size, char *buf, int bsize)
        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)
 {
index e6a1c21..3b25d07 100644 (file)
@@ -2448,6 +2448,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
        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;
 
@@ -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, "alwaysCheckErased...%d\n", dev->param.alwaysCheckErased);
 
        buf += sprintf(buf, "\n");
 
index 11ddc75..c61da67 100644 (file)
@@ -2950,6 +2950,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
        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;
 
@@ -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, "alwaysCheckErased.. %d\n", dev->param.alwaysCheckErased);
 
        buf += sprintf(buf, "\n");
 
index cb79d9b..83203c8 100644 (file)
@@ -41,6 +41,7 @@
 #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>