yaffs2: changes to make yaffs work with the layout-based NAND
PATCH 1/1 yaffs2: changes to make yaffs work with the layout-based NAND
Hi Charles,
below is the patch that does two things:
- compacts the structures (theyare still way too big IMHO)
- adapts the yaffs2-mtd layer for the changes in OOB area treatment (see earlier patches to linux-mtd list).
Any feedback is very appreciated.
Vitaly
fs/yaffs2/yaffs_ecc.h +1 -1
@@ -30,7 +30,7 @@unsigned char colParity;unsigned lineParity;unsigned lineParityPrime; -} yaffs_ECCOther; +} __attribute__ ((__packed__)) yaffs_ECCOther;void yaffs_ECCCalculate (const unsigned char *data,unsigned char *ecc); int yaffs_ECCCorrect(unsigned char *data, unsigned char *read_ecc,
fs/yaffs2/yaffs_mtdif2.c +4 -4
@@ -66,7 +66,7 @@ data);if (tags) retval = - mtd->write_oob (mtd, addr, mtd->oobsize, &dummy, + mtd->write_oob (mtd, addr, mtd->oobavail, &dummy, (__u8 *) & pt); }
@@ -112,11 +112,11 @@ data);if (tags) retval = - mtd->read_oob (mtd, addr, mtd->oobsize, &dummy, + mtd->read_oob (mtd, addr, mtd->oobavail, &dummy, dev->spareBuffer); } - -memcpy (&pt, dev->spareBuffer,sizeof (pt)); +memcpy (&pt, dev->spareBuffer, mtd->oobavail <sizeof (pt) ? + mtd->oobavail :sizeof (pt));if (tags)yaffs_UnpackTags2 (tags, &pt);
fs/yaffs2/yaffs_packedtags2.h +2 -2
@@ -11,12 +11,12 @@unsigned objectId;unsigned chunkId;unsigned byteCount; -} yaffs_PackedTags2TagsPart; +} __attribute__((__packed__)) yaffs_PackedTags2TagsPart;typedef struct {yaffs_PackedTags2TagsPart t;yaffs_ECCOther ecc; -}yaffs_PackedTags2 ; +} __attribute__((__packed__ ))yaffs_PackedTags2 ;void yaffs_PackTags2 (yaffs_PackedTags2 * pt,const yaffs_ExtendedTags * t);void yaffs_UnpackTags2 (yaffs_ExtendedTags * t,yaffs_PackedTags2 * pt);