X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_tagscompat.c;h=aed101e45be5aa7421396f2d57ae54326d49c5d9;hp=7f8442c05f2f251001232dd4929cc41edcb28807;hb=40c386c7a14ebfa8afc14562f3b33a416831b26d;hpb=6f1de4473200f31d1ca1cf4672baf7afcdec2db0 diff --git a/yaffs_tagscompat.c b/yaffs_tagscompat.c index 7f8442c..aed101e 100644 --- a/yaffs_tagscompat.c +++ b/yaffs_tagscompat.c @@ -9,12 +9,12 @@ * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. - * */ #include "yaffs_guts.h" #include "yaffs_tagscompat.h" #include "yaffs_ecc.h" +#include "yaffs_getblockinfo.h" static void yaffs_HandleReadDataError(yaffs_Device * dev, int chunkInNAND); #ifdef NOTYET @@ -46,7 +46,7 @@ static const char yaffs_countBitsTable[256] = { 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 }; -static int yaffs_CountBits(__u8 x) +int yaffs_CountBits(__u8 x) { int retVal; retVal = yaffs_countBitsTable[x]; @@ -253,6 +253,9 @@ static int yaffs_ReadChunkFromNAND(struct yaffs_DeviceStruct *dev, /* Must allocate enough memory for spare+2*sizeof(int) */ /* for ecc results from device. */ struct yaffs_NANDSpare nspare; + + memset(&nspare,0,sizeof(nspare)); + retVal = dev->readChunkFromNAND(dev, chunkInNAND, data, (yaffs_Spare *) & nspare); @@ -337,7 +340,7 @@ static void yaffs_HandleReadDataError(yaffs_Device * dev, int chunkInNAND) int blockInNAND = chunkInNAND / dev->nChunksPerBlock; /* Mark the block for retirement */ - yaffs_GetBlockInfo(dev, blockInNAND)->needsRetiring = 1; + yaffs_GetBlockInfo(dev, blockInNAND + dev->blockOffset)->needsRetiring = 1; T(YAFFS_TRACE_ERROR | YAFFS_TRACE_BAD_BLOCKS, (TSTR("**>>Block %d marked for retirement" TENDSTR), blockInNAND)); @@ -439,7 +442,7 @@ int yaffs_TagsCompatabilityReadChunkWithTagsFromNAND(yaffs_Device * dev, yaffs_ECCResult eccResult; static yaffs_Spare spareFF; - static int init; + static int init = 0; if (!init) { memset(&spareFF, 0xFF, sizeof(spareFF)); @@ -498,9 +501,9 @@ int yaffs_TagsCompatabilityMarkNANDBlockBad(struct yaffs_DeviceStruct *dev, } int yaffs_TagsCompatabilityQueryNANDBlock(struct yaffs_DeviceStruct *dev, - int blockNo, yaffs_BlockState * - state, - int *sequenceNumber) + int blockNo, + yaffs_BlockState *state, + __u32 *sequenceNumber) { yaffs_Spare spare0, spare1;