|
int | dfs_chdir (const char *const path) |
| Change directories to the specified path.
More...
|
|
int | dfs_dir_findfirst (const char *const path, char *buf) |
| Find the first file or directory in a directory listing. More...
|
|
int | dfs_dir_findnext (char *buf) |
| Find the next file or directory in a directory listing. More...
|
|
int | dfs_open (const char *const path) |
| Open a file given a path. More...
|
|
int | dfs_close (uint32_t handle) |
| Close an already open file handle. More...
|
|
int | dfs_seek (uint32_t handle, int offset, int origin) |
| Seek to an offset in the file. More...
|
|
int | dfs_tell (uint32_t handle) |
| Return the current offset into a file. More...
|
|
int | dfs_read (void *const buf, int size, int count, uint32_t handle) |
| Read data from a file. More...
|
|
int | dfs_size (uint32_t handle) |
| Return the file size of an open file. More...
|
|
uint32_t | dfs_rom_addr (const char *path) |
| Return the physical address of a file (in ROM space) More...
|
|
int | dfs_eof (uint32_t handle) |
| Return whether the end of file has been reached. More...
|
|
int | dfs_init (uint32_t base_fs_loc) |
| Initialize the filesystem. More...
|
|
const char * | dfs_strerror (int error) |
| Convert DFS error code into an error string.
|
|
uint32_t dfs_rom_addr |
( |
const char * |
path | ) |
|
Return the physical address of a file (in ROM space)
This function should be used for highly-specialized, high-performance use cases. Using dfs_open / dfs_read is generally acceptable performance-wise, and is easier to use rather than managing direct access to PI space.
Direct access to ROM data must go through io_read or dma_read. Do not dereference directly as the console might hang if the PI is busy.
- Parameters
-
- Returns
- A pointer to the physical address of the file body, or 0 if the file was not found.
int dfs_init |
( |
uint32_t |
base_fs_loc | ) |
|
Initialize the filesystem.
Given a base offset where the filesystem should be found, this function will initialize the filesystem to read from cartridge space. This function will also register DragonFS with newlib so that standard POSIX/C file operations work with DragonFS, using the "rom:/" prefix".
The function needs to know where the DFS image is located within the cartridge space. To simplify this, you can pass DFS_DEFAULT_LOCATION which tells dfs_init to search for the DFS image by itself, using the rompak TOC (see rompak_internal.h). Most users should use this option.
Otherwise, if the ROM cannot be built with a rompak TOC for some reason, a virtual address should be passed. This is normally 0xB0000000 + the offset used when building your ROM + the size of the header file used (typically 0x1000).
- Parameters
-
[in] | base_fs_loc | Virtual address in cartridge space at which to find the filesystem, or DFS_DEFAULT_LOCATION to automatically search for the filesystem in the cartridge (using the rompak). |
- Returns
- DFS_ESUCCESS on success or a negative error otherwise.