There is a minor bug in yaffs_mtdif2.c when converting from blockNo to
mtd offsets. If the offset ends up being > 2^31-1, then it gets
converted to a negative number, and then the loff_t gets stuff up.
However in general mtd supports up to 4GB (in theory, although I've
found a bunch of other things that make this difficult).
Anyway, I've attached a pretty trivial patch which adds a simple 2 line
conversion function, and calls this when necessary.
Andre
--
Bluewater Systems Ltd - ARM Technology Solutions Centre
Andre Renaud Bluewater Systems Ltd
Phone: +64 3 3779127 (Aus 1 800 148 751) Level 17, 119 Armagh St
Fax: +64 3 3779135 PO Box 13889
Email: arenaud@bluewatersys.com Christchurch
Web: http://www.bluewatersys.com New Zealand
Index: yaffs_mtdif2.c
===================================================================
--- yaffs_mtdif2.c (revision 1376)
+++ yaffs_mtdif2.c (working copy)
@@ -27,6 +27,12 @@
#include "yaffs_packedtags2.h"
+static loff_t block2offset (yaffs_Device *dev, int blockNo)
+{
+ return (loff_t)blockNo * (loff_t)dev->nChunksPerBlock *
+ (loff_t)dev->nDataBytesPerChunk;
+}
+
int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND,
const __u8 * data,
const yaffs_ExtendedTags * tags)
@@ -176,9 +182,7 @@
(TSTR("nandmtd2_MarkNANDBlockBad %d" TENDSTR), blockNo));
retval =
- mtd->block_markbad(mtd,
- blockNo * dev->nChunksPerBlock *
- dev->nDataBytesPerChunk);
+ mtd->block_markbad(mtd, block2offset (dev, blockNo));
if (retval == 0)
return YAFFS_OK;
@@ -196,9 +200,7 @@
T(YAFFS_TRACE_MTD,
(TSTR("nandmtd2_QueryNANDBlock %d" TENDSTR), blockNo));
retval =
- mtd->block_isbad(mtd,
- blockNo * dev->nChunksPerBlock *
- dev->nDataBytesPerChunk);
+ mtd->block_isbad(mtd, block2offset (dev, blockNo));
if (retval) {
T(YAFFS_TRACE_MTD, (TSTR("block is bad" TENDSTR)));