X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=inline;f=yaffs_guts.c;h=ad033bd156de32ddea25bb1a3337b80122b691bc;hb=17980527e964732381ef3fe6d1f2946bd9a9cd47;hp=c2b6017c41ff4768605d571460ccedb6ee0707db;hpb=059e96a41fdcd5a2162c281b43047a1656cf53df;p=yaffs2.git diff --git a/yaffs_guts.c b/yaffs_guts.c index c2b6017..ad033bd 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -13,7 +13,7 @@ */ //yaffs_guts.c -const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.12 2005-07-31 06:54:19 charles Exp $"; +const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.15 2005-08-02 04:24:22 charles Exp $"; #include "yportenv.h" @@ -2517,6 +2517,18 @@ static int yaffs_GarbageCollectBlock(yaffs_Device *dev,int block) tags.serialNumber++; dev->nGCCopies++; + + if(tags.chunkId == 0) + { + // It is an object Id, + // We need to nuke the shrinkheader flags first + // We no longer want the shrinkHeader flag since its work is done + // and if it is left in place it will mess up scanning. + + yaffs_ObjectHeader *oh = (yaffs_ObjectHeader *)buffer; + oh->isShrink = 0; + tags.extraIsShrinkHeader = 0; + } newChunk = yaffs_WriteNewChunkWithTagsToNAND(dev, buffer, &tags,1); @@ -5278,7 +5290,8 @@ static int yaffs_ScanBackwards(yaffs_Device *dev) isShrink = 1; } - if(in->variant.fileVariant.shrinkSize > thisSize) + if(isShrink && + in->variant.fileVariant.shrinkSize > thisSize) { in->variant.fileVariant.shrinkSize = thisSize; } @@ -5406,15 +5419,13 @@ static int yaffs_ScanBackwards(yaffs_Device *dev) { in->variant.fileVariant.fileSize = oh->fileSize; in->variant.fileVariant.scannedFileSize = in->variant.fileVariant.fileSize; - } + } - - - if(in->variant.fileVariant.shrinkSize > oh->fileSize) + if(oh->isShrink && + in->variant.fileVariant.shrinkSize > oh->fileSize) { in->variant.fileVariant.shrinkSize = oh->fileSize; - } - + } break; case YAFFS_OBJECT_TYPE_HARDLINK: @@ -5587,6 +5598,10 @@ yaffs_Object *yaffs_FindObjectByName(yaffs_Object *directory,const YCHAR *name) yaffs_Object *l; + if(!name) + { + return NULL; + } if(!directory) {