libdragon
|
Filesystem hook structure. More...
#include <system.h>
Data Fields | |
void *(* | open )(char *name, int flags) |
Function to call when performing an open command. | |
int(* | fstat )(void *file, struct stat *st) |
Function to call when performing a fstat command. | |
int(* | lseek )(void *file, int ptr, int dir) |
Function to call when performing an lseek command. | |
int(* | read )(void *file, uint8_t *ptr, int len) |
Function to call when performing a read operation. | |
int(* | write )(void *file, uint8_t *ptr, int len) |
Function to call when performing a write operation. | |
int(* | close )(void *file) |
Function to call when performing a close operation. | |
int(* | unlink )(char *name) |
Function to call when performing an unlink operation. | |
int(* | findfirst )(char *path, dir_t *dir) |
Function to call when performing a findfirst operation. | |
int(* | findnext )(dir_t *dir) |
Function to call when performing a findnext operation. | |
Filesystem hook structure.
Filesystems that do not support one of more of the following methods should provide null pointers instead of empty functions. The newlib hooks will set errno to ENOSYS and return a proper error to userspace.
All filesystems functions must set errno in case of error, to report the proper error to userspace.
void *(* filesystem_t::open) (char *name, int flags) |
Function to call when performing an open command.
[in] | name | Full path of the file to be opened, relative to the root of the filesystem. |
[in] | flags | Open flags, such as binary, append, etc. Follows POSIX flags. |
int(* filesystem_t::fstat) (void *file, struct stat *st) |
Function to call when performing a fstat command.
[in] | file | Arbitrary file handle returned by filesystem_t::open |
[out] | st | Stat structure to populate with file statistics |
int(* filesystem_t::lseek) (void *file, int ptr, int dir) |
Function to call when performing an lseek command.
[in] | file | Arbitrary file handle returned by filesystem_t::open |
[in] | ptr | An offset from dir to seek. |
[in] | dir | A direction to see, either SEEK_SET, SEEK_CUR or SEEK_END |
int(* filesystem_t::read) (void *file, uint8_t *ptr, int len) |
Function to call when performing a read operation.
[in] | file | Arbitrary file handle returned by filesystem_t::open |
[out] | ptr | Buffer to place data read into |
[in] | len | Length of data that should be read into ptr |
int(* filesystem_t::write) (void *file, uint8_t *ptr, int len) |
Function to call when performing a write operation.
[in] | file | Arbitrary file handle returned by filesystem_t::open |
[out] | ptr | Buffer to grab the data to be written |
[in] | len | Length of data that should be written out of ptr |
int(* filesystem_t::close) (void *file) |
Function to call when performing a close operation.
[in] | file | Arbitrary file handle returned by filesystem_t::open |
int(* filesystem_t::unlink) (char *name) |
Function to call when performing an unlink operation.
[in] | name | Full path of the file to be opened, relative to the root of the filesystem. |
int(* filesystem_t::findfirst) (char *path, dir_t *dir) |
Function to call when performing a findfirst operation.
[in] | path | Full path of the directory to list files from, relative to the root of the filesystem. |
[out] | dir | Directory structure to place information on the first file in the directory. |
int(* filesystem_t::findnext) (dir_t *dir) |
Function to call when performing a findnext operation.
[out] | dir | Directory structure to place information on the next file in the directory. |