changeset 324:fd6ccfd7d352

Step-merge from upstream
author Ross Younger <wry@ecoscentric.com>
date Tue, 03 Nov 2009 17:32:40 +0000
parents 31efcf0d9807 (current diff) 5d34d18f33e5 (diff)
children 8e1210f7946a
files direct/python/Makefile direct/python/README.txt direct/python/examples.py direct/python/yaffs_python_helper.c direct/python/yaffsfs.py packages/fs/yaffs/current/src/yaffs_guts.h packages/fs/yaffs/current/src/yaffs_packedtags2.c packages/fs/yaffs/current/src/yaffs_packedtags2.h
diffstat 3 files changed, 20 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/packages/fs/yaffs/current/src/yaffs_guts.h
+++ b/packages/fs/yaffs/current/src/yaffs_guts.h
@@ -557,7 +557,8 @@ struct yaffs_DeviceStruct {
 
 	int useHeaderFileSize;	/* Flag to determine if we should use file sizes from the header */
 
-	int useNANDECC;		/* Flag to decide whether or not to use NANDECC */
+	int useNANDECC;		/* Flag to decide whether or not to use NANDECC on data (yaffs1) */
+	int noTagsECC;		/* Flag to decide whether or not to do ECC on packed tags (yaffs2) */ 
 
 	void *genericDevice;	/* Pointer to device context
 				 * On an mtd this holds the mtd pointer.
--- a/packages/fs/yaffs/current/src/yaffs_packedtags2.c
+++ b/packages/fs/yaffs/current/src/yaffs_packedtags2.c
@@ -103,17 +103,14 @@ void yaffs_PackTags2TagsPart(yaffs_Packe
 }
 
 
-void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t)
+void yaffs_PackTags2(yaffs_Device *dev, yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t)
 {
 	yaffs_PackTags2TagsPart(&pt->t, t);
 
-#ifndef YAFFS_IGNORE_TAGS_ECC
-	{
+	if(!dev->noTagsECC)
 		yaffs_ECCCalculateOther((unsigned char *)&pt->t,
 					sizeof(yaffs_PackedTags2TagsPart),
 					&pt->ecc);
-	}
-#endif
 }
 
 
@@ -164,27 +161,24 @@ void yaffs_UnpackTags2TagsPart(yaffs_Ext
 
 }
 
-void yaffs_UnpackTags2(yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt)
+void yaffs_UnpackTags2(yaffs_Device *dev, yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt)
 {
 
 	yaffs_ECCResult eccResult = YAFFS_ECC_RESULT_NO_ERROR;
 
-	if (pt->t.sequenceNumber != 0xFFFFFFFF) {
-		/* Page is in use */
-#ifndef YAFFS_IGNORE_TAGS_ECC
-		{
-			yaffs_ECCOther ecc;
-			int result;
-			yaffs_ECCCalculateOther((unsigned char *)&pt->t,
-						sizeof
-						(yaffs_PackedTags2TagsPart),
-						&ecc);
-			result =
-			    yaffs_ECCCorrectOther((unsigned char *)&pt->t,
-						  sizeof
-						  (yaffs_PackedTags2TagsPart),
-						  &pt->ecc, &ecc);
-			switch (result) {
+	if (pt->t.sequenceNumber != 0xFFFFFFFF &&
+	    !dev->noTagsECC){
+		/* Chunk is in use and we need to do ECC */
+		
+		yaffs_ECCOther ecc;
+		int result;
+		yaffs_ECCCalculateOther((unsigned char *)&pt->t,
+					sizeof(yaffs_PackedTags2TagsPart),
+					&ecc);
+		result = yaffs_ECCCorrectOther((unsigned char *)&pt->t,
+						sizeof(yaffs_PackedTags2TagsPart),
+						&pt->ecc, &ecc);
+		switch (result) {
 			case 0:
 				eccResult = YAFFS_ECC_RESULT_NO_ERROR;
 				break;
@@ -199,9 +193,7 @@ void yaffs_UnpackTags2(yaffs_ExtendedTag
 				break;
 			default:
 				eccResult = YAFFS_ECC_RESULT_UNKNOWN;
-			}
 		}
-#endif
 	}
 
 	yaffs_UnpackTags2TagsPart(t, &pt->t);
@@ -210,6 +202,5 @@ void yaffs_UnpackTags2(yaffs_ExtendedTag
 
 	yaffs_DumpPackedTags2(pt);
 	yaffs_DumpTags2(t);
-
 }
 
--- a/packages/fs/yaffs/current/src/yaffs_packedtags2.h
+++ b/packages/fs/yaffs/current/src/yaffs_packedtags2.h
@@ -34,8 +34,8 @@ typedef struct {
 } yaffs_PackedTags2;
 
 /* Full packed tags with ECC, used for oob tags */
-void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t);
-void yaffs_UnpackTags2(yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt);
+void yaffs_PackTags2(yaffs_Device *dev, yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t);
+void yaffs_UnpackTags2(yaffs_Device *dev, yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt);
 
 /* Only the tags part (no ECC for use with inband tags */
 void yaffs_PackTags2TagsPart(yaffs_PackedTags2TagsPart *pt, const yaffs_ExtendedTags *t);