From 91b9cd9442b6ac81f4affb8b5b4b91ed0d11dcd2 Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Sat, 25 Sep 2010 16:13:43 +1200 Subject: [PATCH] yaffs Clean up some code Clean up some code. eg remove some conditional compilation and obsolete code. Signed-off-by: Charles Manning --- yaffs_guts.c | 6 +++--- yaffs_guts.h | 2 +- yaffs_nameval.c | 31 ------------------------------- yaffs_vfs.c | 5 +++++ yaffs_vfs_multi.c | 5 +++++ yportenv.h | 1 + 6 files changed, 15 insertions(+), 35 deletions(-) diff --git a/yaffs_guts.c b/yaffs_guts.c index f910f38..7e97a5f 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -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) { diff --git a/yaffs_guts.h b/yaffs_guts.h index f7e9a0c..4dc70a2 100644 --- a/yaffs_guts.h +++ b/yaffs_guts.h @@ -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; diff --git a/yaffs_nameval.c b/yaffs_nameval.c index 2081f21..a4ed297 100644 --- a/yaffs_nameval.c +++ b/yaffs_nameval.c @@ -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) { diff --git a/yaffs_vfs.c b/yaffs_vfs.c index e6a1c21..3b25d07 100644 --- a/yaffs_vfs.c +++ b/yaffs_vfs.c @@ -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"); diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c index 11ddc75..c61da67 100644 --- a/yaffs_vfs_multi.c +++ b/yaffs_vfs_multi.c @@ -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"); diff --git a/yportenv.h b/yportenv.h index cb79d9b..83203c8 100644 --- a/yportenv.h +++ b/yportenv.h @@ -41,6 +41,7 @@ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) #include #endif + #include #include #include -- 2.30.2