[Yaffs] [PATCH YAFFS2] yaffs1-ecc-fix

Startseite
Anhänge:
Nachricht
+ (text/plain)
+ yaffs1-ecc-fix.diff (text/x-diff)
Nachricht löschen
Nachricht beantworten
Autor: Artis Kugevics
Datum:  
To: yaffs
Betreff: [Yaffs] [PATCH YAFFS2] yaffs1-ecc-fix
Hello,

I highly recommend adding this patch to yaffs2 for it to work correctly with
yaffs1 partitions.
It is required to specify eccbytes for current MTD version, otherwise ECC will
fail.
It is required to check return value after mtd->write_ecc() call, otherwise
write failures will not be detected.

Thanks,
-Artis
Index: yaffs_mtdif.c
===================================================================
RCS file: /home/aleph1/cvs/yaffs2/yaffs_mtdif.c,v
retrieving revision 1.6
diff -u -r1.6 yaffs_mtdif.c
--- yaffs_mtdif.c    31 Jul 2005 08:38:41 -0000    1.6
+++ yaffs_mtdif.c    1 Aug 2005 12:39:26 -0000
@@ -31,6 +31,9 @@


 static struct nand_oobinfo yaffs_oobinfo = {
     .useecc = 1,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8)) || (!CONFIG_YAFFS_USE_OLD_MTD)
+    .eccbytes = 6,
+#endif
     .eccpos = {8, 9, 10, 13, 14, 15}
 };


@@ -53,9 +56,9 @@
     if(data && spare)
     {
         if(dev->useNANDECC)
-            mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_oobinfo);
+            retval = mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_oobinfo);
         else
-            mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_noeccinfo);
+            retval = mtd->write_ecc(mtd,addr,dev->nBytesPerChunk,&dummy,data,spareAsBytes,&yaffs_noeccinfo);
     }
     else
     {