oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Data Structures | Functions
fs.h File Reference
#include "ove/types.h"
#include "ove_config.h"
#include "ove/storage.h"
Include dependency graph for fs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ove_dirent
 Directory entry descriptor returned by ove_fs_readdir. More...
 

Macros

File open flags

Flags passed to ove_fs_open or ove_fs_open_init. Flags may be combined with bitwise OR.

#define OVE_FS_O_READ   0x01
 Open for reading.
 
#define OVE_FS_O_WRITE   0x02
 Open for writing.
 
#define OVE_FS_O_CREATE   0x04
 Create the file if it does not exist.
 
#define OVE_FS_O_APPEND   0x08
 Seek to the end of the file before each write.
 
Seek whence constants

Passed as the whence argument to ove_fs_seek.

#define OVE_FS_SEEK_SET   0
 Seek relative to the beginning of the file.
 
#define OVE_FS_SEEK_CUR   1
 Seek relative to the current file position.
 
#define OVE_FS_SEEK_END   2
 Seek relative to the end of the file.
 

Functions

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_close_deinit (ove_file_t file)
 Close a statically-allocated file handle.
 
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.
 
int ove_fs_closedir_deinit (ove_dir_t dir)
 Close a statically-allocated directory handle.
 
int ove_fs_open (ove_file_t *file, const char *path, int flags)
 Open a file (heap-backed handle).
 
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-backed handle).
 
int ove_fs_closedir (ove_dir_t dir)
 Close a directory handle returned by ove_fs_opendir.
 
int ove_fs_mount (const char *dev_path, const char *mount_point)
 Mount a storage device at a virtual path prefix.
 
void ove_fs_unmount (const char *mount_point)
 Unmount a previously mounted storage device.
 
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_write (ove_file_t file, const void *buf, size_t count, size_t *bytes_written)
 Write bytes to an open file.
 
int ove_fs_size (ove_file_t file, size_t *out_size)
 Query the total size of an open file.
 
int ove_fs_seek (ove_file_t file, long offset, int whence)
 Reposition the file read/write offset.
 
long ove_fs_tell (ove_file_t file)
 Return the current file position.
 
int ove_fs_readdir (ove_dir_t dir, struct ove_dirent *entry)
 Read the next entry from an open directory.
 
int ove_fs_unlink (const char *path)
 Delete a file by path.
 
int ove_fs_rename (const char *old_path, const char *new_path)
 Rename or move a file.