/dev/fs: Difference between revisions
< /dev
-117 seems to be a default |
|||
| Line 196: | Line 196: | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | -109 | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | -109 | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ENFILE | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ENFILE | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | Too many fds open | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | Too many fds open (16; includes /dev/fs) | ||
|- style="background-color: #ddd;" | |- style="background-color: #ddd;" | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | -110 | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | -110 | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ENAMETOOLONG? | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ENAMETOOLONG? | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | Max directory depth exceeded (8) | ||
|- style="background-color: #ddd;" | |- style="background-color: #ddd;" | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | -111 | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | -111 | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ETXTBSY | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | Trying to delete a currently open file | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | Trying to delete a currently open file | ||
|- style="background-color: #ddd;" | |- style="background-color: #ddd;" | ||
| Line 225: | Line 225: | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | -116 | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | -116 | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ? | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ? | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | Cluster has been tampered with | ||
|- style="background-color: #ddd;" | |- style="background-color: #ddd;" | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | -117 | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | -117 | ||
Revision as of 17:52, 22 March 2025
| This article is a stub. You can help WiiBrew by expanding it. |
The filesystem can be directly accessed through "/dev/fs".
There are several IOS functions for FS like Delete/Create/List/Rename/.. .
Files can be directly opened with IOS_Open("/tmp/data.bin",1);
The root folder contains these subfolders, some of which have their own pages:
/wfs (4.3 only)
Ioctl listing
| Request number | Name | input | output | notes |
| 0x1 | Format | - | - | Can only be called by UID 0.
Deletes the entire FS, not like the System Menu button. Will probably brick the console. Do not use! |
| 0x2 | GetStats | - | 0x1C bytes: 7 u32's: cluster size, free clusters, used clusters, bad clusters, reserved clusters, free inodes, used inodes. | |
| 0x3 | CreateDir | 0x4A bytes: 4 for owner ID, 2 for group ID, 0x40 filename, 1 for each owner/group/other permissions, 1 for attributes. | 0 | |
| 0x4 | ReadDir | Directory name (0x40), Max file count (0x4) | File names (0x13*maxFileCount), File count (0x4) | |
| 0x5 | SetAttr | See CreateDir input. | - | |
| 0x6 | GetAttr | 64 bytes for filename | See CreateDir input. | |
| 0x7 | Delete | 64 bytes for filename | - | |
| 0x8 | Rename | 64 bytes for source, 64 bytes for destination | - | |
| 0x9 | CreateFile | See CreateDir input. Owner ID and group ID will not be used. | 0 | |
| 0xa | SetFileVerCtrl | ? | ? | |
| 0xb | GetFileStats | - | 8 bytes: 4 bytes for file size, 4 bytes for seek position | |
| 0xc <ioctlv> | GetUsage | 64 bytes for filename | 4 bytes for used clusters, 4 bytes for used inodes | |
| 0xd | Shutdown | - | - | Disables the NAND and refuses any further IPC requests with error -119. |
| 0xe <ioctlv> | ????? | List of paths for the files to create. Last vector is an array of u32's with the file sizes. | - | Creates and allocates a list of files in one go.
Somehow not used by ES, despite probably being the one to benefit the most from such a function. |
/dev/fs error codes
| Error code | POSIX equivalent | notes |
| -1 | EACCES | Permission denied (IOS error) |
| -2 | EEXIST | File exists (IOS error) |
| -4 | EINVAL | Invalid argument (IOS error) |
| -6 | ENOENT | File not found (IOS error) |
| -8 | EBUSY | Resource busy (IOS error) |
| -12 | EIO ? | returned on ECC error (IOS error) |
| -22 | ENOMEM | Alloc failed during request (IOS error) |
| -101 | EINVAL | Invalid argument (again? Returned e.g. by /dev/fs IOCtls) |
| -102 | EACCESS | Permission denied |
| -103 | EIO? | returned for "corrupted" NAND |
| -104 | ? | Filesystem not initialized(?)
ES will call Format if GetStats returns this error code. |
| -105 | EEXIST | File exists |
| -106 | ENOENT | File not found |
| -107 | ENOSPC? | Filesystem is full (no free inodes) |
| -108 | ENOSPC | Filesystem is full (no free clusters) |
| -109 | ENFILE | Too many fds open (16; includes /dev/fs) |
| -110 | ENAMETOOLONG? | Max directory depth exceeded (8) |
| -111 | ETXTBSY | Trying to delete a currently open file |
| -112 | ? | ? flash error -13 |
| -113 | ? | ? flash error -11 |
| -114 | EIO? | returned on ECC error |
| -115 | ? | File is not empty
(?? both SetAttr and SetFileVerCtrl complain about this) |
| -116 | ? | Cluster has been tampered with |
| -117 | - | unknown error |
| -118 | EBUSY | Resource busy |
| -119 | ESHUTDOWN | The filesystem has been shut down |