mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-25 15:06:47 +02:00
[kernel] nuke trailing whitespaces in the yaffs code
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11277 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
6be2f95016
commit
512f1628d2
@ -26,7 +26,7 @@ config YAFFS_YAFFS1
|
||||
default y
|
||||
help
|
||||
Enable YAFFS1 support -- yaffs for 512 byte / page devices
|
||||
|
||||
|
||||
Not needed for 2K-page devices.
|
||||
|
||||
If unsure, say Y.
|
||||
@ -157,9 +157,9 @@ config YAFFS_ALWAYS_CHECK_CHUNK_ERASED
|
||||
Enabling this forces on the test that chunks are erased in flash
|
||||
before writing to them. This takes more time but is potentially
|
||||
a bit more secure.
|
||||
|
||||
|
||||
Suggest setting Y during development and ironing out driver
|
||||
issues etc. Suggest setting to N if you want faster writing.
|
||||
issues etc. Suggest setting to N if you want faster writing.
|
||||
|
||||
If unsure, say Y.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
/*
|
||||
* This file is just holds extra declarations used during development.
|
||||
* Most of these are from kernel includes placed here so we can use them in
|
||||
* Most of these are from kernel includes placed here so we can use them in
|
||||
* applications.
|
||||
*
|
||||
*/
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
*
|
||||
* Created by Martin Fouts <Martin.Fouts@palmsource.com>
|
||||
* Created by Martin Fouts <Martin.Fouts@palmsource.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1 as
|
||||
|
@ -22,27 +22,27 @@ static int yaffs_CheckpointSpaceOk(yaffs_Device *dev)
|
||||
{
|
||||
|
||||
int blocksAvailable = dev->nErasedBlocks - dev->nReservedBlocks;
|
||||
|
||||
|
||||
T(YAFFS_TRACE_CHECKPOINT,
|
||||
(TSTR("checkpt blocks available = %d" TENDSTR),
|
||||
blocksAvailable));
|
||||
|
||||
|
||||
|
||||
|
||||
return (blocksAvailable <= 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
static int yaffs_CheckpointErase(yaffs_Device *dev)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
if(!dev->eraseBlockInNAND)
|
||||
int i;
|
||||
|
||||
|
||||
if(!dev->eraseBlockInNAND)
|
||||
return 0;
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("checking blocks %d to %d"TENDSTR),
|
||||
dev->internalStartBlock,dev->internalEndBlock));
|
||||
|
||||
|
||||
for(i = dev->internalStartBlock; i <= dev->internalEndBlock; i++) {
|
||||
yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev,i);
|
||||
if(bi->blockState == YAFFS_BLOCK_STATE_CHECKPOINT){
|
||||
@ -58,9 +58,9 @@ static int yaffs_CheckpointErase(yaffs_Device *dev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dev->blocksInCheckpoint = 0;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -72,11 +72,11 @@ static void yaffs_CheckpointFindNextErasedBlock(yaffs_Device *dev)
|
||||
T(YAFFS_TRACE_CHECKPOINT,
|
||||
(TSTR("allocating checkpt block: erased %d reserved %d avail %d next %d "TENDSTR),
|
||||
dev->nErasedBlocks,dev->nReservedBlocks,blocksAvailable,dev->checkpointNextBlock));
|
||||
|
||||
|
||||
if(dev->checkpointNextBlock >= 0 &&
|
||||
dev->checkpointNextBlock <= dev->internalEndBlock &&
|
||||
blocksAvailable > 0){
|
||||
|
||||
|
||||
for(i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++){
|
||||
yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev,i);
|
||||
if(bi->blockState == YAFFS_BLOCK_STATE_EMPTY){
|
||||
@ -88,7 +88,7 @@ static void yaffs_CheckpointFindNextErasedBlock(yaffs_Device *dev)
|
||||
}
|
||||
}
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("out of checkpt blocks"TENDSTR)));
|
||||
|
||||
|
||||
dev->checkpointNextBlock = -1;
|
||||
dev->checkpointCurrentBlock = -1;
|
||||
}
|
||||
@ -97,19 +97,19 @@ static void yaffs_CheckpointFindNextCheckpointBlock(yaffs_Device *dev)
|
||||
{
|
||||
int i;
|
||||
yaffs_ExtendedTags tags;
|
||||
|
||||
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("find next checkpt block: start: blocks %d next %d" TENDSTR),
|
||||
dev->blocksInCheckpoint, dev->checkpointNextBlock));
|
||||
|
||||
if(dev->blocksInCheckpoint < dev->checkpointMaxBlocks)
|
||||
|
||||
if(dev->blocksInCheckpoint < dev->checkpointMaxBlocks)
|
||||
for(i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++){
|
||||
int chunk = i * dev->nChunksPerBlock;
|
||||
int realignedChunk = chunk - dev->chunkOffset;
|
||||
|
||||
dev->readChunkWithTagsFromNAND(dev,realignedChunk,NULL,&tags);
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("find next checkpt block: search: block %d oid %d seq %d eccr %d" TENDSTR),
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("find next checkpt block: search: block %d oid %d seq %d eccr %d" TENDSTR),
|
||||
i, tags.objectId,tags.sequenceNumber,tags.eccResult));
|
||||
|
||||
|
||||
if(tags.sequenceNumber == YAFFS_SEQUENCE_CHECKPOINT_DATA){
|
||||
/* Right kind of block */
|
||||
dev->checkpointNextBlock = tags.objectId;
|
||||
@ -130,7 +130,7 @@ static void yaffs_CheckpointFindNextCheckpointBlock(yaffs_Device *dev)
|
||||
|
||||
int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting)
|
||||
{
|
||||
|
||||
|
||||
/* Got the functions we need? */
|
||||
if (!dev->writeChunkWithTagsToNAND ||
|
||||
!dev->readChunkWithTagsFromNAND ||
|
||||
@ -140,31 +140,31 @@ int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting)
|
||||
|
||||
if(forWriting && !yaffs_CheckpointSpaceOk(dev))
|
||||
return 0;
|
||||
|
||||
|
||||
if(!dev->checkpointBuffer)
|
||||
dev->checkpointBuffer = YMALLOC_DMA(dev->nDataBytesPerChunk);
|
||||
if(!dev->checkpointBuffer)
|
||||
return 0;
|
||||
|
||||
|
||||
|
||||
dev->checkpointPageSequence = 0;
|
||||
|
||||
|
||||
dev->checkpointOpenForWrite = forWriting;
|
||||
|
||||
|
||||
dev->checkpointByteCount = 0;
|
||||
dev->checkpointSum = 0;
|
||||
dev->checkpointXor = 0;
|
||||
dev->checkpointCurrentBlock = -1;
|
||||
dev->checkpointCurrentChunk = -1;
|
||||
dev->checkpointNextBlock = dev->internalStartBlock;
|
||||
|
||||
|
||||
/* Erase all the blocks in the checkpoint area */
|
||||
if(forWriting){
|
||||
memset(dev->checkpointBuffer,0,dev->nDataBytesPerChunk);
|
||||
dev->checkpointByteOffset = 0;
|
||||
return yaffs_CheckpointErase(dev);
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
int i;
|
||||
/* Set to a value that will kick off a read */
|
||||
@ -177,7 +177,7 @@ int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting)
|
||||
for(i = 0; i < dev->checkpointMaxBlocks; i++)
|
||||
dev->checkpointBlockList[i] = -1;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -196,15 +196,15 @@ static int yaffs_CheckpointFlushBuffer(yaffs_Device *dev)
|
||||
int realignedChunk;
|
||||
|
||||
yaffs_ExtendedTags tags;
|
||||
|
||||
|
||||
if(dev->checkpointCurrentBlock < 0){
|
||||
yaffs_CheckpointFindNextErasedBlock(dev);
|
||||
dev->checkpointCurrentChunk = 0;
|
||||
}
|
||||
|
||||
|
||||
if(dev->checkpointCurrentBlock < 0)
|
||||
return 0;
|
||||
|
||||
|
||||
tags.chunkDeleted = 0;
|
||||
tags.objectId = dev->checkpointNextBlock; /* Hint to next place to look */
|
||||
tags.chunkId = dev->checkpointPageSequence + 1;
|
||||
@ -217,25 +217,25 @@ static int yaffs_CheckpointFlushBuffer(yaffs_Device *dev)
|
||||
bi->blockState = YAFFS_BLOCK_STATE_CHECKPOINT;
|
||||
dev->blocksInCheckpoint++;
|
||||
}
|
||||
|
||||
|
||||
chunk = dev->checkpointCurrentBlock * dev->nChunksPerBlock + dev->checkpointCurrentChunk;
|
||||
|
||||
|
||||
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("checkpoint wite buffer nand %d(%d:%d) objid %d chId %d" TENDSTR),
|
||||
chunk, dev->checkpointCurrentBlock, dev->checkpointCurrentChunk,tags.objectId,tags.chunkId));
|
||||
|
||||
chunk, dev->checkpointCurrentBlock, dev->checkpointCurrentChunk,tags.objectId,tags.chunkId));
|
||||
|
||||
realignedChunk = chunk - dev->chunkOffset;
|
||||
|
||||
|
||||
dev->writeChunkWithTagsToNAND(dev,realignedChunk,dev->checkpointBuffer,&tags);
|
||||
dev->checkpointByteOffset = 0;
|
||||
dev->checkpointPageSequence++;
|
||||
dev->checkpointPageSequence++;
|
||||
dev->checkpointCurrentChunk++;
|
||||
if(dev->checkpointCurrentChunk >= dev->nChunksPerBlock){
|
||||
dev->checkpointCurrentChunk = 0;
|
||||
dev->checkpointCurrentBlock = -1;
|
||||
}
|
||||
memset(dev->checkpointBuffer,0,dev->nDataBytesPerChunk);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -245,37 +245,37 @@ int yaffs_CheckpointWrite(yaffs_Device *dev,const void *data, int nBytes)
|
||||
int i=0;
|
||||
int ok = 1;
|
||||
|
||||
|
||||
|
||||
__u8 * dataBytes = (__u8 *)data;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(!dev->checkpointBuffer)
|
||||
return 0;
|
||||
|
||||
|
||||
if(!dev->checkpointOpenForWrite)
|
||||
return -1;
|
||||
|
||||
while(i < nBytes && ok) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dev->checkpointBuffer[dev->checkpointByteOffset] = *dataBytes ;
|
||||
dev->checkpointSum += *dataBytes;
|
||||
dev->checkpointXor ^= *dataBytes;
|
||||
|
||||
|
||||
dev->checkpointByteOffset++;
|
||||
i++;
|
||||
dataBytes++;
|
||||
dev->checkpointByteCount++;
|
||||
|
||||
|
||||
|
||||
|
||||
if(dev->checkpointByteOffset < 0 ||
|
||||
dev->checkpointByteOffset >= dev->nDataBytesPerChunk)
|
||||
dev->checkpointByteOffset >= dev->nDataBytesPerChunk)
|
||||
ok = yaffs_CheckpointFlushBuffer(dev);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -285,12 +285,12 @@ int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
|
||||
int ok = 1;
|
||||
yaffs_ExtendedTags tags;
|
||||
|
||||
|
||||
|
||||
int chunk;
|
||||
int realignedChunk;
|
||||
|
||||
__u8 *dataBytes = (__u8 *)data;
|
||||
|
||||
|
||||
if(!dev->checkpointBuffer)
|
||||
return 0;
|
||||
|
||||
@ -298,31 +298,31 @@ int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
|
||||
return -1;
|
||||
|
||||
while(i < nBytes && ok) {
|
||||
|
||||
|
||||
|
||||
|
||||
if(dev->checkpointByteOffset < 0 ||
|
||||
dev->checkpointByteOffset >= dev->nDataBytesPerChunk) {
|
||||
|
||||
|
||||
if(dev->checkpointCurrentBlock < 0){
|
||||
yaffs_CheckpointFindNextCheckpointBlock(dev);
|
||||
dev->checkpointCurrentChunk = 0;
|
||||
}
|
||||
|
||||
|
||||
if(dev->checkpointCurrentBlock < 0)
|
||||
ok = 0;
|
||||
else {
|
||||
|
||||
chunk = dev->checkpointCurrentBlock * dev->nChunksPerBlock +
|
||||
|
||||
chunk = dev->checkpointCurrentBlock * dev->nChunksPerBlock +
|
||||
dev->checkpointCurrentChunk;
|
||||
|
||||
realignedChunk = chunk - dev->chunkOffset;
|
||||
|
||||
/* read in the next chunk */
|
||||
/* printf("read checkpoint page %d\n",dev->checkpointPage); */
|
||||
dev->readChunkWithTagsFromNAND(dev, realignedChunk,
|
||||
dev->readChunkWithTagsFromNAND(dev, realignedChunk,
|
||||
dev->checkpointBuffer,
|
||||
&tags);
|
||||
|
||||
|
||||
if(tags.chunkId != (dev->checkpointPageSequence + 1) ||
|
||||
tags.sequenceNumber != YAFFS_SEQUENCE_CHECKPOINT_DATA)
|
||||
ok = 0;
|
||||
@ -330,12 +330,12 @@ int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
|
||||
dev->checkpointByteOffset = 0;
|
||||
dev->checkpointPageSequence++;
|
||||
dev->checkpointCurrentChunk++;
|
||||
|
||||
|
||||
if(dev->checkpointCurrentChunk >= dev->nChunksPerBlock)
|
||||
dev->checkpointCurrentBlock = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ok){
|
||||
*dataBytes = dev->checkpointBuffer[dev->checkpointByteOffset];
|
||||
dev->checkpointSum += *dataBytes;
|
||||
@ -346,14 +346,14 @@ int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
|
||||
dev->checkpointByteCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int yaffs_CheckpointClose(yaffs_Device *dev)
|
||||
{
|
||||
|
||||
if(dev->checkpointOpenForWrite){
|
||||
if(dev->checkpointOpenForWrite){
|
||||
if(dev->checkpointByteOffset != 0)
|
||||
yaffs_CheckpointFlushBuffer(dev);
|
||||
} else {
|
||||
@ -373,19 +373,19 @@ int yaffs_CheckpointClose(yaffs_Device *dev)
|
||||
dev->nFreeChunks -= dev->blocksInCheckpoint * dev->nChunksPerBlock;
|
||||
dev->nErasedBlocks -= dev->blocksInCheckpoint;
|
||||
|
||||
|
||||
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("checkpoint byte count %d" TENDSTR),
|
||||
dev->checkpointByteCount));
|
||||
|
||||
|
||||
if(dev->checkpointBuffer){
|
||||
/* free the buffer */
|
||||
/* free the buffer */
|
||||
YFREE(dev->checkpointBuffer);
|
||||
dev->checkpointBuffer = NULL;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int yaffs_CheckpointInvalidateStream(yaffs_Device *dev)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -14,9 +14,9 @@
|
||||
/*
|
||||
* This code implements the ECC algorithm used in SmartMedia.
|
||||
*
|
||||
* The ECC comprises 22 bits of parity information and is stuffed into 3 bytes.
|
||||
* The ECC comprises 22 bits of parity information and is stuffed into 3 bytes.
|
||||
* The two unused bit are set to 1.
|
||||
* The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC
|
||||
* The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC
|
||||
* blocks are used on a 512-byte NAND page.
|
||||
*
|
||||
*/
|
||||
@ -228,8 +228,8 @@ int yaffs_ECCCorrect(unsigned char *data, unsigned char *read_ecc,
|
||||
return 1; /* Corrected the error */
|
||||
}
|
||||
|
||||
if ((yaffs_CountBits(d0) +
|
||||
yaffs_CountBits(d1) +
|
||||
if ((yaffs_CountBits(d0) +
|
||||
yaffs_CountBits(d1) +
|
||||
yaffs_CountBits(d2)) == 1) {
|
||||
/* Reccoverable error in ecc */
|
||||
|
||||
@ -239,7 +239,7 @@ int yaffs_ECCCorrect(unsigned char *data, unsigned char *read_ecc,
|
||||
|
||||
return 1; /* Corrected the error */
|
||||
}
|
||||
|
||||
|
||||
/* Unrecoverable error */
|
||||
|
||||
return -1;
|
||||
@ -293,7 +293,7 @@ int yaffs_ECCCorrectOther(unsigned char *data, unsigned nBytes,
|
||||
if ((cDelta | lDelta | lDeltaPrime) == 0)
|
||||
return 0; /* no error */
|
||||
|
||||
if (lDelta == ~lDeltaPrime &&
|
||||
if (lDelta == ~lDeltaPrime &&
|
||||
(((cDelta ^ (cDelta >> 1)) & 0x15) == 0x15))
|
||||
{
|
||||
/* Single bit (recoverable) error in data */
|
||||
@ -309,7 +309,7 @@ int yaffs_ECCCorrectOther(unsigned char *data, unsigned nBytes,
|
||||
|
||||
if(lDelta >= nBytes)
|
||||
return -1;
|
||||
|
||||
|
||||
data[lDelta] ^= (1 << bit);
|
||||
|
||||
return 1; /* corrected */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
@ -16,9 +16,9 @@
|
||||
/*
|
||||
* This code implements the ECC algorithm used in SmartMedia.
|
||||
*
|
||||
* The ECC comprises 22 bits of parity information and is stuffed into 3 bytes.
|
||||
* The ECC comprises 22 bits of parity information and is stuffed into 3 bytes.
|
||||
* The two unused bit are set to 1.
|
||||
* The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC
|
||||
* The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC
|
||||
* blocks are used on a 512-byte NAND page.
|
||||
*
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@
|
||||
* This is the file system front-end to YAFFS that hooks it up to
|
||||
* the VFS.
|
||||
*
|
||||
* Special notes:
|
||||
* Special notes:
|
||||
* >> 2.4: sb->u.generic_sbp points to the yaffs_Device associated with
|
||||
* this superblock
|
||||
* >> 2.6: sb->s_fs_info points to the yaffs_Device associated with this
|
||||
@ -391,7 +391,7 @@ static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry)
|
||||
dentry->d_name.name);
|
||||
|
||||
obj = yaffs_GetEquivalentObject(obj); /* in case it was a hardlink */
|
||||
|
||||
|
||||
/* Can't hold gross lock when calling yaffs_get_inode() */
|
||||
yaffs_GrossUnlock(dev);
|
||||
|
||||
@ -729,21 +729,21 @@ static void yaffs_FillInodeFromObject(struct inode *inode, yaffs_Object * obj)
|
||||
obj->yst_mode &= ~S_IFMT;
|
||||
obj->yst_mode |= S_IFREG;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case YAFFS_OBJECT_TYPE_SYMLINK :
|
||||
if( ! S_ISLNK(mode) ){
|
||||
obj->yst_mode &= ~S_IFMT;
|
||||
obj->yst_mode |= S_IFLNK;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case YAFFS_OBJECT_TYPE_DIRECTORY :
|
||||
if( ! S_ISDIR(mode) ){
|
||||
obj->yst_mode &= ~S_IFMT;
|
||||
obj->yst_mode |= S_IFDIR;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case YAFFS_OBJECT_TYPE_UNKNOWN :
|
||||
case YAFFS_OBJECT_TYPE_HARDLINK :
|
||||
@ -1020,7 +1020,7 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
|
||||
int error = -ENOSPC;
|
||||
uid_t uid = current->fsuid;
|
||||
gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
|
||||
|
||||
|
||||
if((dir->i_mode & S_ISGID) && S_ISDIR(mode))
|
||||
mode |= S_ISGID;
|
||||
|
||||
@ -1075,7 +1075,7 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
|
||||
obj = NULL; /* Do we ever get here? */
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Can not call yaffs_get_inode() with gross lock held */
|
||||
yaffs_GrossUnlock(dev);
|
||||
|
||||
@ -1264,13 +1264,13 @@ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
target =
|
||||
yaffs_FindObjectByName(yaffs_InodeToObject(new_dir),
|
||||
new_dentry->d_name.name);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (target &&
|
||||
target->variantType == YAFFS_OBJECT_TYPE_DIRECTORY &&
|
||||
!list_empty(&target->variant.directoryVariant.children)) {
|
||||
|
||||
|
||||
T(YAFFS_TRACE_OS, (KERN_DEBUG "target is non-empty dir\n"));
|
||||
|
||||
retVal = YAFFS_FAIL;
|
||||
@ -1278,7 +1278,7 @@ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
|
||||
/* Now does unlinking internally using shadowing mechanism */
|
||||
T(YAFFS_TRACE_OS, (KERN_DEBUG "calling yaffs_RenameObject\n"));
|
||||
|
||||
|
||||
retVal =
|
||||
yaffs_RenameObject(yaffs_InodeToObject(old_dir),
|
||||
old_dentry->d_name.name,
|
||||
@ -1390,7 +1390,7 @@ static int yaffs_do_sync_fs(struct super_block *sb)
|
||||
|
||||
if(dev)
|
||||
yaffs_CheckpointSave(dev);
|
||||
|
||||
|
||||
yaffs_GrossUnlock(dev);
|
||||
|
||||
sb->s_dirt = 0;
|
||||
@ -1421,16 +1421,16 @@ static int yaffs_sync_fs(struct super_block *sb)
|
||||
{
|
||||
|
||||
T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_sync_fs\n"));
|
||||
|
||||
|
||||
return 0; /* yaffs_do_sync_fs(sb);*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void yaffs_read_inode(struct inode *inode)
|
||||
{
|
||||
/* NB This is called as a side effect of other functions, but
|
||||
* we had to release the lock to prevent deadlocks, so
|
||||
* we had to release the lock to prevent deadlocks, so
|
||||
* need to lock again.
|
||||
*/
|
||||
|
||||
@ -1441,7 +1441,7 @@ static void yaffs_read_inode(struct inode *inode)
|
||||
(KERN_DEBUG "yaffs_read_inode for %d\n", (int)inode->i_ino));
|
||||
|
||||
yaffs_GrossLock(dev);
|
||||
|
||||
|
||||
obj = yaffs_FindObjectByNumber(dev, inode->i_ino);
|
||||
|
||||
yaffs_FillInodeFromObject(inode, obj);
|
||||
@ -1458,26 +1458,26 @@ static int yaffs_remount_fs(struct super_block *sb, int *flags, char *data)
|
||||
|
||||
if( *flags & MS_RDONLY ) {
|
||||
struct mtd_info *mtd = yaffs_SuperToDevice(sb)->genericDevice;
|
||||
|
||||
|
||||
T(YAFFS_TRACE_OS,
|
||||
(KERN_DEBUG "yaffs_remount_fs: %s: RO\n", dev->name ));
|
||||
|
||||
yaffs_GrossLock(dev);
|
||||
|
||||
|
||||
yaffs_FlushEntireDeviceCache(dev);
|
||||
|
||||
|
||||
yaffs_CheckpointSave(dev);
|
||||
|
||||
|
||||
if (mtd->sync)
|
||||
mtd->sync(mtd);
|
||||
|
||||
yaffs_GrossUnlock(dev);
|
||||
}
|
||||
else {
|
||||
T(YAFFS_TRACE_OS,
|
||||
T(YAFFS_TRACE_OS,
|
||||
(KERN_DEBUG "yaffs_remount_fs: %s: RW\n", dev->name ));
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -1489,7 +1489,7 @@ static void yaffs_put_super(struct super_block *sb)
|
||||
T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_put_super\n"));
|
||||
|
||||
yaffs_GrossLock(dev);
|
||||
|
||||
|
||||
yaffs_FlushEntireDeviceCache(dev);
|
||||
|
||||
yaffs_CheckpointSave(dev);
|
||||
@ -1499,12 +1499,12 @@ static void yaffs_put_super(struct super_block *sb)
|
||||
}
|
||||
|
||||
yaffs_Deinitialise(dev);
|
||||
|
||||
|
||||
yaffs_GrossUnlock(dev);
|
||||
|
||||
/* we assume this is protected by lock_kernel() in mount/umount */
|
||||
list_del(&dev->devList);
|
||||
|
||||
|
||||
if(dev->spareBuffer){
|
||||
YFREE(dev->spareBuffer);
|
||||
dev->spareBuffer = NULL;
|
||||
@ -1530,7 +1530,7 @@ static void yaffs_MTDPutSuper(struct super_block *sb)
|
||||
static void yaffs_MarkSuperBlockDirty(void *vsb)
|
||||
{
|
||||
struct super_block *sb = (struct super_block *)vsb;
|
||||
|
||||
|
||||
T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_MarkSuperBlockDirty() sb = %p\n",sb));
|
||||
// if(sb)
|
||||
// sb->s_dirt = 1;
|
||||
@ -1549,13 +1549,13 @@ static int yaffs_parse_options(yaffs_options *options, const char *options_str)
|
||||
char cur_opt[MAX_OPT_LEN+1];
|
||||
int p;
|
||||
int error = 0;
|
||||
|
||||
|
||||
/* Parse through the options which is a comma seperated list */
|
||||
|
||||
|
||||
while(options_str && *options_str && !error){
|
||||
memset(cur_opt,0,MAX_OPT_LEN+1);
|
||||
p = 0;
|
||||
|
||||
|
||||
while(*options_str && *options_str != ','){
|
||||
if(p < MAX_OPT_LEN){
|
||||
cur_opt[p] = *options_str;
|
||||
@ -1563,7 +1563,7 @@ static int yaffs_parse_options(yaffs_options *options, const char *options_str)
|
||||
}
|
||||
options_str++;
|
||||
}
|
||||
|
||||
|
||||
if(!strcmp(cur_opt,"inband-tags"))
|
||||
options->inband_tags = 1;
|
||||
else if(!strcmp(cur_opt,"no-cache"))
|
||||
@ -1579,7 +1579,7 @@ static int yaffs_parse_options(yaffs_options *options, const char *options_str)
|
||||
printk(KERN_INFO "yaffs: Bad mount option \"%s\"\n",cur_opt);
|
||||
error = 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return error;
|
||||
@ -1597,7 +1597,7 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
struct mtd_info *mtd;
|
||||
int err;
|
||||
char *data_str = (char *)data;
|
||||
|
||||
|
||||
yaffs_options options;
|
||||
|
||||
sb->s_magic = YAFFS_MAGIC;
|
||||
@ -1613,14 +1613,14 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
printk(KERN_INFO "yaffs: dev is %d name is \"%s\"\n",
|
||||
sb->s_dev,
|
||||
yaffs_devname(sb, devname_buf));
|
||||
|
||||
|
||||
if(!data_str)
|
||||
data_str = "";
|
||||
|
||||
|
||||
printk(KERN_INFO "yaffs: passed flags \"%s\"\n",data_str);
|
||||
|
||||
|
||||
memset(&options,0,sizeof(options));
|
||||
|
||||
|
||||
if(yaffs_parse_options(&options,data_str)){
|
||||
/* Option parsing failed */
|
||||
return NULL;
|
||||
@ -1674,10 +1674,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
T(YAFFS_TRACE_OS, (" oobsize %d\n", mtd->oobsize));
|
||||
T(YAFFS_TRACE_OS, (" erasesize %d\n", mtd->erasesize));
|
||||
T(YAFFS_TRACE_OS, (" size %d\n", mtd->size));
|
||||
|
||||
|
||||
#ifdef CONFIG_YAFFS_AUTO_YAFFS2
|
||||
|
||||
if (yaffsVersion == 1 &&
|
||||
if (yaffsVersion == 1 &&
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
|
||||
mtd->writesize >= 2048) {
|
||||
#else
|
||||
@ -1685,10 +1685,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
#endif
|
||||
T(YAFFS_TRACE_ALWAYS,("yaffs: auto selecting yaffs2\n"));
|
||||
yaffsVersion = 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Added NCB 26/5/2006 for completeness */
|
||||
if (yaffsVersion == 2 &&
|
||||
if (yaffsVersion == 2 &&
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
|
||||
mtd->writesize == 512) {
|
||||
#else
|
||||
@ -1696,7 +1696,7 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
#endif
|
||||
T(YAFFS_TRACE_ALWAYS,("yaffs: auto selecting yaffs1\n"));
|
||||
yaffsVersion = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1830,10 +1830,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
dev->initialiseNAND = nandmtd_InitialiseNAND;
|
||||
|
||||
dev->putSuperFunc = yaffs_MTDPutSuper;
|
||||
|
||||
|
||||
dev->superBlock = (void *)sb;
|
||||
dev->markSuperBlockDirty = yaffs_MarkSuperBlockDirty;
|
||||
|
||||
|
||||
|
||||
#ifndef CONFIG_YAFFS_DOES_ECC
|
||||
dev->useNANDECC = 1;
|
||||
@ -1845,7 +1845,7 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
|
||||
dev->skipCheckpointRead = options.skip_checkpoint_read;
|
||||
dev->skipCheckpointWrite = options.skip_checkpoint_write;
|
||||
|
||||
|
||||
/* we assume this is protected by lock_kernel() in mount/umount */
|
||||
list_add_tail(&dev->devList, &yaffs_dev_list);
|
||||
|
||||
@ -1858,7 +1858,7 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
T(YAFFS_TRACE_OS,
|
||||
("yaffs_read_super: guts initialised %s\n",
|
||||
(err == YAFFS_OK) ? "OK" : "FAILED"));
|
||||
|
||||
|
||||
/* Release lock before yaffs_get_inode() */
|
||||
yaffs_GrossUnlock(dev);
|
||||
|
||||
@ -2118,7 +2118,7 @@ static int yaffs_proc_write(struct file *file, const char *buf,
|
||||
unsigned rg = 0, mask_bitfield;
|
||||
char *end;
|
||||
char *mask_name;
|
||||
const char *x;
|
||||
const char *x;
|
||||
char substring[MAX_MASK_NAME_LENGTH+1];
|
||||
int i;
|
||||
int done = 0;
|
||||
@ -2146,7 +2146,7 @@ static int yaffs_proc_write(struct file *file, const char *buf,
|
||||
break;
|
||||
}
|
||||
mask_name = NULL;
|
||||
|
||||
|
||||
mask_bitfield = simple_strtoul(buf + pos, &end, 0);
|
||||
if (end > buf + pos) {
|
||||
mask_name = "numeral";
|
||||
@ -2154,12 +2154,12 @@ static int yaffs_proc_write(struct file *file, const char *buf,
|
||||
pos += len;
|
||||
done = 0;
|
||||
} else {
|
||||
for(x = buf + pos, i = 0;
|
||||
for(x = buf + pos, i = 0;
|
||||
(*x == '_' || (*x >='a' && *x <= 'z')) &&
|
||||
i <MAX_MASK_NAME_LENGTH; x++, i++, pos++)
|
||||
substring[i] = *x;
|
||||
substring[i] = '\0';
|
||||
|
||||
|
||||
for (i = 0; mask_flags[i].mask_name != NULL; i++) {
|
||||
if(strcmp(substring,mask_flags[i].mask_name) == 0){
|
||||
mask_name = mask_flags[i].mask_name;
|
||||
@ -2190,9 +2190,9 @@ static int yaffs_proc_write(struct file *file, const char *buf,
|
||||
}
|
||||
|
||||
yaffs_traceMask = rg | YAFFS_TRACE_ALWAYS;
|
||||
|
||||
|
||||
printk("new trace = 0x%08X\n",yaffs_traceMask);
|
||||
|
||||
|
||||
if (rg & YAFFS_TRACE_ALWAYS) {
|
||||
for (i = 0; mask_flags[i].mask_name != NULL; i++) {
|
||||
char flag;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
@ -22,11 +22,11 @@
|
||||
#define YAFFS_OK 1
|
||||
#define YAFFS_FAIL 0
|
||||
|
||||
/* Give us a Y=0x59,
|
||||
* Give us an A=0x41,
|
||||
* Give us an FF=0xFF
|
||||
/* Give us a Y=0x59,
|
||||
* Give us an A=0x41,
|
||||
* Give us an FF=0xFF
|
||||
* Give us an S=0x53
|
||||
* And what have we got...
|
||||
* And what have we got...
|
||||
*/
|
||||
#define YAFFS_MAGIC 0x5941FF53
|
||||
|
||||
@ -102,7 +102,7 @@
|
||||
* The range is limited slightly to help distinguish bad numbers from good.
|
||||
* This also allows us to perhaps in the future use special numbers for
|
||||
* special purposes.
|
||||
* EFFFFF00 allows the allocation of 8 blocks per second (~1Mbytes) for 15 years,
|
||||
* EFFFFF00 allows the allocation of 8 blocks per second (~1Mbytes) for 15 years,
|
||||
* and is a larger number than the lifetime of a 2GB device.
|
||||
*/
|
||||
#define YAFFS_LOWEST_SEQUENCE_NUMBER 0x00001000
|
||||
@ -178,7 +178,7 @@ typedef struct {
|
||||
|
||||
/* The following stuff only has meaning when we read */
|
||||
yaffs_ECCResult eccResult;
|
||||
unsigned blockBad;
|
||||
unsigned blockBad;
|
||||
|
||||
/* YAFFS 1 stuff */
|
||||
unsigned chunkDeleted; /* The chunk is marked deleted */
|
||||
@ -244,29 +244,29 @@ typedef enum {
|
||||
/* This block is empty */
|
||||
|
||||
YAFFS_BLOCK_STATE_ALLOCATING,
|
||||
/* This block is partially allocated.
|
||||
/* This block is partially allocated.
|
||||
* At least one page holds valid data.
|
||||
* This is the one currently being used for page
|
||||
* allocation. Should never be more than one of these
|
||||
*/
|
||||
|
||||
YAFFS_BLOCK_STATE_FULL,
|
||||
YAFFS_BLOCK_STATE_FULL,
|
||||
/* All the pages in this block have been allocated.
|
||||
*/
|
||||
|
||||
YAFFS_BLOCK_STATE_DIRTY,
|
||||
/* All pages have been allocated and deleted.
|
||||
/* All pages have been allocated and deleted.
|
||||
* Erase me, reuse me.
|
||||
*/
|
||||
|
||||
YAFFS_BLOCK_STATE_CHECKPOINT,
|
||||
YAFFS_BLOCK_STATE_CHECKPOINT,
|
||||
/* This block is assigned to holding checkpoint data.
|
||||
*/
|
||||
|
||||
YAFFS_BLOCK_STATE_COLLECTING,
|
||||
YAFFS_BLOCK_STATE_COLLECTING,
|
||||
/* This block is being garbage collected */
|
||||
|
||||
YAFFS_BLOCK_STATE_DEAD
|
||||
YAFFS_BLOCK_STATE_DEAD
|
||||
/* This block has failed and is not in use */
|
||||
} yaffs_BlockState;
|
||||
|
||||
@ -281,7 +281,7 @@ typedef struct {
|
||||
__u32 needsRetiring:1; /* Data has failed on this block, need to get valid data off */
|
||||
/* and retire the block. */
|
||||
__u32 skipErasedCheck: 1; /* If this is set we can skip the erased check on this block */
|
||||
__u32 gcPrioritise: 1; /* An ECC check or blank check has failed on this block.
|
||||
__u32 gcPrioritise: 1; /* An ECC check or blank check has failed on this block.
|
||||
It should be prioritised for GC */
|
||||
__u32 chunkErrorStrikes:3; /* How many times we've had ecc etc failures on this block and tried to reuse it */
|
||||
|
||||
@ -408,7 +408,7 @@ struct yaffs_ObjectStruct {
|
||||
__u8 renameAllowed:1; /* Some objects are not allowed to be renamed. */
|
||||
__u8 unlinkAllowed:1;
|
||||
__u8 dirty:1; /* the object needs to be written to flash */
|
||||
__u8 valid:1; /* When the file system is being loaded up, this
|
||||
__u8 valid:1; /* When the file system is being loaded up, this
|
||||
* object might be created before the data
|
||||
* is available (ie. file data records appear before the header).
|
||||
*/
|
||||
@ -430,11 +430,11 @@ struct yaffs_ObjectStruct {
|
||||
|
||||
/* directory structure stuff */
|
||||
/* also used for linking up the free list */
|
||||
struct yaffs_ObjectStruct *parent;
|
||||
struct yaffs_ObjectStruct *parent;
|
||||
struct list_head siblings;
|
||||
|
||||
/* Where's my object header in NAND? */
|
||||
int chunkId;
|
||||
int chunkId;
|
||||
|
||||
int nDataChunks; /* Number of data chunks attached to the file. */
|
||||
|
||||
@ -490,26 +490,26 @@ typedef struct {
|
||||
} yaffs_ObjectBucket;
|
||||
|
||||
|
||||
/* yaffs_CheckpointObject holds the definition of an object as dumped
|
||||
/* yaffs_CheckpointObject holds the definition of an object as dumped
|
||||
* by checkpointing.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
int structType;
|
||||
__u32 objectId;
|
||||
__u32 objectId;
|
||||
__u32 parentId;
|
||||
int chunkId;
|
||||
|
||||
|
||||
yaffs_ObjectType variantType:3;
|
||||
__u8 deleted:1;
|
||||
__u8 softDeleted:1;
|
||||
__u8 unlinked:1;
|
||||
__u8 fake:1;
|
||||
__u8 deleted:1;
|
||||
__u8 softDeleted:1;
|
||||
__u8 unlinked:1;
|
||||
__u8 fake:1;
|
||||
__u8 renameAllowed:1;
|
||||
__u8 unlinkAllowed:1;
|
||||
__u8 serial;
|
||||
|
||||
int nDataChunks;
|
||||
__u8 serial;
|
||||
|
||||
int nDataChunks;
|
||||
__u32 fileSizeOrEquivalentObjectId;
|
||||
|
||||
}yaffs_CheckpointObject;
|
||||
@ -539,14 +539,14 @@ struct yaffs_DeviceStruct {
|
||||
int endBlock; /* End block we're allowed to use */
|
||||
int nReservedBlocks; /* We want this tuneable so that we can reduce */
|
||||
/* reserved blocks on NOR and RAM. */
|
||||
|
||||
|
||||
|
||||
|
||||
/* Stuff used by the shared space checkpointing mechanism */
|
||||
/* If this value is zero, then this mechanism is disabled */
|
||||
|
||||
|
||||
int nCheckpointReservedBlocks; /* Blocks to reserve for checkpoint data */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int nShortOpCaches; /* If <= 0, then short op caching is disabled, else
|
||||
@ -561,7 +561,7 @@ struct yaffs_DeviceStruct {
|
||||
* On an mtd this holds the mtd pointer.
|
||||
*/
|
||||
void *superBlock;
|
||||
|
||||
|
||||
/* NAND access functions (Must be set before calling YAFFS)*/
|
||||
|
||||
int (*writeChunkToNAND) (struct yaffs_DeviceStruct * dev,
|
||||
@ -587,21 +587,21 @@ struct yaffs_DeviceStruct {
|
||||
#endif
|
||||
|
||||
int isYaffs2;
|
||||
|
||||
/* The removeObjectCallback function must be supplied by OS flavours that
|
||||
|
||||
/* The removeObjectCallback function must be supplied by OS flavours that
|
||||
* need it. The Linux kernel does not use this, but yaffs direct does use
|
||||
* it to implement the faster readdir
|
||||
*/
|
||||
void (*removeObjectCallback)(struct yaffs_ObjectStruct *obj);
|
||||
|
||||
|
||||
/* Callback to mark the superblock dirsty */
|
||||
void (*markSuperBlockDirty)(void * superblock);
|
||||
|
||||
|
||||
int wideTnodesDisabled; /* Set to disable wide tnodes */
|
||||
|
||||
|
||||
|
||||
/* End of stuff that must be set before initialisation. */
|
||||
|
||||
|
||||
/* Checkpoint control. Can be set before or after initialisation */
|
||||
__u8 skipCheckpointRead;
|
||||
__u8 skipCheckpointWrite;
|
||||
@ -610,34 +610,34 @@ struct yaffs_DeviceStruct {
|
||||
|
||||
__u16 chunkGroupBits; /* 0 for devices <= 32MB. else log2(nchunks) - 16 */
|
||||
__u16 chunkGroupSize; /* == 2^^chunkGroupBits */
|
||||
|
||||
|
||||
/* Stuff to support wide tnodes */
|
||||
__u32 tnodeWidth;
|
||||
__u32 tnodeMask;
|
||||
|
||||
|
||||
/* Stuff to support various file offses to chunk/offset translations */
|
||||
/* "Crumbs" for nDataBytesPerChunk not being a power of 2 */
|
||||
__u32 crumbMask;
|
||||
__u32 crumbShift;
|
||||
__u32 crumbsPerChunk;
|
||||
|
||||
|
||||
/* Straight shifting for nDataBytesPerChunk being a power of 2 */
|
||||
__u32 chunkShift;
|
||||
__u32 chunkMask;
|
||||
|
||||
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
struct semaphore sem; /* Semaphore for waiting on erasure.*/
|
||||
struct semaphore grossLock; /* Gross locking semaphore */
|
||||
__u8 *spareBuffer; /* For mtdif2 use. Don't know the size of the buffer
|
||||
__u8 *spareBuffer; /* For mtdif2 use. Don't know the size of the buffer
|
||||
* at compile time so we have to allocate it.
|
||||
*/
|
||||
void (*putSuperFunc) (struct super_block * sb);
|
||||
#endif
|
||||
|
||||
int isMounted;
|
||||
|
||||
|
||||
int isCheckpointed;
|
||||
|
||||
|
||||
@ -646,7 +646,7 @@ struct yaffs_DeviceStruct {
|
||||
int internalEndBlock;
|
||||
int blockOffset;
|
||||
int chunkOffset;
|
||||
|
||||
|
||||
|
||||
/* Runtime checkpointing stuff */
|
||||
int checkpointPageSequence; /* running sequence number of checkpoint pages */
|
||||
@ -662,13 +662,13 @@ struct yaffs_DeviceStruct {
|
||||
int checkpointMaxBlocks;
|
||||
__u32 checkpointSum;
|
||||
__u32 checkpointXor;
|
||||
|
||||
|
||||
/* Block Info */
|
||||
yaffs_BlockInfo *blockInfo;
|
||||
__u8 *chunkBits; /* bitmap of chunks in use */
|
||||
unsigned blockInfoAlt:1; /* was allocated using alternative strategy */
|
||||
unsigned chunkBitsAlt:1; /* was allocated using alternative strategy */
|
||||
int chunkBitmapStride; /* Number of bytes of chunkBits per block.
|
||||
int chunkBitmapStride; /* Number of bytes of chunkBits per block.
|
||||
* Must be consistent with nChunksPerBlock.
|
||||
*/
|
||||
|
||||
@ -716,7 +716,7 @@ struct yaffs_DeviceStruct {
|
||||
int tagsEccUnfixed;
|
||||
int nDeletions;
|
||||
int nUnmarkedDeletions;
|
||||
|
||||
|
||||
int hasPendingPrioritisedGCs; /* We think this device might have pending prioritised gcs */
|
||||
|
||||
/* Special directories */
|
||||
@ -727,7 +727,7 @@ struct yaffs_DeviceStruct {
|
||||
* __u8 bufferedData[YAFFS_CHUNKS_PER_BLOCK][YAFFS_BYTES_PER_CHUNK];
|
||||
* yaffs_Spare bufferedSpare[YAFFS_CHUNKS_PER_BLOCK];
|
||||
*/
|
||||
|
||||
|
||||
int bufferedBlock; /* Which block is buffered here? */
|
||||
int doingBufferedBlockRewrite;
|
||||
|
||||
@ -768,7 +768,7 @@ typedef struct {
|
||||
int endBlock;
|
||||
int rfu[100];
|
||||
} yaffs_SuperBlockHeader;
|
||||
|
||||
|
||||
/* The CheckpointDevice structure holds the device information that changes at runtime and
|
||||
* must be preserved over unmount/mount cycles.
|
||||
*/
|
||||
|
@ -172,7 +172,7 @@ int nandmtd_ReadChunkFromNAND(yaffs_Device * dev, int chunkInNAND, __u8 * data,
|
||||
__u8 *spareAsBytes = (__u8 *) spare;
|
||||
|
||||
if (data && spare) {
|
||||
if (dev->useNANDECC) {
|
||||
if (dev->useNANDECC) {
|
||||
/* Careful, this call adds 2 ints */
|
||||
/* to the end of the spare data. Calling function */
|
||||
/* should allocate enough memory for spare, */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -30,9 +30,9 @@ Message-Id: <200705181006.49860.ian@brightstareng.com>
|
||||
X-Virus-Scanned: by amavisd-new at brightstareng.com
|
||||
Status: R
|
||||
X-Status: NT
|
||||
X-KMail-EncryptionState:
|
||||
X-KMail-SignatureState:
|
||||
X-KMail-MDN-Sent:
|
||||
X-KMail-EncryptionState:
|
||||
X-KMail-SignatureState:
|
||||
X-KMail-MDN-Sent:
|
||||
|
||||
--Boundary-00=_5LbTGmt62YoutxM
|
||||
Content-Type: text/plain;
|
||||
@ -49,9 +49,9 @@ On Friday 18 May 2007 08:34, you wrote:
|
||||
|
||||
Good news!
|
||||
|
||||
Attached is a newer yaffs_mtdif1.c with a bandaid to help the
|
||||
Attached is a newer yaffs_mtdif1.c with a bandaid to help the
|
||||
2.6.18 and 2.6.19 versions of MTD not trip on the oob read.
|
||||
See the LINUX_VERSION_CODE conditional in
|
||||
See the LINUX_VERSION_CODE conditional in
|
||||
nandmtd1_ReadChunkWithTagsFromNAND.
|
||||
|
||||
-imcd
|
||||
@ -361,7 +361,7 @@ int nandmtd1_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
|
||||
}
|
||||
|
||||
/* Check any MTD prerequists.
|
||||
*
|
||||
*
|
||||
* Returns YAFFS_OK or YAFFS_FAIL.
|
||||
*/
|
||||
static int nandmtd1_TestPrerequists(struct mtd_info * mtd)
|
||||
|
@ -295,7 +295,7 @@ int nandmtd1_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
|
||||
}
|
||||
|
||||
/* Check any MTD prerequists.
|
||||
*
|
||||
*
|
||||
* Returns YAFFS_OK or YAFFS_FAIL.
|
||||
*/
|
||||
static int nandmtd1_TestPrerequists(struct mtd_info * mtd)
|
||||
|
@ -158,7 +158,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
|
||||
|
||||
if (tags)
|
||||
yaffs_UnpackTags2(tags, &pt);
|
||||
|
||||
|
||||
if(tags && retval == -EBADMSG && tags->eccResult == YAFFS_ECC_RESULT_NO_ERROR)
|
||||
tags->eccResult = YAFFS_ECC_RESULT_UNFIXED;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -10,7 +10,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
|
||||
const char *yaffs_nand_c_version =
|
||||
"$Id: yaffs_nand.c,v 1.7 2007-02-14 01:09:06 wookey Exp $";
|
||||
|
||||
@ -25,9 +25,9 @@ int yaffs_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
|
||||
{
|
||||
int result;
|
||||
yaffs_ExtendedTags localTags;
|
||||
|
||||
|
||||
int realignedChunkInNAND = chunkInNAND - dev->chunkOffset;
|
||||
|
||||
|
||||
/* If there are no tags provided, use local tags to get prioritised gc working */
|
||||
if(!tags)
|
||||
tags = &localTags;
|
||||
@ -39,14 +39,14 @@ int yaffs_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
|
||||
result = yaffs_TagsCompatabilityReadChunkWithTagsFromNAND(dev,
|
||||
realignedChunkInNAND,
|
||||
buffer,
|
||||
tags);
|
||||
if(tags &&
|
||||
tags);
|
||||
if(tags &&
|
||||
tags->eccResult > YAFFS_ECC_RESULT_NO_ERROR){
|
||||
|
||||
|
||||
yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, chunkInNAND/dev->nChunksPerBlock);
|
||||
yaffs_HandleChunkError(dev,bi);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ int yaffs_WriteChunkWithTagsToNAND(yaffs_Device * dev,
|
||||
{
|
||||
chunkInNAND -= dev->chunkOffset;
|
||||
|
||||
|
||||
|
||||
if (tags) {
|
||||
tags->sequenceNumber = dev->sequenceNumber;
|
||||
tags->chunkUsed = 1;
|
||||
@ -131,4 +131,4 @@ int yaffs_InitialiseNAND(struct yaffs_DeviceStruct *dev)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -128,10 +128,10 @@ void yaffs_UnpackTags2(yaffs_ExtendedTags * t, yaffs_PackedTags2 * pt)
|
||||
(yaffs_PackedTags2TagsPart),
|
||||
&pt->ecc, &ecc);
|
||||
switch(result){
|
||||
case 0:
|
||||
t->eccResult = YAFFS_ECC_RESULT_NO_ERROR;
|
||||
case 0:
|
||||
t->eccResult = YAFFS_ECC_RESULT_NO_ERROR;
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
t->eccResult = YAFFS_ECC_RESULT_FIXED;
|
||||
break;
|
||||
case -1:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -50,7 +50,7 @@
|
||||
static __inline void
|
||||
swapfunc(char *a, char *b, int n, int swaptype)
|
||||
{
|
||||
if (swaptype <= 1)
|
||||
if (swaptype <= 1)
|
||||
swapcode(long, a, b, n)
|
||||
else
|
||||
swapcode(char, a, b, n)
|
||||
@ -137,7 +137,7 @@ loop: SWAPINIT(a, es);
|
||||
}
|
||||
if (swap_cnt == 0) { /* Switch to insertion sort */
|
||||
for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
|
||||
for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
|
||||
for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
|
||||
pl -= es)
|
||||
swap(pl, pl - es);
|
||||
return;
|
||||
@ -150,7 +150,7 @@ loop: SWAPINIT(a, es);
|
||||
vecswap(pb, pn - r, r);
|
||||
if ((r = pb - pa) > es)
|
||||
yaffs_qsort(a, r / es, es, cmp);
|
||||
if ((r = pd - pc) > es) {
|
||||
if ((r = pd - pc) > es) {
|
||||
/* Iterate rather than recurse to save stack space */
|
||||
a = pn - r;
|
||||
n = r / es;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
@ -150,7 +150,7 @@ extern unsigned int yaffs_wr_attempts;
|
||||
* Tracing flags.
|
||||
* The flags masked in YAFFS_TRACE_ALWAYS are always traced.
|
||||
*/
|
||||
|
||||
|
||||
#define YAFFS_TRACE_OS 0x00000002
|
||||
#define YAFFS_TRACE_ALLOCATE 0x00000004
|
||||
#define YAFFS_TRACE_SCAN 0x00000008
|
||||
|
@ -26,7 +26,7 @@ config YAFFS_YAFFS1
|
||||
default y
|
||||
help
|
||||
Enable YAFFS1 support -- yaffs for 512 byte / page devices
|
||||
|
||||
|
||||
Not needed for 2K-page devices.
|
||||
|
||||
If unsure, say Y.
|
||||
@ -157,9 +157,9 @@ config YAFFS_ALWAYS_CHECK_CHUNK_ERASED
|
||||
Enabling this forces on the test that chunks are erased in flash
|
||||
before writing to them. This takes more time but is potentially
|
||||
a bit more secure.
|
||||
|
||||
|
||||
Suggest setting Y during development and ironing out driver
|
||||
issues etc. Suggest setting to N if you want faster writing.
|
||||
issues etc. Suggest setting to N if you want faster writing.
|
||||
|
||||
If unsure, say Y.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
/*
|
||||
* This file is just holds extra declarations used during development.
|
||||
* Most of these are from kernel includes placed here so we can use them in
|
||||
* Most of these are from kernel includes placed here so we can use them in
|
||||
* applications.
|
||||
*
|
||||
*/
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
*
|
||||
* Created by Martin Fouts <Martin.Fouts@palmsource.com>
|
||||
* Created by Martin Fouts <Martin.Fouts@palmsource.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1 as
|
||||
|
@ -22,27 +22,27 @@ static int yaffs_CheckpointSpaceOk(yaffs_Device *dev)
|
||||
{
|
||||
|
||||
int blocksAvailable = dev->nErasedBlocks - dev->nReservedBlocks;
|
||||
|
||||
|
||||
T(YAFFS_TRACE_CHECKPOINT,
|
||||
(TSTR("checkpt blocks available = %d" TENDSTR),
|
||||
blocksAvailable));
|
||||
|
||||
|
||||
|
||||
|
||||
return (blocksAvailable <= 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
static int yaffs_CheckpointErase(yaffs_Device *dev)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
if(!dev->eraseBlockInNAND)
|
||||
int i;
|
||||
|
||||
|
||||
if(!dev->eraseBlockInNAND)
|
||||
return 0;
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("checking blocks %d to %d"TENDSTR),
|
||||
dev->internalStartBlock,dev->internalEndBlock));
|
||||
|
||||
|
||||
for(i = dev->internalStartBlock; i <= dev->internalEndBlock; i++) {
|
||||
yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev,i);
|
||||
if(bi->blockState == YAFFS_BLOCK_STATE_CHECKPOINT){
|
||||
@ -58,9 +58,9 @@ static int yaffs_CheckpointErase(yaffs_Device *dev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dev->blocksInCheckpoint = 0;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -72,11 +72,11 @@ static void yaffs_CheckpointFindNextErasedBlock(yaffs_Device *dev)
|
||||
T(YAFFS_TRACE_CHECKPOINT,
|
||||
(TSTR("allocating checkpt block: erased %d reserved %d avail %d next %d "TENDSTR),
|
||||
dev->nErasedBlocks,dev->nReservedBlocks,blocksAvailable,dev->checkpointNextBlock));
|
||||
|
||||
|
||||
if(dev->checkpointNextBlock >= 0 &&
|
||||
dev->checkpointNextBlock <= dev->internalEndBlock &&
|
||||
blocksAvailable > 0){
|
||||
|
||||
|
||||
for(i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++){
|
||||
yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev,i);
|
||||
if(bi->blockState == YAFFS_BLOCK_STATE_EMPTY){
|
||||
@ -88,7 +88,7 @@ static void yaffs_CheckpointFindNextErasedBlock(yaffs_Device *dev)
|
||||
}
|
||||
}
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("out of checkpt blocks"TENDSTR)));
|
||||
|
||||
|
||||
dev->checkpointNextBlock = -1;
|
||||
dev->checkpointCurrentBlock = -1;
|
||||
}
|
||||
@ -97,19 +97,19 @@ static void yaffs_CheckpointFindNextCheckpointBlock(yaffs_Device *dev)
|
||||
{
|
||||
int i;
|
||||
yaffs_ExtendedTags tags;
|
||||
|
||||
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("find next checkpt block: start: blocks %d next %d" TENDSTR),
|
||||
dev->blocksInCheckpoint, dev->checkpointNextBlock));
|
||||
|
||||
if(dev->blocksInCheckpoint < dev->checkpointMaxBlocks)
|
||||
|
||||
if(dev->blocksInCheckpoint < dev->checkpointMaxBlocks)
|
||||
for(i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++){
|
||||
int chunk = i * dev->nChunksPerBlock;
|
||||
int realignedChunk = chunk - dev->chunkOffset;
|
||||
|
||||
dev->readChunkWithTagsFromNAND(dev,realignedChunk,NULL,&tags);
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("find next checkpt block: search: block %d oid %d seq %d eccr %d" TENDSTR),
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("find next checkpt block: search: block %d oid %d seq %d eccr %d" TENDSTR),
|
||||
i, tags.objectId,tags.sequenceNumber,tags.eccResult));
|
||||
|
||||
|
||||
if(tags.sequenceNumber == YAFFS_SEQUENCE_CHECKPOINT_DATA){
|
||||
/* Right kind of block */
|
||||
dev->checkpointNextBlock = tags.objectId;
|
||||
@ -130,7 +130,7 @@ static void yaffs_CheckpointFindNextCheckpointBlock(yaffs_Device *dev)
|
||||
|
||||
int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting)
|
||||
{
|
||||
|
||||
|
||||
/* Got the functions we need? */
|
||||
if (!dev->writeChunkWithTagsToNAND ||
|
||||
!dev->readChunkWithTagsFromNAND ||
|
||||
@ -140,31 +140,31 @@ int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting)
|
||||
|
||||
if(forWriting && !yaffs_CheckpointSpaceOk(dev))
|
||||
return 0;
|
||||
|
||||
|
||||
if(!dev->checkpointBuffer)
|
||||
dev->checkpointBuffer = YMALLOC_DMA(dev->nDataBytesPerChunk);
|
||||
if(!dev->checkpointBuffer)
|
||||
return 0;
|
||||
|
||||
|
||||
|
||||
dev->checkpointPageSequence = 0;
|
||||
|
||||
|
||||
dev->checkpointOpenForWrite = forWriting;
|
||||
|
||||
|
||||
dev->checkpointByteCount = 0;
|
||||
dev->checkpointSum = 0;
|
||||
dev->checkpointXor = 0;
|
||||
dev->checkpointCurrentBlock = -1;
|
||||
dev->checkpointCurrentChunk = -1;
|
||||
dev->checkpointNextBlock = dev->internalStartBlock;
|
||||
|
||||
|
||||
/* Erase all the blocks in the checkpoint area */
|
||||
if(forWriting){
|
||||
memset(dev->checkpointBuffer,0,dev->nDataBytesPerChunk);
|
||||
dev->checkpointByteOffset = 0;
|
||||
return yaffs_CheckpointErase(dev);
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
int i;
|
||||
/* Set to a value that will kick off a read */
|
||||
@ -177,7 +177,7 @@ int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting)
|
||||
for(i = 0; i < dev->checkpointMaxBlocks; i++)
|
||||
dev->checkpointBlockList[i] = -1;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -196,15 +196,15 @@ static int yaffs_CheckpointFlushBuffer(yaffs_Device *dev)
|
||||
int realignedChunk;
|
||||
|
||||
yaffs_ExtendedTags tags;
|
||||
|
||||
|
||||
if(dev->checkpointCurrentBlock < 0){
|
||||
yaffs_CheckpointFindNextErasedBlock(dev);
|
||||
dev->checkpointCurrentChunk = 0;
|
||||
}
|
||||
|
||||
|
||||
if(dev->checkpointCurrentBlock < 0)
|
||||
return 0;
|
||||
|
||||
|
||||
tags.chunkDeleted = 0;
|
||||
tags.objectId = dev->checkpointNextBlock; /* Hint to next place to look */
|
||||
tags.chunkId = dev->checkpointPageSequence + 1;
|
||||
@ -217,25 +217,25 @@ static int yaffs_CheckpointFlushBuffer(yaffs_Device *dev)
|
||||
bi->blockState = YAFFS_BLOCK_STATE_CHECKPOINT;
|
||||
dev->blocksInCheckpoint++;
|
||||
}
|
||||
|
||||
|
||||
chunk = dev->checkpointCurrentBlock * dev->nChunksPerBlock + dev->checkpointCurrentChunk;
|
||||
|
||||
|
||||
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("checkpoint wite buffer nand %d(%d:%d) objid %d chId %d" TENDSTR),
|
||||
chunk, dev->checkpointCurrentBlock, dev->checkpointCurrentChunk,tags.objectId,tags.chunkId));
|
||||
|
||||
chunk, dev->checkpointCurrentBlock, dev->checkpointCurrentChunk,tags.objectId,tags.chunkId));
|
||||
|
||||
realignedChunk = chunk - dev->chunkOffset;
|
||||
|
||||
|
||||
dev->writeChunkWithTagsToNAND(dev,realignedChunk,dev->checkpointBuffer,&tags);
|
||||
dev->checkpointByteOffset = 0;
|
||||
dev->checkpointPageSequence++;
|
||||
dev->checkpointPageSequence++;
|
||||
dev->checkpointCurrentChunk++;
|
||||
if(dev->checkpointCurrentChunk >= dev->nChunksPerBlock){
|
||||
dev->checkpointCurrentChunk = 0;
|
||||
dev->checkpointCurrentBlock = -1;
|
||||
}
|
||||
memset(dev->checkpointBuffer,0,dev->nDataBytesPerChunk);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -245,37 +245,37 @@ int yaffs_CheckpointWrite(yaffs_Device *dev,const void *data, int nBytes)
|
||||
int i=0;
|
||||
int ok = 1;
|
||||
|
||||
|
||||
|
||||
__u8 * dataBytes = (__u8 *)data;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(!dev->checkpointBuffer)
|
||||
return 0;
|
||||
|
||||
|
||||
if(!dev->checkpointOpenForWrite)
|
||||
return -1;
|
||||
|
||||
while(i < nBytes && ok) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dev->checkpointBuffer[dev->checkpointByteOffset] = *dataBytes ;
|
||||
dev->checkpointSum += *dataBytes;
|
||||
dev->checkpointXor ^= *dataBytes;
|
||||
|
||||
|
||||
dev->checkpointByteOffset++;
|
||||
i++;
|
||||
dataBytes++;
|
||||
dev->checkpointByteCount++;
|
||||
|
||||
|
||||
|
||||
|
||||
if(dev->checkpointByteOffset < 0 ||
|
||||
dev->checkpointByteOffset >= dev->nDataBytesPerChunk)
|
||||
dev->checkpointByteOffset >= dev->nDataBytesPerChunk)
|
||||
ok = yaffs_CheckpointFlushBuffer(dev);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -285,12 +285,12 @@ int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
|
||||
int ok = 1;
|
||||
yaffs_ExtendedTags tags;
|
||||
|
||||
|
||||
|
||||
int chunk;
|
||||
int realignedChunk;
|
||||
|
||||
__u8 *dataBytes = (__u8 *)data;
|
||||
|
||||
|
||||
if(!dev->checkpointBuffer)
|
||||
return 0;
|
||||
|
||||
@ -298,31 +298,31 @@ int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
|
||||
return -1;
|
||||
|
||||
while(i < nBytes && ok) {
|
||||
|
||||
|
||||
|
||||
|
||||
if(dev->checkpointByteOffset < 0 ||
|
||||
dev->checkpointByteOffset >= dev->nDataBytesPerChunk) {
|
||||
|
||||
|
||||
if(dev->checkpointCurrentBlock < 0){
|
||||
yaffs_CheckpointFindNextCheckpointBlock(dev);
|
||||
dev->checkpointCurrentChunk = 0;
|
||||
}
|
||||
|
||||
|
||||
if(dev->checkpointCurrentBlock < 0)
|
||||
ok = 0;
|
||||
else {
|
||||
|
||||
chunk = dev->checkpointCurrentBlock * dev->nChunksPerBlock +
|
||||
|
||||
chunk = dev->checkpointCurrentBlock * dev->nChunksPerBlock +
|
||||
dev->checkpointCurrentChunk;
|
||||
|
||||
realignedChunk = chunk - dev->chunkOffset;
|
||||
|
||||
/* read in the next chunk */
|
||||
/* printf("read checkpoint page %d\n",dev->checkpointPage); */
|
||||
dev->readChunkWithTagsFromNAND(dev, realignedChunk,
|
||||
dev->readChunkWithTagsFromNAND(dev, realignedChunk,
|
||||
dev->checkpointBuffer,
|
||||
&tags);
|
||||
|
||||
|
||||
if(tags.chunkId != (dev->checkpointPageSequence + 1) ||
|
||||
tags.sequenceNumber != YAFFS_SEQUENCE_CHECKPOINT_DATA)
|
||||
ok = 0;
|
||||
@ -330,12 +330,12 @@ int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
|
||||
dev->checkpointByteOffset = 0;
|
||||
dev->checkpointPageSequence++;
|
||||
dev->checkpointCurrentChunk++;
|
||||
|
||||
|
||||
if(dev->checkpointCurrentChunk >= dev->nChunksPerBlock)
|
||||
dev->checkpointCurrentBlock = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ok){
|
||||
*dataBytes = dev->checkpointBuffer[dev->checkpointByteOffset];
|
||||
dev->checkpointSum += *dataBytes;
|
||||
@ -346,14 +346,14 @@ int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
|
||||
dev->checkpointByteCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int yaffs_CheckpointClose(yaffs_Device *dev)
|
||||
{
|
||||
|
||||
if(dev->checkpointOpenForWrite){
|
||||
if(dev->checkpointOpenForWrite){
|
||||
if(dev->checkpointByteOffset != 0)
|
||||
yaffs_CheckpointFlushBuffer(dev);
|
||||
} else {
|
||||
@ -373,19 +373,19 @@ int yaffs_CheckpointClose(yaffs_Device *dev)
|
||||
dev->nFreeChunks -= dev->blocksInCheckpoint * dev->nChunksPerBlock;
|
||||
dev->nErasedBlocks -= dev->blocksInCheckpoint;
|
||||
|
||||
|
||||
|
||||
T(YAFFS_TRACE_CHECKPOINT,(TSTR("checkpoint byte count %d" TENDSTR),
|
||||
dev->checkpointByteCount));
|
||||
|
||||
|
||||
if(dev->checkpointBuffer){
|
||||
/* free the buffer */
|
||||
/* free the buffer */
|
||||
YFREE(dev->checkpointBuffer);
|
||||
dev->checkpointBuffer = NULL;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int yaffs_CheckpointInvalidateStream(yaffs_Device *dev)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -14,9 +14,9 @@
|
||||
/*
|
||||
* This code implements the ECC algorithm used in SmartMedia.
|
||||
*
|
||||
* The ECC comprises 22 bits of parity information and is stuffed into 3 bytes.
|
||||
* The ECC comprises 22 bits of parity information and is stuffed into 3 bytes.
|
||||
* The two unused bit are set to 1.
|
||||
* The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC
|
||||
* The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC
|
||||
* blocks are used on a 512-byte NAND page.
|
||||
*
|
||||
*/
|
||||
@ -228,8 +228,8 @@ int yaffs_ECCCorrect(unsigned char *data, unsigned char *read_ecc,
|
||||
return 1; /* Corrected the error */
|
||||
}
|
||||
|
||||
if ((yaffs_CountBits(d0) +
|
||||
yaffs_CountBits(d1) +
|
||||
if ((yaffs_CountBits(d0) +
|
||||
yaffs_CountBits(d1) +
|
||||
yaffs_CountBits(d2)) == 1) {
|
||||
/* Reccoverable error in ecc */
|
||||
|
||||
@ -239,7 +239,7 @@ int yaffs_ECCCorrect(unsigned char *data, unsigned char *read_ecc,
|
||||
|
||||
return 1; /* Corrected the error */
|
||||
}
|
||||
|
||||
|
||||
/* Unrecoverable error */
|
||||
|
||||
return -1;
|
||||
@ -293,7 +293,7 @@ int yaffs_ECCCorrectOther(unsigned char *data, unsigned nBytes,
|
||||
if ((cDelta | lDelta | lDeltaPrime) == 0)
|
||||
return 0; /* no error */
|
||||
|
||||
if (lDelta == ~lDeltaPrime &&
|
||||
if (lDelta == ~lDeltaPrime &&
|
||||
(((cDelta ^ (cDelta >> 1)) & 0x15) == 0x15))
|
||||
{
|
||||
/* Single bit (recoverable) error in data */
|
||||
@ -309,7 +309,7 @@ int yaffs_ECCCorrectOther(unsigned char *data, unsigned nBytes,
|
||||
|
||||
if(lDelta >= nBytes)
|
||||
return -1;
|
||||
|
||||
|
||||
data[lDelta] ^= (1 << bit);
|
||||
|
||||
return 1; /* corrected */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
@ -16,9 +16,9 @@
|
||||
/*
|
||||
* This code implements the ECC algorithm used in SmartMedia.
|
||||
*
|
||||
* The ECC comprises 22 bits of parity information and is stuffed into 3 bytes.
|
||||
* The ECC comprises 22 bits of parity information and is stuffed into 3 bytes.
|
||||
* The two unused bit are set to 1.
|
||||
* The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC
|
||||
* The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC
|
||||
* blocks are used on a 512-byte NAND page.
|
||||
*
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@
|
||||
* This is the file system front-end to YAFFS that hooks it up to
|
||||
* the VFS.
|
||||
*
|
||||
* Special notes:
|
||||
* Special notes:
|
||||
* >> 2.4: sb->u.generic_sbp points to the yaffs_Device associated with
|
||||
* this superblock
|
||||
* >> 2.6: sb->s_fs_info points to the yaffs_Device associated with this
|
||||
@ -391,7 +391,7 @@ static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry)
|
||||
dentry->d_name.name);
|
||||
|
||||
obj = yaffs_GetEquivalentObject(obj); /* in case it was a hardlink */
|
||||
|
||||
|
||||
/* Can't hold gross lock when calling yaffs_get_inode() */
|
||||
yaffs_GrossUnlock(dev);
|
||||
|
||||
@ -729,21 +729,21 @@ static void yaffs_FillInodeFromObject(struct inode *inode, yaffs_Object * obj)
|
||||
obj->yst_mode &= ~S_IFMT;
|
||||
obj->yst_mode |= S_IFREG;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case YAFFS_OBJECT_TYPE_SYMLINK :
|
||||
if( ! S_ISLNK(mode) ){
|
||||
obj->yst_mode &= ~S_IFMT;
|
||||
obj->yst_mode |= S_IFLNK;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case YAFFS_OBJECT_TYPE_DIRECTORY :
|
||||
if( ! S_ISDIR(mode) ){
|
||||
obj->yst_mode &= ~S_IFMT;
|
||||
obj->yst_mode |= S_IFDIR;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case YAFFS_OBJECT_TYPE_UNKNOWN :
|
||||
case YAFFS_OBJECT_TYPE_HARDLINK :
|
||||
@ -1020,7 +1020,7 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
|
||||
int error = -ENOSPC;
|
||||
uid_t uid = current->fsuid;
|
||||
gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
|
||||
|
||||
|
||||
if((dir->i_mode & S_ISGID) && S_ISDIR(mode))
|
||||
mode |= S_ISGID;
|
||||
|
||||
@ -1075,7 +1075,7 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
|
||||
obj = NULL; /* Do we ever get here? */
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Can not call yaffs_get_inode() with gross lock held */
|
||||
yaffs_GrossUnlock(dev);
|
||||
|
||||
@ -1264,13 +1264,13 @@ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
target =
|
||||
yaffs_FindObjectByName(yaffs_InodeToObject(new_dir),
|
||||
new_dentry->d_name.name);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (target &&
|
||||
target->variantType == YAFFS_OBJECT_TYPE_DIRECTORY &&
|
||||
!list_empty(&target->variant.directoryVariant.children)) {
|
||||
|
||||
|
||||
T(YAFFS_TRACE_OS, (KERN_DEBUG "target is non-empty dir\n"));
|
||||
|
||||
retVal = YAFFS_FAIL;
|
||||
@ -1278,7 +1278,7 @@ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
|
||||
/* Now does unlinking internally using shadowing mechanism */
|
||||
T(YAFFS_TRACE_OS, (KERN_DEBUG "calling yaffs_RenameObject\n"));
|
||||
|
||||
|
||||
retVal =
|
||||
yaffs_RenameObject(yaffs_InodeToObject(old_dir),
|
||||
old_dentry->d_name.name,
|
||||
@ -1390,7 +1390,7 @@ static int yaffs_do_sync_fs(struct super_block *sb)
|
||||
|
||||
if(dev)
|
||||
yaffs_CheckpointSave(dev);
|
||||
|
||||
|
||||
yaffs_GrossUnlock(dev);
|
||||
|
||||
sb->s_dirt = 0;
|
||||
@ -1421,16 +1421,16 @@ static int yaffs_sync_fs(struct super_block *sb)
|
||||
{
|
||||
|
||||
T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_sync_fs\n"));
|
||||
|
||||
|
||||
return 0; /* yaffs_do_sync_fs(sb);*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void yaffs_read_inode(struct inode *inode)
|
||||
{
|
||||
/* NB This is called as a side effect of other functions, but
|
||||
* we had to release the lock to prevent deadlocks, so
|
||||
* we had to release the lock to prevent deadlocks, so
|
||||
* need to lock again.
|
||||
*/
|
||||
|
||||
@ -1441,7 +1441,7 @@ static void yaffs_read_inode(struct inode *inode)
|
||||
(KERN_DEBUG "yaffs_read_inode for %d\n", (int)inode->i_ino));
|
||||
|
||||
yaffs_GrossLock(dev);
|
||||
|
||||
|
||||
obj = yaffs_FindObjectByNumber(dev, inode->i_ino);
|
||||
|
||||
yaffs_FillInodeFromObject(inode, obj);
|
||||
@ -1458,26 +1458,26 @@ static int yaffs_remount_fs(struct super_block *sb, int *flags, char *data)
|
||||
|
||||
if( *flags & MS_RDONLY ) {
|
||||
struct mtd_info *mtd = yaffs_SuperToDevice(sb)->genericDevice;
|
||||
|
||||
|
||||
T(YAFFS_TRACE_OS,
|
||||
(KERN_DEBUG "yaffs_remount_fs: %s: RO\n", dev->name ));
|
||||
|
||||
yaffs_GrossLock(dev);
|
||||
|
||||
|
||||
yaffs_FlushEntireDeviceCache(dev);
|
||||
|
||||
|
||||
yaffs_CheckpointSave(dev);
|
||||
|
||||
|
||||
if (mtd->sync)
|
||||
mtd->sync(mtd);
|
||||
|
||||
yaffs_GrossUnlock(dev);
|
||||
}
|
||||
else {
|
||||
T(YAFFS_TRACE_OS,
|
||||
T(YAFFS_TRACE_OS,
|
||||
(KERN_DEBUG "yaffs_remount_fs: %s: RW\n", dev->name ));
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -1489,7 +1489,7 @@ static void yaffs_put_super(struct super_block *sb)
|
||||
T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_put_super\n"));
|
||||
|
||||
yaffs_GrossLock(dev);
|
||||
|
||||
|
||||
yaffs_FlushEntireDeviceCache(dev);
|
||||
|
||||
yaffs_CheckpointSave(dev);
|
||||
@ -1499,12 +1499,12 @@ static void yaffs_put_super(struct super_block *sb)
|
||||
}
|
||||
|
||||
yaffs_Deinitialise(dev);
|
||||
|
||||
|
||||
yaffs_GrossUnlock(dev);
|
||||
|
||||
/* we assume this is protected by lock_kernel() in mount/umount */
|
||||
list_del(&dev->devList);
|
||||
|
||||
|
||||
if(dev->spareBuffer){
|
||||
YFREE(dev->spareBuffer);
|
||||
dev->spareBuffer = NULL;
|
||||
@ -1530,7 +1530,7 @@ static void yaffs_MTDPutSuper(struct super_block *sb)
|
||||
static void yaffs_MarkSuperBlockDirty(void *vsb)
|
||||
{
|
||||
struct super_block *sb = (struct super_block *)vsb;
|
||||
|
||||
|
||||
T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_MarkSuperBlockDirty() sb = %p\n",sb));
|
||||
// if(sb)
|
||||
// sb->s_dirt = 1;
|
||||
@ -1549,13 +1549,13 @@ static int yaffs_parse_options(yaffs_options *options, const char *options_str)
|
||||
char cur_opt[MAX_OPT_LEN+1];
|
||||
int p;
|
||||
int error = 0;
|
||||
|
||||
|
||||
/* Parse through the options which is a comma seperated list */
|
||||
|
||||
|
||||
while(options_str && *options_str && !error){
|
||||
memset(cur_opt,0,MAX_OPT_LEN+1);
|
||||
p = 0;
|
||||
|
||||
|
||||
while(*options_str && *options_str != ','){
|
||||
if(p < MAX_OPT_LEN){
|
||||
cur_opt[p] = *options_str;
|
||||
@ -1563,7 +1563,7 @@ static int yaffs_parse_options(yaffs_options *options, const char *options_str)
|
||||
}
|
||||
options_str++;
|
||||
}
|
||||
|
||||
|
||||
if(!strcmp(cur_opt,"inband-tags"))
|
||||
options->inband_tags = 1;
|
||||
else if(!strcmp(cur_opt,"no-cache"))
|
||||
@ -1579,7 +1579,7 @@ static int yaffs_parse_options(yaffs_options *options, const char *options_str)
|
||||
printk(KERN_INFO "yaffs: Bad mount option \"%s\"\n",cur_opt);
|
||||
error = 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return error;
|
||||
@ -1597,7 +1597,7 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
struct mtd_info *mtd;
|
||||
int err;
|
||||
char *data_str = (char *)data;
|
||||
|
||||
|
||||
yaffs_options options;
|
||||
|
||||
sb->s_magic = YAFFS_MAGIC;
|
||||
@ -1613,14 +1613,14 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
printk(KERN_INFO "yaffs: dev is %d name is \"%s\"\n",
|
||||
sb->s_dev,
|
||||
yaffs_devname(sb, devname_buf));
|
||||
|
||||
|
||||
if(!data_str)
|
||||
data_str = "";
|
||||
|
||||
|
||||
printk(KERN_INFO "yaffs: passed flags \"%s\"\n",data_str);
|
||||
|
||||
|
||||
memset(&options,0,sizeof(options));
|
||||
|
||||
|
||||
if(yaffs_parse_options(&options,data_str)){
|
||||
/* Option parsing failed */
|
||||
return NULL;
|
||||
@ -1674,10 +1674,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
T(YAFFS_TRACE_OS, (" oobsize %d\n", mtd->oobsize));
|
||||
T(YAFFS_TRACE_OS, (" erasesize %d\n", mtd->erasesize));
|
||||
T(YAFFS_TRACE_OS, (" size %d\n", mtd->size));
|
||||
|
||||
|
||||
#ifdef CONFIG_YAFFS_AUTO_YAFFS2
|
||||
|
||||
if (yaffsVersion == 1 &&
|
||||
if (yaffsVersion == 1 &&
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
|
||||
mtd->writesize >= 2048) {
|
||||
#else
|
||||
@ -1685,10 +1685,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
#endif
|
||||
T(YAFFS_TRACE_ALWAYS,("yaffs: auto selecting yaffs2\n"));
|
||||
yaffsVersion = 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Added NCB 26/5/2006 for completeness */
|
||||
if (yaffsVersion == 2 &&
|
||||
if (yaffsVersion == 2 &&
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
|
||||
mtd->writesize == 512) {
|
||||
#else
|
||||
@ -1696,7 +1696,7 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
#endif
|
||||
T(YAFFS_TRACE_ALWAYS,("yaffs: auto selecting yaffs1\n"));
|
||||
yaffsVersion = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1830,10 +1830,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
dev->initialiseNAND = nandmtd_InitialiseNAND;
|
||||
|
||||
dev->putSuperFunc = yaffs_MTDPutSuper;
|
||||
|
||||
|
||||
dev->superBlock = (void *)sb;
|
||||
dev->markSuperBlockDirty = yaffs_MarkSuperBlockDirty;
|
||||
|
||||
|
||||
|
||||
#ifndef CONFIG_YAFFS_DOES_ECC
|
||||
dev->useNANDECC = 1;
|
||||
@ -1845,7 +1845,7 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
|
||||
dev->skipCheckpointRead = options.skip_checkpoint_read;
|
||||
dev->skipCheckpointWrite = options.skip_checkpoint_write;
|
||||
|
||||
|
||||
/* we assume this is protected by lock_kernel() in mount/umount */
|
||||
list_add_tail(&dev->devList, &yaffs_dev_list);
|
||||
|
||||
@ -1858,7 +1858,7 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
|
||||
T(YAFFS_TRACE_OS,
|
||||
("yaffs_read_super: guts initialised %s\n",
|
||||
(err == YAFFS_OK) ? "OK" : "FAILED"));
|
||||
|
||||
|
||||
/* Release lock before yaffs_get_inode() */
|
||||
yaffs_GrossUnlock(dev);
|
||||
|
||||
@ -2118,7 +2118,7 @@ static int yaffs_proc_write(struct file *file, const char *buf,
|
||||
unsigned rg = 0, mask_bitfield;
|
||||
char *end;
|
||||
char *mask_name;
|
||||
const char *x;
|
||||
const char *x;
|
||||
char substring[MAX_MASK_NAME_LENGTH+1];
|
||||
int i;
|
||||
int done = 0;
|
||||
@ -2146,7 +2146,7 @@ static int yaffs_proc_write(struct file *file, const char *buf,
|
||||
break;
|
||||
}
|
||||
mask_name = NULL;
|
||||
|
||||
|
||||
mask_bitfield = simple_strtoul(buf + pos, &end, 0);
|
||||
if (end > buf + pos) {
|
||||
mask_name = "numeral";
|
||||
@ -2154,12 +2154,12 @@ static int yaffs_proc_write(struct file *file, const char *buf,
|
||||
pos += len;
|
||||
done = 0;
|
||||
} else {
|
||||
for(x = buf + pos, i = 0;
|
||||
for(x = buf + pos, i = 0;
|
||||
(*x == '_' || (*x >='a' && *x <= 'z')) &&
|
||||
i <MAX_MASK_NAME_LENGTH; x++, i++, pos++)
|
||||
substring[i] = *x;
|
||||
substring[i] = '\0';
|
||||
|
||||
|
||||
for (i = 0; mask_flags[i].mask_name != NULL; i++) {
|
||||
if(strcmp(substring,mask_flags[i].mask_name) == 0){
|
||||
mask_name = mask_flags[i].mask_name;
|
||||
@ -2190,9 +2190,9 @@ static int yaffs_proc_write(struct file *file, const char *buf,
|
||||
}
|
||||
|
||||
yaffs_traceMask = rg | YAFFS_TRACE_ALWAYS;
|
||||
|
||||
|
||||
printk("new trace = 0x%08X\n",yaffs_traceMask);
|
||||
|
||||
|
||||
if (rg & YAFFS_TRACE_ALWAYS) {
|
||||
for (i = 0; mask_flags[i].mask_name != NULL; i++) {
|
||||
char flag;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
@ -22,11 +22,11 @@
|
||||
#define YAFFS_OK 1
|
||||
#define YAFFS_FAIL 0
|
||||
|
||||
/* Give us a Y=0x59,
|
||||
* Give us an A=0x41,
|
||||
* Give us an FF=0xFF
|
||||
/* Give us a Y=0x59,
|
||||
* Give us an A=0x41,
|
||||
* Give us an FF=0xFF
|
||||
* Give us an S=0x53
|
||||
* And what have we got...
|
||||
* And what have we got...
|
||||
*/
|
||||
#define YAFFS_MAGIC 0x5941FF53
|
||||
|
||||
@ -102,7 +102,7 @@
|
||||
* The range is limited slightly to help distinguish bad numbers from good.
|
||||
* This also allows us to perhaps in the future use special numbers for
|
||||
* special purposes.
|
||||
* EFFFFF00 allows the allocation of 8 blocks per second (~1Mbytes) for 15 years,
|
||||
* EFFFFF00 allows the allocation of 8 blocks per second (~1Mbytes) for 15 years,
|
||||
* and is a larger number than the lifetime of a 2GB device.
|
||||
*/
|
||||
#define YAFFS_LOWEST_SEQUENCE_NUMBER 0x00001000
|
||||
@ -178,7 +178,7 @@ typedef struct {
|
||||
|
||||
/* The following stuff only has meaning when we read */
|
||||
yaffs_ECCResult eccResult;
|
||||
unsigned blockBad;
|
||||
unsigned blockBad;
|
||||
|
||||
/* YAFFS 1 stuff */
|
||||
unsigned chunkDeleted; /* The chunk is marked deleted */
|
||||
@ -244,29 +244,29 @@ typedef enum {
|
||||
/* This block is empty */
|
||||
|
||||
YAFFS_BLOCK_STATE_ALLOCATING,
|
||||
/* This block is partially allocated.
|
||||
/* This block is partially allocated.
|
||||
* At least one page holds valid data.
|
||||
* This is the one currently being used for page
|
||||
* allocation. Should never be more than one of these
|
||||
*/
|
||||
|
||||
YAFFS_BLOCK_STATE_FULL,
|
||||
YAFFS_BLOCK_STATE_FULL,
|
||||
/* All the pages in this block have been allocated.
|
||||
*/
|
||||
|
||||
YAFFS_BLOCK_STATE_DIRTY,
|
||||
/* All pages have been allocated and deleted.
|
||||
/* All pages have been allocated and deleted.
|
||||
* Erase me, reuse me.
|
||||
*/
|
||||
|
||||
YAFFS_BLOCK_STATE_CHECKPOINT,
|
||||
YAFFS_BLOCK_STATE_CHECKPOINT,
|
||||
/* This block is assigned to holding checkpoint data.
|
||||
*/
|
||||
|
||||
YAFFS_BLOCK_STATE_COLLECTING,
|
||||
YAFFS_BLOCK_STATE_COLLECTING,
|
||||
/* This block is being garbage collected */
|
||||
|
||||
YAFFS_BLOCK_STATE_DEAD
|
||||
YAFFS_BLOCK_STATE_DEAD
|
||||
/* This block has failed and is not in use */
|
||||
} yaffs_BlockState;
|
||||
|
||||
@ -281,7 +281,7 @@ typedef struct {
|
||||
__u32 needsRetiring:1; /* Data has failed on this block, need to get valid data off */
|
||||
/* and retire the block. */
|
||||
__u32 skipErasedCheck: 1; /* If this is set we can skip the erased check on this block */
|
||||
__u32 gcPrioritise: 1; /* An ECC check or blank check has failed on this block.
|
||||
__u32 gcPrioritise: 1; /* An ECC check or blank check has failed on this block.
|
||||
It should be prioritised for GC */
|
||||
__u32 chunkErrorStrikes:3; /* How many times we've had ecc etc failures on this block and tried to reuse it */
|
||||
|
||||
@ -408,7 +408,7 @@ struct yaffs_ObjectStruct {
|
||||
__u8 renameAllowed:1; /* Some objects are not allowed to be renamed. */
|
||||
__u8 unlinkAllowed:1;
|
||||
__u8 dirty:1; /* the object needs to be written to flash */
|
||||
__u8 valid:1; /* When the file system is being loaded up, this
|
||||
__u8 valid:1; /* When the file system is being loaded up, this
|
||||
* object might be created before the data
|
||||
* is available (ie. file data records appear before the header).
|
||||
*/
|
||||
@ -430,11 +430,11 @@ struct yaffs_ObjectStruct {
|
||||
|
||||
/* directory structure stuff */
|
||||
/* also used for linking up the free list */
|
||||
struct yaffs_ObjectStruct *parent;
|
||||
struct yaffs_ObjectStruct *parent;
|
||||
struct list_head siblings;
|
||||
|
||||
/* Where's my object header in NAND? */
|
||||
int chunkId;
|
||||
int chunkId;
|
||||
|
||||
int nDataChunks; /* Number of data chunks attached to the file. */
|
||||
|
||||
@ -490,26 +490,26 @@ typedef struct {
|
||||
} yaffs_ObjectBucket;
|
||||
|
||||
|
||||
/* yaffs_CheckpointObject holds the definition of an object as dumped
|
||||
/* yaffs_CheckpointObject holds the definition of an object as dumped
|
||||
* by checkpointing.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
int structType;
|
||||
__u32 objectId;
|
||||
__u32 objectId;
|
||||
__u32 parentId;
|
||||
int chunkId;
|
||||
|
||||
|
||||
yaffs_ObjectType variantType:3;
|
||||
__u8 deleted:1;
|
||||
__u8 softDeleted:1;
|
||||
__u8 unlinked:1;
|
||||
__u8 fake:1;
|
||||
__u8 deleted:1;
|
||||
__u8 softDeleted:1;
|
||||
__u8 unlinked:1;
|
||||
__u8 fake:1;
|
||||
__u8 renameAllowed:1;
|
||||
__u8 unlinkAllowed:1;
|
||||
__u8 serial;
|
||||
|
||||
int nDataChunks;
|
||||
__u8 serial;
|
||||
|
||||
int nDataChunks;
|
||||
__u32 fileSizeOrEquivalentObjectId;
|
||||
|
||||
}yaffs_CheckpointObject;
|
||||
@ -539,14 +539,14 @@ struct yaffs_DeviceStruct {
|
||||
int endBlock; /* End block we're allowed to use */
|
||||
int nReservedBlocks; /* We want this tuneable so that we can reduce */
|
||||
/* reserved blocks on NOR and RAM. */
|
||||
|
||||
|
||||
|
||||
|
||||
/* Stuff used by the shared space checkpointing mechanism */
|
||||
/* If this value is zero, then this mechanism is disabled */
|
||||
|
||||
|
||||
int nCheckpointReservedBlocks; /* Blocks to reserve for checkpoint data */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int nShortOpCaches; /* If <= 0, then short op caching is disabled, else
|
||||
@ -561,7 +561,7 @@ struct yaffs_DeviceStruct {
|
||||
* On an mtd this holds the mtd pointer.
|
||||
*/
|
||||
void *superBlock;
|
||||
|
||||
|
||||
/* NAND access functions (Must be set before calling YAFFS)*/
|
||||
|
||||
int (*writeChunkToNAND) (struct yaffs_DeviceStruct * dev,
|
||||
@ -587,21 +587,21 @@ struct yaffs_DeviceStruct {
|
||||
#endif
|
||||
|
||||
int isYaffs2;
|
||||
|
||||
/* The removeObjectCallback function must be supplied by OS flavours that
|
||||
|
||||
/* The removeObjectCallback function must be supplied by OS flavours that
|
||||
* need it. The Linux kernel does not use this, but yaffs direct does use
|
||||
* it to implement the faster readdir
|
||||
*/
|
||||
void (*removeObjectCallback)(struct yaffs_ObjectStruct *obj);
|
||||
|
||||
|
||||
/* Callback to mark the superblock dirsty */
|
||||
void (*markSuperBlockDirty)(void * superblock);
|
||||
|
||||
|
||||
int wideTnodesDisabled; /* Set to disable wide tnodes */
|
||||
|
||||
|
||||
|
||||
/* End of stuff that must be set before initialisation. */
|
||||
|
||||
|
||||
/* Checkpoint control. Can be set before or after initialisation */
|
||||
__u8 skipCheckpointRead;
|
||||
__u8 skipCheckpointWrite;
|
||||
@ -610,34 +610,34 @@ struct yaffs_DeviceStruct {
|
||||
|
||||
__u16 chunkGroupBits; /* 0 for devices <= 32MB. else log2(nchunks) - 16 */
|
||||
__u16 chunkGroupSize; /* == 2^^chunkGroupBits */
|
||||
|
||||
|
||||
/* Stuff to support wide tnodes */
|
||||
__u32 tnodeWidth;
|
||||
__u32 tnodeMask;
|
||||
|
||||
|
||||
/* Stuff to support various file offses to chunk/offset translations */
|
||||
/* "Crumbs" for nDataBytesPerChunk not being a power of 2 */
|
||||
__u32 crumbMask;
|
||||
__u32 crumbShift;
|
||||
__u32 crumbsPerChunk;
|
||||
|
||||
|
||||
/* Straight shifting for nDataBytesPerChunk being a power of 2 */
|
||||
__u32 chunkShift;
|
||||
__u32 chunkMask;
|
||||
|
||||
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
struct semaphore sem; /* Semaphore for waiting on erasure.*/
|
||||
struct semaphore grossLock; /* Gross locking semaphore */
|
||||
__u8 *spareBuffer; /* For mtdif2 use. Don't know the size of the buffer
|
||||
__u8 *spareBuffer; /* For mtdif2 use. Don't know the size of the buffer
|
||||
* at compile time so we have to allocate it.
|
||||
*/
|
||||
void (*putSuperFunc) (struct super_block * sb);
|
||||
#endif
|
||||
|
||||
int isMounted;
|
||||
|
||||
|
||||
int isCheckpointed;
|
||||
|
||||
|
||||
@ -646,7 +646,7 @@ struct yaffs_DeviceStruct {
|
||||
int internalEndBlock;
|
||||
int blockOffset;
|
||||
int chunkOffset;
|
||||
|
||||
|
||||
|
||||
/* Runtime checkpointing stuff */
|
||||
int checkpointPageSequence; /* running sequence number of checkpoint pages */
|
||||
@ -662,13 +662,13 @@ struct yaffs_DeviceStruct {
|
||||
int checkpointMaxBlocks;
|
||||
__u32 checkpointSum;
|
||||
__u32 checkpointXor;
|
||||
|
||||
|
||||
/* Block Info */
|
||||
yaffs_BlockInfo *blockInfo;
|
||||
__u8 *chunkBits; /* bitmap of chunks in use */
|
||||
unsigned blockInfoAlt:1; /* was allocated using alternative strategy */
|
||||
unsigned chunkBitsAlt:1; /* was allocated using alternative strategy */
|
||||
int chunkBitmapStride; /* Number of bytes of chunkBits per block.
|
||||
int chunkBitmapStride; /* Number of bytes of chunkBits per block.
|
||||
* Must be consistent with nChunksPerBlock.
|
||||
*/
|
||||
|
||||
@ -716,7 +716,7 @@ struct yaffs_DeviceStruct {
|
||||
int tagsEccUnfixed;
|
||||
int nDeletions;
|
||||
int nUnmarkedDeletions;
|
||||
|
||||
|
||||
int hasPendingPrioritisedGCs; /* We think this device might have pending prioritised gcs */
|
||||
|
||||
/* Special directories */
|
||||
@ -727,7 +727,7 @@ struct yaffs_DeviceStruct {
|
||||
* __u8 bufferedData[YAFFS_CHUNKS_PER_BLOCK][YAFFS_BYTES_PER_CHUNK];
|
||||
* yaffs_Spare bufferedSpare[YAFFS_CHUNKS_PER_BLOCK];
|
||||
*/
|
||||
|
||||
|
||||
int bufferedBlock; /* Which block is buffered here? */
|
||||
int doingBufferedBlockRewrite;
|
||||
|
||||
@ -768,7 +768,7 @@ typedef struct {
|
||||
int endBlock;
|
||||
int rfu[100];
|
||||
} yaffs_SuperBlockHeader;
|
||||
|
||||
|
||||
/* The CheckpointDevice structure holds the device information that changes at runtime and
|
||||
* must be preserved over unmount/mount cycles.
|
||||
*/
|
||||
|
@ -172,7 +172,7 @@ int nandmtd_ReadChunkFromNAND(yaffs_Device * dev, int chunkInNAND, __u8 * data,
|
||||
__u8 *spareAsBytes = (__u8 *) spare;
|
||||
|
||||
if (data && spare) {
|
||||
if (dev->useNANDECC) {
|
||||
if (dev->useNANDECC) {
|
||||
/* Careful, this call adds 2 ints */
|
||||
/* to the end of the spare data. Calling function */
|
||||
/* should allocate enough memory for spare, */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -30,9 +30,9 @@ Message-Id: <200705181006.49860.ian@brightstareng.com>
|
||||
X-Virus-Scanned: by amavisd-new at brightstareng.com
|
||||
Status: R
|
||||
X-Status: NT
|
||||
X-KMail-EncryptionState:
|
||||
X-KMail-SignatureState:
|
||||
X-KMail-MDN-Sent:
|
||||
X-KMail-EncryptionState:
|
||||
X-KMail-SignatureState:
|
||||
X-KMail-MDN-Sent:
|
||||
|
||||
--Boundary-00=_5LbTGmt62YoutxM
|
||||
Content-Type: text/plain;
|
||||
@ -49,9 +49,9 @@ On Friday 18 May 2007 08:34, you wrote:
|
||||
|
||||
Good news!
|
||||
|
||||
Attached is a newer yaffs_mtdif1.c with a bandaid to help the
|
||||
Attached is a newer yaffs_mtdif1.c with a bandaid to help the
|
||||
2.6.18 and 2.6.19 versions of MTD not trip on the oob read.
|
||||
See the LINUX_VERSION_CODE conditional in
|
||||
See the LINUX_VERSION_CODE conditional in
|
||||
nandmtd1_ReadChunkWithTagsFromNAND.
|
||||
|
||||
-imcd
|
||||
@ -361,7 +361,7 @@ int nandmtd1_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
|
||||
}
|
||||
|
||||
/* Check any MTD prerequists.
|
||||
*
|
||||
*
|
||||
* Returns YAFFS_OK or YAFFS_FAIL.
|
||||
*/
|
||||
static int nandmtd1_TestPrerequists(struct mtd_info * mtd)
|
||||
|
@ -295,7 +295,7 @@ int nandmtd1_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
|
||||
}
|
||||
|
||||
/* Check any MTD prerequists.
|
||||
*
|
||||
*
|
||||
* Returns YAFFS_OK or YAFFS_FAIL.
|
||||
*/
|
||||
static int nandmtd1_TestPrerequists(struct mtd_info * mtd)
|
||||
|
@ -158,7 +158,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
|
||||
|
||||
if (tags)
|
||||
yaffs_UnpackTags2(tags, &pt);
|
||||
|
||||
|
||||
if(tags && retval == -EBADMSG && tags->eccResult == YAFFS_ECC_RESULT_NO_ERROR)
|
||||
tags->eccResult = YAFFS_ECC_RESULT_UNFIXED;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -10,7 +10,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
|
||||
const char *yaffs_nand_c_version =
|
||||
"$Id: yaffs_nand.c,v 1.7 2007-02-14 01:09:06 wookey Exp $";
|
||||
|
||||
@ -25,9 +25,9 @@ int yaffs_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
|
||||
{
|
||||
int result;
|
||||
yaffs_ExtendedTags localTags;
|
||||
|
||||
|
||||
int realignedChunkInNAND = chunkInNAND - dev->chunkOffset;
|
||||
|
||||
|
||||
/* If there are no tags provided, use local tags to get prioritised gc working */
|
||||
if(!tags)
|
||||
tags = &localTags;
|
||||
@ -39,14 +39,14 @@ int yaffs_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
|
||||
result = yaffs_TagsCompatabilityReadChunkWithTagsFromNAND(dev,
|
||||
realignedChunkInNAND,
|
||||
buffer,
|
||||
tags);
|
||||
if(tags &&
|
||||
tags);
|
||||
if(tags &&
|
||||
tags->eccResult > YAFFS_ECC_RESULT_NO_ERROR){
|
||||
|
||||
|
||||
yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, chunkInNAND/dev->nChunksPerBlock);
|
||||
yaffs_HandleChunkError(dev,bi);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ int yaffs_WriteChunkWithTagsToNAND(yaffs_Device * dev,
|
||||
{
|
||||
chunkInNAND -= dev->chunkOffset;
|
||||
|
||||
|
||||
|
||||
if (tags) {
|
||||
tags->sequenceNumber = dev->sequenceNumber;
|
||||
tags->chunkUsed = 1;
|
||||
@ -131,4 +131,4 @@ int yaffs_InitialiseNAND(struct yaffs_DeviceStruct *dev)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -128,10 +128,10 @@ void yaffs_UnpackTags2(yaffs_ExtendedTags * t, yaffs_PackedTags2 * pt)
|
||||
(yaffs_PackedTags2TagsPart),
|
||||
&pt->ecc, &ecc);
|
||||
switch(result){
|
||||
case 0:
|
||||
t->eccResult = YAFFS_ECC_RESULT_NO_ERROR;
|
||||
case 0:
|
||||
t->eccResult = YAFFS_ECC_RESULT_NO_ERROR;
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
t->eccResult = YAFFS_ECC_RESULT_FIXED;
|
||||
break;
|
||||
case -1:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -50,7 +50,7 @@
|
||||
static __inline void
|
||||
swapfunc(char *a, char *b, int n, int swaptype)
|
||||
{
|
||||
if (swaptype <= 1)
|
||||
if (swaptype <= 1)
|
||||
swapcode(long, a, b, n)
|
||||
else
|
||||
swapcode(char, a, b, n)
|
||||
@ -137,7 +137,7 @@ loop: SWAPINIT(a, es);
|
||||
}
|
||||
if (swap_cnt == 0) { /* Switch to insertion sort */
|
||||
for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
|
||||
for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
|
||||
for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
|
||||
pl -= es)
|
||||
swap(pl, pl - es);
|
||||
return;
|
||||
@ -150,7 +150,7 @@ loop: SWAPINIT(a, es);
|
||||
vecswap(pb, pn - r, r);
|
||||
if ((r = pb - pa) > es)
|
||||
yaffs_qsort(a, r / es, es, cmp);
|
||||
if ((r = pd - pc) > es) {
|
||||
if ((r = pd - pc) > es) {
|
||||
/* Iterate rather than recurse to save stack space */
|
||||
a = pn - r;
|
||||
n = r / es;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
* YAFFS: Yet another Flash File System . A NAND-flash specific file system.
|
||||
*
|
||||
* Copyright (C) 2002-2007 Aleph One Ltd.
|
||||
* for Toby Churchill Ltd and Brightstar Engineering
|
||||
@ -150,7 +150,7 @@ extern unsigned int yaffs_wr_attempts;
|
||||
* Tracing flags.
|
||||
* The flags masked in YAFFS_TRACE_ALWAYS are always traced.
|
||||
*/
|
||||
|
||||
|
||||
#define YAFFS_TRACE_OS 0x00000002
|
||||
#define YAFFS_TRACE_ALLOCATE 0x00000004
|
||||
#define YAFFS_TRACE_SCAN 0x00000008
|
||||
|
Loading…
Reference in New Issue
Block a user