-#define YAFFS_MAX_ALIAS_LENGTH 159\r
-\r
-#define YAFFS_OBJECTID_ROOT 1\r
-#define YAFFS_OBJECTID_LOSTNFOUND 2\r
-\r
-// Tags structures in RAM\r
-// NB This uses bitfield. Bitfields should not stradle a u32 boundary otherwise\r
-// the structure size will get blown out.\r
-\r
-typedef struct\r
-{\r
- unsigned chunkId:20;\r
- unsigned serialNumber:2;\r
- unsigned byteCount:10;\r
- unsigned objectId:18;\r
- unsigned ecc:12;\r
- unsigned unusedStuff:2;\r
-} yaffs_Tags;\r
-\r
-typedef union\r
-{\r
- yaffs_Tags asTags;\r
- __u8 asBytes[8];\r
-} yaffs_TagsUnion;\r
-\r
-\r
-// Spare structure\r
-typedef struct\r
-{\r
- __u8 tagByte0;\r
- __u8 tagByte1;\r
- __u8 tagByte2;\r
- __u8 tagByte3;\r
- __u8 pageStatus; // Currently unused, but sort of set aside to distinguish\r
- // unused - vs- used -vs- deleted chunks. We achieve this by\r
- // using the objectId tags.\r
- __u8 blockStatus;\r
- __u8 tagByte4;\r
- __u8 tagByte5;\r
- __u8 ecc1[3];\r
- __u8 tagByte6;\r
- __u8 tagByte7;\r
- __u8 ecc2[3];\r
-} yaffs_Spare;\r
-\r
-// Block data in RAM\r
-\r
-typedef enum {\r
- YAFFS_BLOCK_STATE_UddNKNOWN = 0,\r
- YAFFS_BLOCK_STATE_SCANNING, // Used while the block is being scanned.\r
- // NB Don't erase blocks while they're being scanned\r
- \r
- YAFFS_BLOCK_STATE_EMPTY, // This block is empty\r
- \r
- YAFFS_BLOCK_STATE_ALLOCATING, // This block is partially allocated. \r
- // This is the one currently being used for page\r
- // allocation. Should never be more than one of these\r
- \r
-\r
- YAFFS_BLOCK_STATE_FULL, // All the pages in this block have been allocated.\r
- // At least one page holds valid data.\r
- \r
- YAFFS_BLOCK_STATE_DIRTY, // All pages have been allocated and deleted. \r
- // Erase me, reuse me.\r
- \r
- YAFFS_BLOCK_STATE_DEAD = 0x99 // This block has failed and is not in use\r
-\r
-} yaffs_BlockState;\r
-\r
-\r
-\r
-\r
-typedef struct\r
-{\r
- __u32 pageBits; // bitmap of pages in use\r
- __u8 blockState; // One of the above block states\r
- __u8 pagesInUse; // number of pages in use\r
-} yaffs_BlockInfo;\r
-\r
-\r
-//////////////////// Object structure ///////////////////////////\r
-// This is the object structure as stored on NAND\r
-\r
-typedef enum\r
-{\r
- YAFFS_OBJECT_TYPE_UNKNOWN,\r
- YAFFS_OBJECT_TYPE_FILE,\r
- YAFFS_OBJECT_TYPE_SYMLINK,\r
- YAFFS_OBJECT_TYPE_DIRECTORY,\r
- YAFFS_OBJECT_TYPE_HARDLINK,\r
- YAFFS_OBJECT_TYPE_SPECIAL\r
-} yaffs_ObjectType;\r
-\r
-typedef struct\r
-{\r
- yaffs_ObjectType type;\r
-\r
- // Apply to everything \r
- int parentObjectId;\r
- __u16 sum; // checksum of name\r
- char name[YAFFS_MAX_NAME_LENGTH + 1];\r
-\r
- // Thes following apply to directories, files, symlinks - not hard links\r
- __u32 st_mode; // protection\r
- __u32 st_uid; // user ID of owner\r
- __u32 st_gid; // group ID of owner \r
- __u32 st_atime; // time of last access\r
- __u32 st_mtime; // time of last modification\r
- __u32 st_ctime; // time of last change\r
- \r
- // File size applies to files only\r
- int fileSize; \r
- \r
- // Equivalent object id applies to hard links only.\r
- int equivalentObjectId;\r
- \r
- // Alias is for symlinks only.\r
- char alias[YAFFS_MAX_ALIAS_LENGTH + 1];\r
- \r
- __u32 st_rdev; // device stuff for block and char devices (maj/min)\r
- // Roowm to grow...\r
- __u32 roomToGrow[12];\r
- \r
-} yaffs_ObjectHeader;\r
-\r
-\r
-\r
-//////////////////// Tnode ///////////////////////////\r
-\r
-union yaffs_Tnode_union\r
-{\r
- union yaffs_Tnode_union *internal[YAFFS_NTNODES_INTERNAL];\r
- __u16 level0[YAFFS_NTNODES_LEVEL0];\r
- \r
-};\r
-\r
-typedef union yaffs_Tnode_union yaffs_Tnode;\r
-\r
-struct yaffs_TnodeList_struct\r
-{\r
- struct yaffs_TnodeList_struct *next;\r
- yaffs_Tnode *tnodes;\r
-};\r
-\r
-typedef struct yaffs_TnodeList_struct yaffs_TnodeList;\r
-\r
-\r
-\r
-/////////////////// Object ////////////////////////////////\r
-// An object can be one of:\r
-// - a directory (no data, has children links\r
-// - a regular file (data.... not prunes :->).\r
-// - a symlink [symbolic link] (the alias).\r
-// - a hard link\r
-\r
-\r
-typedef struct \r
-{\r
- __u32 fileSize;\r
- __u32 scannedFileSize;\r
- __u32 topLevel;\r
- yaffs_Tnode *top;\r
-} yaffs_FileStructure;\r
-\r
-typedef struct\r
-{\r
- struct list_head children; // list of child links\r
-} yaffs_DirectoryStructure;\r
-\r
-typedef struct\r
-{\r
- char *alias;\r
-} yaffs_SymLinkStructure;\r
-\r
-typedef struct\r
-{\r
- struct yaffs_ObjectStruct *equivalentObject;\r
- __u32 equivalentObjectId;\r
-} yaffs_HardLinkStructure;\r
-\r
-typedef union\r
-{\r
- yaffs_FileStructure fileVariant;\r
- yaffs_DirectoryStructure directoryVariant;\r
- yaffs_SymLinkStructure symLinkVariant;\r
- yaffs_HardLinkStructure hardLinkVariant;\r
-} yaffs_ObjectVariant;\r
-\r
-\r
-struct yaffs_ObjectStruct\r
-{\r
- __u8 fake:1; // A fake object has no presence on NAND.\r
- __u8 renameAllowed:1;\r
- __u8 unlinkAllowed:1;\r
- __u8 dirty:1; // the object needs to be written to flash\r
- __u8 valid:1; // When the file system is being loaded up, this \r
- // object might be created before the data\r
- // is available (ie. file data records appear before the header).\r
- __u8 serial; // serial number of chunk in NAND. Store here so we don't have to\r
- // read back the old one to update.\r
- __u16 sum; // sum of the name to speed searching\r
- \r
- struct yaffs_DeviceStruct *myDev; // The device I'm on\r
- \r
- \r
- struct list_head hashLink; // list of objects in this hash bucket\r
- \r
-\r
- struct list_head hardLinks; // all the equivalent hard linked objects\r
- // live on this list\r
- // directory structure stuff\r
- struct yaffs_ObjectStruct *parent; //my parent directory\r
- struct list_head siblings; // siblings in a directory\r
- // also used for linking up the free list\r
- \r
- // Where's my data in NAND?\r
- int chunkId; // where it lives\r
-\r
- int nDataChunks; // really only for debugging.\r
- \r
- __u32 objectId; // the object id value\r
- \r
- \r
+ // File size applies to files only
+ int fileSize;
+
+ // Equivalent object id applies to hard links only.
+ int equivalentObjectId;
+
+ // Alias is for symlinks only.
+ char alias[YAFFS_MAX_ALIAS_LENGTH + 1];
+
+ __u32 st_rdev; // device stuff for block and char devices (maj/min)
+
+#ifdef CONFIG_YAFFS_WINCE
+ __u32 win_ctime[2];
+ __u32 win_atime[2];
+ __u32 win_mtime[2];
+ __u32 roomToGrow[6];
+#else
+ __u32 roomToGrow[12];
+#endif
+
+} yaffs_ObjectHeader;
+
+
+
+//////////////////// Tnode ///////////////////////////
+
+union yaffs_Tnode_union
+{
+ union yaffs_Tnode_union *internal[YAFFS_NTNODES_INTERNAL];
+ __u16 level0[YAFFS_NTNODES_LEVEL0];
+
+};
+
+typedef union yaffs_Tnode_union yaffs_Tnode;
+
+struct yaffs_TnodeList_struct
+{
+ struct yaffs_TnodeList_struct *next;
+ yaffs_Tnode *tnodes;
+};
+
+typedef struct yaffs_TnodeList_struct yaffs_TnodeList;
+
+
+
+/////////////////// Object ////////////////////////////////
+// An object can be one of:
+// - a directory (no data, has children links
+// - a regular file (data.... not prunes :->).
+// - a symlink [symbolic link] (the alias).
+// - a hard link
+
+
+typedef struct
+{
+ __u32 fileSize;
+ __u32 scannedFileSize;
+ int topLevel;
+ yaffs_Tnode *top;
+} yaffs_FileStructure;
+
+typedef struct
+{
+ struct list_head children; // list of child links
+} yaffs_DirectoryStructure;
+
+typedef struct
+{
+ char *alias;
+} yaffs_SymLinkStructure;
+
+typedef struct
+{
+ struct yaffs_ObjectStruct *equivalentObject;
+ __u32 equivalentObjectId;
+} yaffs_HardLinkStructure;
+
+typedef union
+{
+ yaffs_FileStructure fileVariant;
+ yaffs_DirectoryStructure directoryVariant;
+ yaffs_SymLinkStructure symLinkVariant;
+ yaffs_HardLinkStructure hardLinkVariant;
+} yaffs_ObjectVariant;
+
+
+struct yaffs_ObjectStruct
+{
+ __u8 deleted: 1; // This should only apply to unlinked files.
+ __u8 unlinked: 1; // An unlinked file. The file should be in the unlinked pseudo directory.
+ __u8 fake:1; // A fake object has no presence on NAND.
+ __u8 renameAllowed:1;
+ __u8 unlinkAllowed:1;
+ __u8 dirty:1; // the object needs to be written to flash
+ __u8 valid:1; // When the file system is being loaded up, this
+ // 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. Store here so we don't have to
+ // read back the old one to update.
+ __u16 sum; // sum of the name to speed searching
+
+ struct yaffs_DeviceStruct *myDev; // The device I'm on
+
+
+ struct list_head hashLink; // list of objects in this hash bucket
+
+
+ struct list_head hardLinks; // all the equivalent hard linked objects
+ // live on this list
+ // directory structure stuff
+ struct yaffs_ObjectStruct *parent; //my parent directory
+ struct list_head siblings; // siblings in a directory
+ // also used for linking up the free list
+
+ // Where's my data in NAND?
+ int chunkId; // where it lives
+
+ int nDataChunks;
+
+ __u32 objectId; // the object id value
+
+