Check in inband tags, some extra yaffs direct functions and some other changes
[yaffs2.git] / yaffs_guts.h
index cf89ef5cd40819cbed6e79b57e4f4cb428256c69..b9b2ea19481f3237509b4ad8419cc8a45bf2cf4d 100644 (file)
@@ -90,7 +90,7 @@
 
 #define YAFFS_MAX_SHORT_OP_CACHES      20
 
-#define YAFFS_N_TEMP_BUFFERS           4
+#define YAFFS_N_TEMP_BUFFERS           6
 
 /* We limit the number attempts at sucessfully saving a chunk of data.
  * Small-page devices have 32 pages per block; large-page devices have 64.
@@ -331,11 +331,14 @@ typedef struct {
        __u32 win_ctime[2];
        __u32 win_atime[2];
        __u32 win_mtime[2];
-       __u32 roomToGrow[4];
 #else
-       __u32 roomToGrow[10];
+       __u32 roomToGrow[6];
+
 #endif
+       __u32 inbandShadowsObject;
+       __u32 inbandIsShrink;
 
+       __u32 reservedSpace[2];
        int shadowsObject;      /* This object header shadows the specified object if > 0 */
 
        /* isShrink applies to object headers written when we shrink the file (ie resize) */
@@ -381,7 +384,7 @@ typedef struct {
 } yaffs_FileStructure;
 
 typedef struct {
-       struct list_head children;      /* list of child links */
+       struct ylist_head children;     /* list of child links */
 } yaffs_DirectoryStructure;
 
 typedef struct {
@@ -424,14 +427,14 @@ struct yaffs_ObjectStruct {
 
        struct yaffs_DeviceStruct *myDev;       /* The device I'm on */
 
-       struct list_head hashLink;      /* list of objects in this hash bucket */
+       struct ylist_head hashLink;     /* list of objects in this hash bucket */
 
-       struct list_head hardLinks;     /* all the equivalent hard linked objects */
+       struct ylist_head hardLinks;    /* all the equivalent hard linked objects */
 
        /* directory structure stuff */
        /* also used for linking up the free list */
        struct yaffs_ObjectStruct *parent;
-       struct list_head siblings;
+       struct ylist_head siblings;
 
        /* Where's my object header in NAND? */
        int chunkId;
@@ -485,7 +488,7 @@ struct yaffs_ObjectList_struct {
 typedef struct yaffs_ObjectList_struct yaffs_ObjectList;
 
 typedef struct {
-       struct list_head list;
+       struct ylist_head list;
        int count;
 } yaffs_ObjectBucket;
 
@@ -528,7 +531,7 @@ typedef struct {
 /*----------------- Device ---------------------------------*/
 
 struct yaffs_DeviceStruct {
-       struct list_head devList;
+       struct ylist_head devList;
        const char *name;
 
        /* Entry parameters set up way early. Yaffs sets up the rest.*/
@@ -583,7 +586,7 @@ struct yaffs_DeviceStruct {
                                          yaffs_ExtendedTags * tags);
        int (*markNANDBlockBad) (struct yaffs_DeviceStruct * dev, int blockNo);
        int (*queryNANDBlock) (struct yaffs_DeviceStruct * dev, int blockNo,
-                              yaffs_BlockState * state, int *sequenceNumber);
+                              yaffs_BlockState * state, __u32 *sequenceNumber);
 #endif
 
        int isYaffs2;
@@ -598,7 +601,8 @@ struct yaffs_DeviceStruct {
        void (*markSuperBlockDirty)(void * superblock);
 
        int wideTnodesDisabled; /* Set to disable wide tnodes */
-
+       
+       YCHAR *pathDividers;    /* String of legal path dividers */
 
        /* End of stuff that must be set before initialisation. */
 
@@ -615,16 +619,14 @@ struct yaffs_DeviceStruct {
        __u32 tnodeWidth;
        __u32 tnodeMask;
 
-       /* Stuff to support various file offses to chunk/offset translations */
-       /* "Crumbs" for nDataBytesPerChunk not being a power of 2 */
-       __u32 crumbMask;
-       __u32 crumbShift;
-       __u32 crumbsPerChunk;
-
-       /* Straight shifting for nDataBytesPerChunk being a power of 2 */
-       __u32 chunkShift;
-       __u32 chunkMask;
+       /* Stuff for figuring out file offset to chunk conversions */
+       __u32 chunkShift; /* Shift value */
+       __u32 chunkDiv;   /* Divisor after shifting: 1 for power-of-2 sizes */
+       __u32 chunkMask;  /* Mask to use for power-of-2 case */
 
+       /* Stuff to handle inband tags */
+       int inbandTags;
+       __u32 totalBytesPerChunk;
 
 #ifdef __KERNEL__
 
@@ -746,9 +748,11 @@ struct yaffs_DeviceStruct {
        int nUnlinkedFiles;             /* Count of unlinked files. */
        int nBackgroundDeletions;       /* Count of background deletions. */
 
-
+       
+       /* Temporary buffer management */
        yaffs_TempBuffer tempBuffer[YAFFS_N_TEMP_BUFFERS];
        int maxTemp;
+       int tempInUse;
        int unmanagedTempAllocations;
        int unmanagedTempDeallocations;
 
@@ -799,18 +803,6 @@ typedef struct {
     __u32 head;
 } yaffs_CheckpointValidity;
 
-/* Function to manipulate block info */
-static Y_INLINE yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device * dev, int blk)
-{
-       if (blk < dev->internalStartBlock || blk > dev->internalEndBlock) {
-               T(YAFFS_TRACE_ERROR,
-                 (TSTR
-                  ("**>> yaffs: getBlockInfo block %d is not valid" TENDSTR),
-                  blk));
-               YBUG();
-       }
-       return &dev->blockInfo[blk - dev->internalStartBlock];
-}
 
 /*----------------------- YAFFS Functions -----------------------*/
 
@@ -901,4 +893,7 @@ void yaffs_DeleteChunk(yaffs_Device * dev, int chunkId, int markNAND, int lyn);
 int yaffs_CheckFF(__u8 * buffer, int nBytes);
 void yaffs_HandleChunkError(yaffs_Device *dev, yaffs_BlockInfo *bi);
 
+__u8 *yaffs_GetTempBuffer(yaffs_Device * dev, int lineNo);
+void yaffs_ReleaseTempBuffer(yaffs_Device * dev, __u8 * buffer, int lineNo);
+
 #endif