Better retirement and erasure checking.
[yaffs2.git] / direct / yaffs_fileem2k.c
index 4c5e200ed9f0c5384efbdb136175b59f4abdd7d2..7e867f61b0d7573cc182f7343977303bbbdc0bd8 100644 (file)
@@ -15,7 +15,7 @@
 // This provides a YAFFS nand emulation on a file for emulating 2kB pages.
 // THis is only intended as test code to test persistence etc.
 
-const char *yaffs_flashif_c_version = "$Id: yaffs_fileem2k.c,v 1.4 2005-07-18 23:12:00 charles Exp $";
+const char *yaffs_flashif_c_version = "$Id: yaffs_fileem2k.c,v 1.5 2006-09-21 08:13:59 charles Exp $";
 
 
 #include "yportenv.h"
@@ -55,6 +55,8 @@ typedef struct
 
 static yflash_Device filedisk;
 
+int yaffs_testPartialWrite = 0;
+
 static int  CheckInit(void)
 {
        static int initialised = 0;
@@ -138,6 +140,11 @@ int yflash_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8
                lseek(filedisk.handle,pos,SEEK_SET);
                written = write(filedisk.handle,data,dev->nBytesPerChunk);
                
+               if(yaffs_testPartialWrite){
+                       close(filedisk.handle);
+                       exit(1);
+               }
+               
                if(written != dev->nBytesPerChunk) return YAFFS_FAIL;
        }