#define YAFFS_MAX_SHORT_OP_CACHES 20
-#define YAFFS_N_TEMP_BUFFERS 6
+#define YAFFS_N_TEMP_BUFFERS 4
/* 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.
int softDeletions:10; /* number of soft deleted pages */
int pagesInUse:10; /* number of pages in use */
- unsigned blockState:4; /* One of the above block states. NB use unsigned because enum is sometimes an int */
+ yaffs_BlockState blockState:4; /* One of the above block states */
__u32 needsRetiring:1; /* Data has failed on this block, need to get valid data off */
/* and retire the block. */
__u32 skipErasedCheck: 1; /* If this is set we can skip the erased check on this block */
__u16 sum__NoLongerUsed; /* checksum of name. No longer used */
YCHAR name[YAFFS_MAX_NAME_LENGTH + 1];
- /* The following apply to directories, files, symlinks - not hard links */
+ /* Thes following apply to directories, files, symlinks - not hard links */
__u32 yst_mode; /* protection */
#ifdef CONFIG_YAFFS_WINCE
__u32 win_ctime[2];
__u32 win_atime[2];
__u32 win_mtime[2];
+ __u32 roomToGrow[4];
#else
- __u32 roomToGrow[6];
-
+ __u32 roomToGrow[10];
#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) */
} yaffs_FileStructure;
typedef struct {
- struct ylist_head children; /* list of child links */
+ struct list_head children; /* list of child links */
} yaffs_DirectoryStructure;
typedef struct {
struct yaffs_DeviceStruct *myDev; /* The device I'm on */
- struct ylist_head hashLink; /* list of objects in this hash bucket */
+ struct list_head hashLink; /* list of objects in this hash bucket */
- struct ylist_head hardLinks; /* all the equivalent hard linked objects */
+ struct list_head hardLinks; /* all the equivalent hard linked objects */
/* directory structure stuff */
/* also used for linking up the free list */
struct yaffs_ObjectStruct *parent;
- struct ylist_head siblings;
+ struct list_head siblings;
/* Where's my object header in NAND? */
int chunkId;
typedef struct yaffs_ObjectList_struct yaffs_ObjectList;
typedef struct {
- struct ylist_head list;
+ struct list_head list;
int count;
} yaffs_ObjectBucket;
/*----------------- Device ---------------------------------*/
struct yaffs_DeviceStruct {
- struct ylist_head devList;
+ struct list_head devList;
const char *name;
/* Entry parameters set up way early. Yaffs sets up the rest.*/
/* Stuff used by the shared space checkpointing mechanism */
/* If this value is zero, then this mechanism is disabled */
-// int nCheckpointReservedBlocks; /* Blocks to reserve for checkpoint data */
+ int nCheckpointReservedBlocks; /* Blocks to reserve for checkpoint data */
yaffs_ExtendedTags * tags);
int (*markNANDBlockBad) (struct yaffs_DeviceStruct * dev, int blockNo);
int (*queryNANDBlock) (struct yaffs_DeviceStruct * dev, int blockNo,
- yaffs_BlockState * state, __u32 *sequenceNumber);
+ yaffs_BlockState * state, int *sequenceNumber);
#endif
int isYaffs2;
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. */
__u32 tnodeWidth;
__u32 tnodeMask;
- /* 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 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 to handle inband tags */
- int inbandTags;
- __u32 totalBytesPerChunk;
#ifdef __KERNEL__
__u32 checkpointSum;
__u32 checkpointXor;
- int nCheckpointBlocksRequired; /* Number of blocks needed to store current checkpoint set */
-
/* Block Info */
yaffs_BlockInfo *blockInfo;
__u8 *chunkBits; /* bitmap of chunks in use */
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;
typedef struct yaffs_DeviceStruct yaffs_Device;
-/* The static layout of block usage etc is stored in the super block header */
+/* The static layout of bllock usage etc is stored in the super block header */
typedef struct {
int StructType;
int version;
__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 -----------------------*/
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