@ -78,8 +78,6 @@ static int yaffs_UpdateObjectHeader(yaffs_Object * in, const YCHAR * name,
int force , int isShrink , int shadows ) ;
static void yaffs_RemoveObjectFromDirectory ( yaffs_Object * obj ) ;
static int yaffs_CheckStructures ( void ) ;
static int yaffs_DeleteWorker ( yaffs_Object * in , yaffs_Tnode * tn , __u32 level ,
int chunkOffset , int * limit ) ;
static int yaffs_DoGenericObjectDeletion ( yaffs_Object * in ) ;
static yaffs_BlockInfo * yaffs_GetBlockInfo ( yaffs_Device * dev , int blockNo ) ;
@ -595,55 +593,6 @@ static void yaffs_VerifyObjectHeader(yaffs_Object *obj, yaffs_ObjectHeader *oh,
obj - > objectId ) ) ;
}
static int yaffs_VerifyTnodeWorker ( yaffs_Object * obj , yaffs_Tnode * tn ,
__u32 level , int chunkOffset )
{
int i ;
yaffs_Device * dev = obj - > myDev ;
int ok = 1 ;
if ( tn ) {
if ( level > 0 ) {
for ( i = 0 ; i < YAFFS_NTNODES_INTERNAL & & ok ; i + + ) {
if ( tn - > internal [ i ] ) {
ok = yaffs_VerifyTnodeWorker ( obj ,
tn - > internal [ i ] ,
level - 1 ,
( chunkOffset < < YAFFS_TNODES_INTERNAL_BITS ) + i ) ;
}
}
} else if ( level = = 0 ) {
int i ;
yaffs_ExtendedTags tags ;
__u32 objectId = obj - > objectId ;
chunkOffset < < = YAFFS_TNODES_LEVEL0_BITS ;
for ( i = 0 ; i < YAFFS_NTNODES_LEVEL0 ; i + + ) {
__u32 theChunk = yaffs_GetChunkGroupBase ( dev , tn , i ) ;
if ( theChunk > 0 ) {
/* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),tags.objectId,tags.chunkId,theChunk)); */
yaffs_ReadChunkWithTagsFromNAND ( dev , theChunk , NULL , & tags ) ;
if ( tags . objectId ! = objectId | | tags . chunkId ! = chunkOffset ) {
T ( ~ 0 , ( TSTR ( " Object %d chunkId %d NAND mismatch chunk %d tags (%d:%d) " TENDSTR ) ,
objectId , chunkOffset , theChunk ,
tags . objectId , tags . chunkId ) ) ;
}
}
chunkOffset + + ;
}
}
}
return ok ;
}
static void yaffs_VerifyFile ( yaffs_Object * obj )
{
int requiredTallness ;
@ -1546,104 +1495,6 @@ static int yaffs_FindChunkInGroup(yaffs_Device * dev, int theChunk,
return - 1 ;
}
/* DeleteWorker scans backwards through the tnode tree and deletes all the
* chunks and tnodes in the file
* Returns 1 if the tree was deleted .
* Returns 0 if it stopped early due to hitting the limit and the delete is incomplete .
*/
static int yaffs_DeleteWorker ( yaffs_Object * in , yaffs_Tnode * tn , __u32 level ,
int chunkOffset , int * limit )
{
int i ;
int chunkInInode ;
int theChunk ;
yaffs_ExtendedTags tags ;
int foundChunk ;
yaffs_Device * dev = in - > myDev ;
int allDone = 1 ;
if ( tn ) {
if ( level > 0 ) {
for ( i = YAFFS_NTNODES_INTERNAL - 1 ; allDone & & i > = 0 ;
i - - ) {
if ( tn - > internal [ i ] ) {
if ( limit & & ( * limit ) < 0 ) {
allDone = 0 ;
} else {
allDone =
yaffs_DeleteWorker ( in ,
tn - >
internal
[ i ] ,
level -
1 ,
( chunkOffset
< <
YAFFS_TNODES_INTERNAL_BITS )
+ i ,
limit ) ;
}
if ( allDone ) {
yaffs_FreeTnode ( dev ,
tn - >
internal [ i ] ) ;
tn - > internal [ i ] = NULL ;
}
}
}
return ( allDone ) ? 1 : 0 ;
} else if ( level = = 0 ) {
int hitLimit = 0 ;
for ( i = YAFFS_NTNODES_LEVEL0 - 1 ; i > = 0 & & ! hitLimit ;
i - - ) {
theChunk = yaffs_GetChunkGroupBase ( dev , tn , i ) ;
if ( theChunk ) {
chunkInInode =
( chunkOffset < <
YAFFS_TNODES_LEVEL0_BITS ) + i ;
foundChunk =
yaffs_FindChunkInGroup ( dev ,
theChunk ,
& tags ,
in - > objectId ,
chunkInInode ) ;
if ( foundChunk > 0 ) {
yaffs_DeleteChunk ( dev ,
foundChunk , 1 ,
__LINE__ ) ;
in - > nDataChunks - - ;
if ( limit ) {
* limit = * limit - 1 ;
if ( * limit < = 0 ) {
hitLimit = 1 ;
}
}
}
yaffs_PutLevel0Tnode ( dev , tn , i , 0 ) ;
}
}
return ( i < 0 ) ? 1 : 0 ;
}
}
return 1 ;
}
static void yaffs_SoftDeleteChunk ( yaffs_Device * dev , int chunk )
{