Line 19: |
Line 19: |
| Each metadata "superblock" starts with the 4 magic bytes "SFFS", followed by a 4-byte "generation number" and another 4-byte number (always 0x10?). When accessing the FS, IOS will choose the superblock with the highest generation number and use it; whenever it modifies the filesystem in any way, it will increment the generation number by 1 and write out an entirely new superblock in the next slot (in round-robin order). | | Each metadata "superblock" starts with the 4 magic bytes "SFFS", followed by a 4-byte "generation number" and another 4-byte number (always 0x10?). When accessing the FS, IOS will choose the superblock with the highest generation number and use it; whenever it modifies the filesystem in any way, it will increment the generation number by 1 and write out an entirely new superblock in the next slot (in round-robin order). |
| | | |
− | The next 0x10000 bytes (bytes 0xc:0x1000c within the superblock) are 0x8000 2-byte cluster numbers, and comprise the FAT. The FAT is followed by the FST -- the tree structure containing the directory hierarchy and (plaintext!) filenames. | + | The next 0x10000 bytes (bytes 0xc:0x1000c within the superblock) are 0x8000 2-byte cluster numbers, and comprise the FAT. The FAT is followed by the FST — the tree structure containing the directory hierarchy and (plaintext!) filenames. |
| | | |
| === FAT === | | === FAT === |
| The FAT contains cluster chain / allocation information for the entire NAND chip, including parts of it which are not technically part of the filesystem! | | The FAT contains cluster chain / allocation information for the entire NAND chip, including parts of it which are not technically part of the filesystem! |
| | | |
− | The first 64 entries will always be 0xFFFC, which indicates that this cluster is "reserved". These correspond to the first 64 clusters or 8 blocks -- which is where boot1 and boot2 are stored. | + | The first 64 entries will always be 0xFFFC, which indicates that this cluster is "reserved". These correspond to the first 64 clusters or 8 blocks — which is where boot1 and boot2 are stored. |
| | | |
| Special values include: | | Special values include: |
| * 0xFFFB - last cluster within a chain | | * 0xFFFB - last cluster within a chain |
| * 0xFFFC - reserved cluster | | * 0xFFFC - reserved cluster |
− | * 0xFFFD - bad block (marked at factory) -- you should always see these in groups of 8 (8 clusters per NAND block) | + | * 0xFFFD - bad block (marked at factory) — you should always see these in groups of 8 (8 clusters per NAND block) |
| * 0xFFFE - empty (unused / available) space | | * 0xFFFE - empty (unused / available) space |
| | | |