In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

/dev/fsa

From WiiUBrew
< /dev
Revision as of 00:46, 30 January 2016 by Marionumber1 (talk | contribs) (→‎Request Blocks: Add some unknown, but obvious, values to the read/write request block struct)
Jump to navigation Jump to search

/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.