projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make bigger RAM emulation
[yaffs2.git]
/
yaffs_guts.c
diff --git
a/yaffs_guts.c
b/yaffs_guts.c
index e87109bd353fc3943fd622cf4ba31cb2fd76e27d..740a2563dd9ed3261e631d2bee0eb7cd62a5647a 100644
(file)
--- a/
yaffs_guts.c
+++ b/
yaffs_guts.c
@@
-1,19
+1,20
@@
+
/*
/*
- * YAFFS: Yet another FFS. A NAND-flash specific file system.
- * yaffs_guts.c The main guts of YAFFS
+ * YAFFS: Yet another FFS. A NAND-flash specific file system.
*
* Copyright (C) 2002 Aleph One Ltd.
* for Toby Churchill Ltd and Brightstar Engineering
*
* Created by Charles Manning <charles@aleph1.co.uk>
*
*
* Copyright (C) 2002 Aleph One Ltd.
* for Toby Churchill Ltd and Brightstar Engineering
*
* Created by Charles Manning <charles@aleph1.co.uk>
*
+ * 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.
*
*/
//yaffs_guts.c
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
//yaffs_guts.c
-const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.
2 2004-11-16 02:36:15
charles Exp $";
+const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.
5 2005-03-16 04:00:36
charles Exp $";
#include "yportenv.h"
#include "yportenv.h"
@@
-201,7
+202,7
@@
int yaffs_EraseBlockInNAND(struct yaffs_DeviceStruct *dev,int blockInNAND)
return result;
}
return result;
}
-int yaffs_InitialiseNAND(struct yaffs_DeviceStruct *dev)
+
static
int yaffs_InitialiseNAND(struct yaffs_DeviceStruct *dev)
{
return dev->initialiseNAND(dev);
}
{
return dev->initialiseNAND(dev);
}
@@
-475,7
+476,8
@@
int yaffs_CheckFF(__u8 *buffer,int nBytes)
//Horrible, slow implementation
while(nBytes--)
{
//Horrible, slow implementation
while(nBytes--)
{
- if(*buffer != 0xFF) return 0;
+ if(*buffer != 0xFF) return 0;
+ buffer++;
}
return 1;
}
}
return 1;
}
@@
-487,7
+489,8
@@
static int yaffs_CheckChunkErased(struct yaffs_DeviceStruct *dev,int chunkInNAND
__u8 *data = yaffs_GetTempBuffer(dev,__LINE__);
yaffs_ExtendedTags tags;
__u8 *data = yaffs_GetTempBuffer(dev,__LINE__);
yaffs_ExtendedTags tags;
- dev->readChunkWithTagsFromNAND(dev,chunkInNAND,data,&tags);
+// NCB dev->readChunkWithTagsFromNAND(dev,chunkInNAND,data,&tags);
+ yaffs_ReadChunkWithTagsFromNAND(dev,chunkInNAND,data,&tags);
if(!yaffs_CheckFF(data,dev->nBytesPerChunk) || tags.chunkUsed)
{
if(!yaffs_CheckFF(data,dev->nBytesPerChunk) || tags.chunkUsed)
{
@@
-4524,6
+4527,8
@@
static int yaffs_Scan(yaffs_Device *dev)
__u8 *chunkData;
yaffs_BlockIndex *blockIndex = NULL;
__u8 *chunkData;
yaffs_BlockIndex *blockIndex = NULL;
+
+ T(YAFFS_TRACE_SCAN,(TSTR("yaffs_Scan starts startblk %d endblk %d..." TENDSTR),dev->startBlock,dev->endBlock));
chunkData = yaffs_GetTempBuffer(dev,__LINE__);
chunkData = yaffs_GetTempBuffer(dev,__LINE__);
@@
-4548,6
+4553,8
@@
static int yaffs_Scan(yaffs_Device *dev)
bi->blockState = state;
bi->sequenceNumber = sequenceNumber;
bi->blockState = state;
bi->sequenceNumber = sequenceNumber;
+
+ T(YAFFS_TRACE_SCAN_DEBUG,(TSTR("Block scanning block %d state %d seq %d" TENDSTR),blk,state,sequenceNumber));
if(state == YAFFS_BLOCK_STATE_DEAD)
{
if(state == YAFFS_BLOCK_STATE_DEAD)
{
@@
-4555,6
+4562,7
@@
static int yaffs_Scan(yaffs_Device *dev)
}
else if(state == YAFFS_BLOCK_STATE_EMPTY)
{
}
else if(state == YAFFS_BLOCK_STATE_EMPTY)
{
+ T(YAFFS_TRACE_SCAN_DEBUG,(TSTR("Block empty " TENDSTR)));
dev->nErasedBlocks++;
dev->nFreeChunks += dev->nChunksPerBlock;
}
dev->nErasedBlocks++;
dev->nFreeChunks += dev->nChunksPerBlock;
}
@@
-4610,6
+4618,7
@@
static int yaffs_Scan(yaffs_Device *dev)
{
startIterator = 0;
endIterator = nBlocksToScan-1;
{
startIterator = 0;
endIterator = nBlocksToScan-1;
+ T(YAFFS_TRACE_SCAN_DEBUG,(TSTR("%d blocks to be scanned" TENDSTR),nBlocksToScan));
}
else
{
}
else
{
@@
-4947,6
+4956,9
@@
static int yaffs_Scan(yaffs_Device *dev)
}
yaffs_ReleaseTempBuffer(dev,chunkData,__LINE__);
}
yaffs_ReleaseTempBuffer(dev,chunkData,__LINE__);
+
+ T(YAFFS_TRACE_SCAN,(TSTR("yaffs_Scan ends" TENDSTR)));
+
return YAFFS_OK;
}
return YAFFS_OK;
}
@@
-5313,11
+5325,12
@@
int yaffs_GutsInitialise(yaffs_Device *dev)
int extraBits;
int nBlocks;
int extraBits;
int nBlocks;
+ T(YAFFS_TRACE_ALWAYS,(TSTR("yaffs: yaffs_GutsInitialise()" TENDSTR)));
// Check stuff that must be set
if(!dev)
{
// Check stuff that must be set
if(!dev)
{
- T(YAFFS_TRACE_ALWAYS,(TSTR("yaffs: Need a device
\n
" TENDSTR)));
+ T(YAFFS_TRACE_ALWAYS,(TSTR("yaffs: Need a device" TENDSTR)));
return YAFFS_FAIL;
}
return YAFFS_FAIL;
}
@@
-5332,10
+5345,16
@@
int yaffs_GutsInitialise(yaffs_Device *dev)
dev->endBlock <= (dev->startBlock + dev->nReservedBlocks + 2) // otherwise it is too small
)
{
dev->endBlock <= (dev->startBlock + dev->nReservedBlocks + 2) // otherwise it is too small
)
{
- T(YAFFS_TRACE_ALWAYS,(TSTR("yaffs: nand geometry problems\n" TENDSTR)));
+ T(YAFFS_TRACE_ALWAYS,(TSTR("yaffs: NAND geometry problems: chunk size %d, type is yaffs%s " TENDSTR),
+ dev->nBytesPerChunk, dev->isYaffs2 ? "2" : ""));
return YAFFS_FAIL;
}
return YAFFS_FAIL;
}
+ if(yaffs_InitialiseNAND(dev) != YAFFS_OK)
+ {
+ T(YAFFS_TRACE_ALWAYS,(TSTR("yaffs: InitialiseNAND failed" TENDSTR)));
+ return YAFFS_FAIL;
+ }
// Got the right mix of functions?
//
// Got the right mix of functions?
//
@@
-5442,7
+5461,6
@@
int yaffs_GutsInitialise(yaffs_Device *dev)
-
yaffs_InitialiseBlocks(dev,nBlocks);
yaffs_InitialiseTnodes(dev);
yaffs_InitialiseBlocks(dev,nBlocks);
yaffs_InitialiseTnodes(dev);
@@
-5502,7
+5520,7
@@
int yaffs_GutsInitialise(yaffs_Device *dev)
dev->nRetiredBlocks = 0;
dev->nRetiredBlocks = 0;
-
+ T(YAFFS_TRACE_ALWAYS,(TSTR("yaffs: yaffs_GutsInitialise() done.\n" TENDSTR)));
return YAFFS_OK;
}
return YAFFS_OK;
}
@@
-5686,4
+5704,3
@@
void yaffs_GutsTest(yaffs_Device *dev)
#endif
#endif
-