Extdata
Quota File
The inner data of Quota.dat is 0x48 bytes with the following format. The file applies limits to the file system, similar to quotas for other file systems.
| Offset | Length | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x00 | 4 | Magic "QUOT" | ||||||||||||
| 0x04 | 4 | Version, always 0x30000 | ||||||||||||
| 0x08 | 4 | Block size. Always 0x1000. | ||||||||||||
| 0x0C | 4 | Maximum number of physical files in each physical directory. Always 126. See #Device Directory Capacity for more information. | ||||||||||||
| 0x10 | 4 | padding | ||||||||||||
| 0x14 | 8 | Block count (capacity) | ||||||||||||
| 0x1C | 8 | Number of remaining blocks | ||||||||||||
| 0x24 | 4 | Current pending operation
| ||||||||||||
| 0x28 | 8 | Number of available blocks (from offset 0x1C) at the time the above operation was queued (if any). | ||||||||||||
| 0x30 | 8 | File ID that is related to the above operation info. Same as the one in Inner_FAT#Filesystem Header | ||||||||||||
| 0x38 | 8 | File size of the above mentioned file. For resize, this is interpreted as the old file size. | ||||||||||||
| 0x40 | 8 | For resize operations, the new file size to apply for the above mentioned file. |
The quota is implemented as follows:
- During initial Extdata creation with FS:CreateExtSaveData, the input size limit is divided by the block size (0x1000). This becomes the block count (capacity).
- Each physical subdirectory (not to be confused with the inner virtual directories in the EXSV filesystem) counts one block towards the block quota.
- Every 126 files, a new physical subdirectory is created.
- This includes the initial physical subdirectory (00000000).
- Each physical subfile (= full DIFF container for a virtual file) counts its file size (rounded up to the quota block size) in blocks towards the block quota.
- This includes all initial physical subfiles, namely `icon` and the root EXSV filesystem file containing the Inner_FAT#Filesystem Header.
- The physical subfile size is taken as the number of blocks corresponding to the physical subfile size rounded up to the block size as specified in the Quota.dat.
- Quota.dat itself is given one block.
Note: Extdata files do not support resizing after their initial creation, because each file is a separate, fixed-size DIFF container. The resize operation is therefore nonfunctional.