X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=yaffs_guts.c;h=bcd3da1082675e008e918e5491a3af772d77af64;hb=8cc260c1954603f2efcd13bca480eed8bd47a7e2;hp=5218aeab3391faef20b9d85dbbf0800f29e0332f;hpb=1ceac6b8722fe56ebe1b29e6e0dfc0664cbdd2c6;p=yaffs%2F.git diff --git a/yaffs_guts.c b/yaffs_guts.c index 5218aea..bcd3da1 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -14,7 +14,7 @@ */ //yaffs_guts.c -const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.30 2003-09-16 06:48:38 charles Exp $"; +const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.34 2004-06-08 08:47:55 charles Exp $"; #include "yportenv.h" @@ -1085,7 +1085,7 @@ static int yaffs_DeleteWorker(yaffs_Object *in, yaffs_Tnode *tn, __u32 level, in if(limit) { *limit = *limit-1; - if(limit <= 0) + if(*limit <= 0) { hitLimit = 1; } @@ -1743,7 +1743,7 @@ yaffs_Object *yaffs_MknodObject( yaffs_ObjectType type, #ifdef CONFIG_YAFFS_WINCE yfsd_WinFileTimeNow(in->win_atime); in->win_ctime[0] = in->win_mtime[0] = in->win_atime[0]; - in->win_ctime[1] = in->win_mtime[1] = in->win_atime[0]; + in->win_ctime[1] = in->win_mtime[1] = in->win_atime[1]; #else #if defined(CONFIG_KERNEL_2_5) @@ -2302,6 +2302,7 @@ static int yaffs_GarbageCollectBlock(yaffs_Device *dev,int block) { // It's a header object->chunkId = newChunk; + object->serial = tags.serialNumber; } else { @@ -2843,6 +2844,7 @@ int yaffs_ReadChunkDataFromObject(yaffs_Object *in,int chunkInInode, __u8 *buffe } else { + memset(buffer,0,YAFFS_BYTES_PER_CHUNK); return 0; } @@ -3668,8 +3670,10 @@ int yaffs_ResizeFile(yaffs_Object *in, int newSize) int lastChunk = 1+ newSize/YAFFS_BYTES_PER_CHUNK; // Got to read and rewrite the last chunk with its new size. + // NB Got to zero pad to nuke old data yaffs_ReadChunkDataFromObject(in,lastChunk,dev->localBuffer); - + memset(dev->localBuffer + sizeOfPartialChunk,0, YAFFS_BYTES_PER_CHUNK - sizeOfPartialChunk); + yaffs_WriteChunkDataToObject(in,lastChunk,dev->localBuffer,sizeOfPartialChunk,1); } @@ -4224,8 +4228,9 @@ static int yaffs_Scan(yaffs_Device *dev) { // Hoosterman, another problem.... // We're trying to use a non-directory as a directory - // Todo ... handle - T(YAFFS_TRACE_ERROR, (TSTR("yaffs tragedy: attempting to use non-directory as a directory in scan" TENDSTR))); + + T(YAFFS_TRACE_ERROR, (TSTR("yaffs tragedy: attempting to use non-directory as a directory in scan. Put in lost+found." TENDSTR))); + parent = dev->lostNFoundDir; } @@ -4839,6 +4844,8 @@ void yaffs_Deinitialise(yaffs_Device *dev) yaffs_DeinitialiseBlocks(dev); yaffs_DeinitialiseTnodes(dev); yaffs_DeinitialiseObjects(dev); + if(dev->nShortOpCaches > 0) + YFREE(dev->srCache); YFREE(dev->localBuffer); }