/dev/fsa
/dev/fsa is the IOSU device node for the virtual filesystem API. It exposes a generic interface for accessing various filesystems supported by the Wii U, including the internal storage filesystem (ISFS), game disc filesystems, and SD cards. These filesystems can be mounted on directories under /vol and accessed through a common API. Once opened, ioctl() and ioctlv() requests can be issued to the interface, which are documented below.
ioctl() interface
0x0A - FSOpenDir()
0x0B - FSReadDir()
0x0E - FSOpenFile()
ioctlv() interface
0x0F - FSReadFile()
This function is used to read data from an open file. It takes 1 input buffer through the ioctlv interface, a read request block, and 2 output buffers, a buffer for file data and a status block.
0x10 - FSWriteFile()
This function is used to write data to an open file. It takes 2 input buffers through the ioctlv interface, a read request block and a data buffer, and 1 output buffer, a status block.
Structures
Request Blocks
The parameters to FSA functions are passed in a 0x520-byte request block. While the size is constant, the structure varies by call, as shown below:
/* Read/write request block */
typedef struct
{
char unknown0[0x4-0x0];
void *buffer; // Not looked at by FSA
uint32_t size, count;
char unknown10[0x14-0x10];
uint32_t handle;
char unknown18[0x1c-0x18];
uint32_t unknown1c; // Always 0x6e000000
char unknown20[0x284-0x20];
uint32_t unknown284; // Always 0x77000000
char unknown288[0x294-0x288];
uint32_t unknown294; // Always 0x660
char unknown298[0x520-0x298];
} rw_req_t;
Status Blocks
All FSA functions return the status of the call in a 0x293-byte buffer.
Tables
List of Functions (Ioctl/Ioctlv/IoctlAsync)
Command | Function | Ioctl | Ioctlv | IoctlAsync | Notes |
---|---|---|---|---|---|
0x01 | FSMount | X | |||
0x01 | FSAMount | X | |||
0x01 | FSMountAsync | X | |||
0x01 | FSBindMount | X | |||
0x02 | FSUnmount | X | |||
0x02 | FSAUnmount | X | |||
0x02 | FSUnmountAsync | X | |||
0x02 | FSBindUnmount | X | |||
0x02 | FSBindUnmountAsync | X | X | ||
0x03 | FSGetVolumeInfo | X | |||
0x03 | FSAGetVolumeInfo | X | |||
0x03 | FSGetVolumeInfoAsync | X | |||
0x04 | FSInit | X | |||
0x04 | FSAInit | X | |||
0x05 | FSChangeDir | X | |||
0x05 | FSAChangeDir | X | |||
0x05 | FSChangeDirAsync | X | |||
0x06 | FSGetCwd | X | |||
0x06 | FSAGetCwd | X | |||
0x06 | FSGetCwd Async | X | |||
0x07 | FSMakeDir | X | X | ||
0x08 | FSRemove | X | X | ||
0x09 | FSRename | X | |||
0x0A | FSOpenDir | X | X | ||
0x0B | FSReadDir | X | |||
0x0C | FSRewindDir | X | |||
0x0D | FSCloseDir | X | |||
0x0E | FSOpenFile | X | |||
0x0E | FSOpenFileEx | X | |||
0x0F | FSReadFile | X | |||
0x0F | FSReadFileWith Pos | X | |||
0x10 | FSWriteFile | X | |||
0x10 | FSWriteFileWithPos | X | |||
0x11 | FSGetPosFile | X | |||
0x12 | FSSetPosFile | X | |||
0x13 | FSIsEof | X | |||
0x14 | FSGetStatFile | X | |||
0x15 | FSCloseFile | X | |||
0x16 | FSAGetError | X | |||
0x17 | FSFlushFile | X | |||
0x18 | FSGetStat | X | X | ||
0x18 | FSGetFreeSpaceSize | X | X | ||
0x18 | FSGetEntryNum | X | X | ||
0x18 | FSGetFileSystemInfo | X | X | ||
0x19 | FSAppendFile | X | |||
0x19 | FSAppendFileEx | X | |||
0x1A | FSTruncateFile | X | |||
0x1B | FSAFlushVolume | X | X | ||
0x1C | FSARollbackVolume | X | X | ||
0x1D | FSMakeQuota | X | X | ||
0x1E | FSFlushQuota | X | X | ||
0x1F | FSRollbackQuota | X | X | ||
0x1F | FSARollbackQuotaForce | X | X | ||
0x20 | FSChangeMode | X | X | ||
0x21 | FSOpenFileByStat | X | |||
0x21 | FSAOpenFileByStat | X | |||
0x21 | FSOpenFileByStatAsync | X | |||
0x22 | FSRegisterFlushQuota | X | X | ||
0x23 | FSFlushMultiQuota | X | X | ||
0x25 | FSGetFileBlockAddress | X | |||
0x6E | Unknown | X | |||
0x6F | Unknown | X | |||
0x72 | FSRemoveQuota | X | X | ||
0x75 | FSMakeLinkAsync | X | X | ||
0x76 | HIOInit | ? | ? | ? | Not FS Command? |
0x?? | FSAddClientEx | X | Used with 0x01 and 0x02 |