24 #define FS_PATH_MAX 255 25 #define FS_PATH_SEPARATOR '/' 164 const char *new_path);
fs_file_t fs_file_open(fs_volume_t *volume, const char *path, bool write)
Open an existing file for read/write.
fs_volume_t * volume
Owning volume (set by APIs)
bool fs_file_close(fs_file_t *file)
Close an opened file.
bool fs_vol_readdir(fs_volume_t *volume, const char *path, fs_file_t *iterator)
Iterate directory entries.
fs_volume_t * fs_vol_init_file(const char *path, size_t size)
Open or create a host file–backed persistent volume.
bool fs_vol_remove(fs_volume_t *volume, const char *path)
Remove a file or (empty) directory.
size_t fs_file_write(fs_file_t *file, const void *buffer, size_t size)
Write data to an opened file.
bool dir
True if directory, false if regular file.
void * ctx
Opaque iterator cursor (do not modify)
File and directory metadata.
fs_volume_t * fs_vol_init_flash(size_t size)
Open or create a non-volatile flash-backed persistent volume.
size_t fs_vol_size(fs_volume_t *volume, size_t *free)
Return total addressable size of a mounted volume.
bool fs_file_seek(fs_file_t *file, size_t offset)
Seek to a position within an opened file.
#define FS_PATH_MAX
Maximum length of a single path component.
struct fs_volume_t fs_volume_t
Opaque filesystem volume handle.
fs_volume_t * fs_vol_init_memory(size_t size)
Create a new volatile (RAM) filesystem volume.
bool fs_vol_mkdir(fs_volume_t *volume, const char *path)
Create a directory.
void fs_vol_finalize(fs_volume_t *volume)
Unmount and release all resources for a volume.
size_t fs_file_read(fs_file_t *file, void *buffer, size_t size)
Read data from an opened file.
bool fs_vol_move(fs_volume_t *volume, const char *old_path, const char *new_path)
Move or rename a file/directory.
fs_file_t fs_file_create(fs_volume_t *volume, const char *path)
Create a new file or truncate an existing file to zero length.
fs_file_t fs_vol_stat(fs_volume_t *volume, const char *path)
Lookup file or directory metadata for a path.