Change inode deletion to prevent issue raised by YBUG
[yaffs2.git] / yaffs_guts.h
index 450672496f0f326971d785065f17c437a4902539..bef284f398f7173243e3a822fa22fb276c4fbda4 100644 (file)
 #define YAFFS_LOWEST_SEQUENCE_NUMBER   0x00001000
 #define YAFFS_HIGHEST_SEQUENCE_NUMBER  0xEFFFFF00
 
+/* Special sequence number for bad block that failed to be marked bad */
+#define YAFFS_SEQUENCE_BAD_BLOCK       0xFFFF0000
+
 /* ChunkCache is used for short read/write operations.*/
 typedef struct {
        struct yaffs_ObjectStruct *object;
@@ -132,12 +135,12 @@ typedef struct {
 
 #ifndef CONFIG_YAFFS_NO_YAFFS1
 typedef struct {
-       unsigned chunkId:20;
-       unsigned serialNumber:2;
-       unsigned byteCount:10;
-       unsigned objectId:18;
-       unsigned ecc:12;
-       unsigned unusedStuff:2;
+        unsigned chunkId:20;
+        unsigned serialNumber:2;
+        unsigned byteCountLSB:10;
+        unsigned objectId:18;
+        unsigned ecc:12;
+        unsigned byteCountMSB:2;
 
 } yaffs_Tags;
 
@@ -420,7 +423,8 @@ struct yaffs_ObjectStruct {
        __u8 deferedFree:1;     /* For Linux kernel. Object is removed from NAND, but is
                                 * still in the inode cache. Free of object is defered.
                                 * until the inode is released.
-                                */
+                                 */
+        __u8 beingCreated:1;   /* This object is still being created so skip some checks. */
 
        __u8 serial;            /* serial number of chunk in NAND. Cached here */
        __u16 sum;              /* sum of the name to speed searching */
@@ -436,8 +440,8 @@ struct yaffs_ObjectStruct {
         struct yaffs_ObjectStruct *parent; 
         struct ylist_head siblings;
 
-        /* Where's my object header in NAND? */
-        int chunkId;            
+       /* Where's my object header in NAND? */
+       int hdrChunk;
 
        int nDataChunks;        /* Number of data chunks attached to the file. */
 
@@ -501,8 +505,7 @@ typedef struct {
         int structType;
        __u32 objectId;         
        __u32 parentId;
-       int chunkId;
-                       
+       int hdrChunk;
        yaffs_ObjectType variantType:3;
        __u8 deleted:1;         
        __u8 softDeleted:1;     
@@ -573,9 +576,10 @@ struct yaffs_DeviceStruct {
        int (*readChunkFromNAND) (struct yaffs_DeviceStruct * dev,
                                  int chunkInNAND, __u8 * data,
                                  yaffs_Spare * spare);
-       int (*eraseBlockInNAND) (struct yaffs_DeviceStruct * dev,
-                                int blockInNAND);
-       int (*initialiseNAND) (struct yaffs_DeviceStruct * dev);
+        int (*eraseBlockInNAND) (struct yaffs_DeviceStruct * dev,
+                                 int blockInNAND);
+        int (*initialiseNAND) (struct yaffs_DeviceStruct * dev);
+        int (*deinitialiseNAND) (struct yaffs_DeviceStruct * dev);
 
 #ifdef CONFIG_YAFFS_YAFFS2
        int (*writeChunkWithTagsToNAND) (struct yaffs_DeviceStruct * dev,
@@ -689,10 +693,14 @@ struct yaffs_DeviceStruct {
        yaffs_TnodeList *allocatedTnodeList;
 
        int isDoingGC;
+       int gcBlock;
+       int gcChunk;
 
        int nObjectsCreated;
        yaffs_Object *freeObjects;
        int nFreeObjects;
+       
+       int nHardLinks;
 
        yaffs_ObjectList *allocatedObjectList;
 
@@ -816,7 +824,7 @@ int yaffs_RenameObject(yaffs_Object * oldDir, const YCHAR * oldName,
                       yaffs_Object * newDir, const YCHAR * newName);
 
 int yaffs_Unlink(yaffs_Object * dir, const YCHAR * name);
-int yaffs_DeleteFile(yaffs_Object * obj);
+int yaffs_DeleteObject(yaffs_Object * obj);
 
 int yaffs_GetObjectName(yaffs_Object * obj, YCHAR * name, int buffSize);
 int yaffs_GetObjectFileLength(yaffs_Object * obj);