Add lazy loading
[yaffs2.git] / yaffs_guts.h
index b23447605249dfe593460333df467e1697b10163..b1e9374b1845d94b595ffb242841a19d2e9834ac 100644 (file)
@@ -14,7 +14,7 @@
  *
  * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
  *
  *
  * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
  *
- * $Id: yaffs_guts.h,v 1.13 2005-08-11 02:51:49 charles Exp $
+ * $Id: yaffs_guts.h,v 1.19 2006-03-01 08:15:45 charles Exp $
  */
 
 #ifndef __YAFFS_GUTS_H__
  */
 
 #ifndef __YAFFS_GUTS_H__
@@ -325,7 +325,7 @@ union yaffs_Tnode_union {
 #else
        union yaffs_Tnode_union *internal[YAFFS_NTNODES_INTERNAL];
 #endif
 #else
        union yaffs_Tnode_union *internal[YAFFS_NTNODES_INTERNAL];
 #endif
-       __u16 level0[YAFFS_NTNODES_LEVEL0];
+/*     __u16 level0[YAFFS_NTNODES_LEVEL0]; */
 
 };
 
 
 };
 
@@ -386,15 +386,14 @@ struct yaffs_ObjectStruct {
                                 * object might be created before the data
                                 * is available (ie. file data records appear before the header).
                                 */
                                 * object might be created before the data
                                 * is available (ie. file data records appear before the header).
                                 */
-       __u8 serial;            /* serial number of chunk in NAND. Cached here */
+       __u8 lazyLoaded:1;      /* This object has been lazy loaded and is missing some detail */
 
        __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 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 lazyLoaded;        /* Vital info has been loaded from tags. Not all info available. */
-
+       __u8 serial;            /* serial number of chunk in NAND. Cached here */
        __u16 sum;              /* sum of the name to speed searching */
 
        struct yaffs_DeviceStruct *myDev;       /* The device I'm on */
        __u16 sum;              /* sum of the name to speed searching */
 
        struct yaffs_DeviceStruct *myDev;       /* The device I'm on */
@@ -526,6 +525,15 @@ struct yaffs_DeviceStruct {
 #endif
 
        int isYaffs2;
 #endif
 
        int isYaffs2;
+       
+       /* The removeObjectCallback function must be supplied by OS flavours that 
+        * need it. The Linux kernel does not use this, but yaffs direct does use
+        * it to implement the faster readdir
+        */
+       void (*removeObjectCallback)(struct yaffs_ObjectStruct *obj);
+       
+       int wideTnodesDisabled; /* Set to disable wide tnodes */
+       
 
        /* End of stuff that must be set before initialisation. */
 
 
        /* End of stuff that must be set before initialisation. */
 
@@ -533,6 +541,11 @@ struct yaffs_DeviceStruct {
 
        __u16 chunkGroupBits;   /* 0 for devices <= 32MB. else log2(nchunks) - 16 */
        __u16 chunkGroupSize;   /* == 2^^chunkGroupBits */
 
        __u16 chunkGroupBits;   /* 0 for devices <= 32MB. else log2(nchunks) - 16 */
        __u16 chunkGroupSize;   /* == 2^^chunkGroupBits */
+       
+       /* Stuff to support wide tnodes */
+       __u32 tnodeWidth;
+       __u32 tnodeMask;
+       
 
 #ifdef __KERNEL__
 
 
 #ifdef __KERNEL__
 
@@ -555,6 +568,8 @@ struct yaffs_DeviceStruct {
        /* Block Info */
        yaffs_BlockInfo *blockInfo;
        __u8 *chunkBits;        /* bitmap of chunks in use */
        /* Block Info */
        yaffs_BlockInfo *blockInfo;
        __u8 *chunkBits;        /* bitmap of chunks in use */
+       unsigned blockInfoAlt:1;        /* was allocated using alternative strategy */
+       unsigned chunkBitsAlt:1;        /* was allocated using alternative strategy */
        int chunkBitmapStride;  /* Number of bytes of chunkBits per block. 
                                 * Must be consistent with nChunksPerBlock.
                                 */
        int chunkBitmapStride;  /* Number of bytes of chunkBits per block. 
                                 * Must be consistent with nChunksPerBlock.
                                 */
@@ -732,7 +747,7 @@ int yaffs_DumpObject(yaffs_Object * obj);
 
 void yaffs_GutsTest(yaffs_Device * dev);
 
 
 void yaffs_GutsTest(yaffs_Device * dev);
 
-/* AAAA few useful functions */
+/* A few useful functions */
 void yaffs_InitialiseTags(yaffs_ExtendedTags * tags);
 void yaffs_DeleteChunk(yaffs_Device * dev, int chunkId, int markNAND, int lyn);
 int yaffs_CheckFF(__u8 * buffer, int nBytes);
 void yaffs_InitialiseTags(yaffs_ExtendedTags * tags);
 void yaffs_DeleteChunk(yaffs_Device * dev, int chunkId, int markNAND, int lyn);
 int yaffs_CheckFF(__u8 * buffer, int nBytes);