35#include "ove_config.h"
36#include "ove/storage.h"
49#define OVE_FS_O_READ 0x01
51#define OVE_FS_O_WRITE 0x02
53#define OVE_FS_O_CREATE 0x04
55#define OVE_FS_O_APPEND 0x08
64#define OVE_FS_SEEK_SET 0
66#define OVE_FS_SEEK_CUR 1
68#define OVE_FS_SEEK_END 2
97 const char *path,
int flags);
224 size_t *bytes_written);
297static inline void ove_fs_unmount(
const char *mount_point) { (void)mount_point; }
int ove_fs_size(ove_file_t file, size_t *out_size)
Query the total size of an open file.
int ove_fs_readdir(ove_dir_t dir, struct ove_dirent *entry)
Read the next entry from an open directory.
int ove_fs_opendir_init(ove_dir_t *dir, ove_dir_storage_t *storage, const char *path)
Open a directory using caller-provided static storage.
void ove_fs_unmount(const char *mount_point)
Unmount a previously mounted storage device.
int ove_fs_closedir_deinit(ove_dir_t dir)
Close a statically-allocated directory handle.
int ove_fs_unlink(const char *path)
Delete a file by path.
int ove_fs_open_init(ove_file_t *file, ove_file_storage_t *storage, const char *path, int flags)
Open a file using caller-provided static storage.
int ove_fs_open(ove_file_t *file, const char *path, int flags)
Open a file.
int ove_fs_rename(const char *old_path, const char *new_path)
Rename or move a file.
long ove_fs_tell(ove_file_t file)
Return the current file position.
int ove_fs_read(ove_file_t file, void *buf, size_t count, size_t *bytes_read)
Read bytes from an open file.
int ove_fs_seek(ove_file_t file, long offset, int whence)
Reposition the file read/write offset.
int ove_fs_close_deinit(ove_file_t file)
Close a statically-allocated file handle.
int ove_fs_mount(const char *dev_path, const char *mount_point)
Mount a storage device at a virtual path prefix.
int ove_fs_close(ove_file_t file)
Close a file handle returned by ove_fs_open.
int ove_fs_opendir(ove_dir_t *dir, const char *path)
Open a directory (heap or backend-managed allocation).
int ove_fs_closedir(ove_dir_t dir)
Close a directory handle returned by ove_fs_opendir.
int ove_fs_write(ove_file_t file, const void *buf, size_t count, size_t *bytes_written)
Write bytes to an open file.
#define OVE_ERR_NOT_SUPPORTED
The requested feature is not supported by the active backend.
Definition types.h:38
struct ove_dir * ove_dir_t
Opaque handle for an open directory.
Definition types.h:115
struct ove_file * ove_file_t
Opaque handle for an open file.
Definition types.h:112
Directory entry descriptor returned by ove_fs_readdir.
Definition fs.h:74
char name[256]
Null-terminated entry name (not full path).
Definition fs.h:75
int is_dir
Non-zero if the entry is a directory.
Definition fs.h:77
unsigned int size
File size in bytes; 0 for directories.
Definition fs.h:76