ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_io_fsfmt.h
Go to the documentation of this file.
1
36
37#pragma once
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43#include <stdint.h>
44
45#include "ra8_err.h"
46#include "ra8_fs.h"
47#include "ra8_fs_meta.h"
48
54typedef enum : uint8_t {
57
75
104
113typedef bool (*ra8_io_fsfmt_probe_fn_t)(const ra8_fs_backend_t* backend);
114
116typedef ra8_err_t (*ra8_io_fsfmt_mount_fn_t)(const ra8_fs_backend_t* backend, void** out_mount);
118typedef ra8_err_t (*ra8_io_fsfmt_unmount_fn_t)(void* mount_ctx);
120typedef ra8_err_t (*ra8_io_fsfmt_open_fn_t)(void* mount_ctx,
121 const char* path,
122 ra8_fs_mode_t mode,
123 void** out_file);
125typedef ra8_err_t (*ra8_io_fsfmt_close_fn_t)(void* file_ctx);
127typedef ra8_err_t (*ra8_io_fsfmt_read_fn_t)(void* file_ctx,
128 void* buf,
129 uint32_t bytes,
130 uint32_t* out_read);
132typedef ra8_err_t (*ra8_io_fsfmt_write_fn_t)(void* file_ctx, const void* buf, uint32_t bytes);
134typedef ra8_err_t (*ra8_io_fsfmt_seek_fn_t)(void* file_ctx, uint64_t offset_bytes);
136typedef ra8_err_t (*ra8_io_fsfmt_tell_fn_t)(const void* file_ctx, uint64_t* out_offset);
138typedef ra8_err_t (*ra8_io_fsfmt_size_fn_t)(const void* file_ctx, uint64_t* out_bytes);
140typedef ra8_err_t (*ra8_io_fsfmt_sync_fn_t)(void* file_ctx);
142typedef ra8_err_t (*ra8_io_fsfmt_stat_fn_t)(void* mount_ctx, const char* path, ra8_fs_stat_t* out);
144typedef ra8_err_t (*ra8_io_fsfmt_listdir_fn_t)(void* mount_ctx,
145 const char* path,
147 void* cb_ctx);
149typedef ra8_err_t (*ra8_io_fsfmt_dir_open_fn_t)(void* mount_ctx,
150 const char* path,
151 void* directory_state,
152 uint32_t state_bytes);
154typedef ra8_err_t (*ra8_io_fsfmt_dir_next_fn_t)(void* directory_state,
155 ra8_fs_dirent_t* out,
156 bool* out_entry);
158typedef ra8_err_t (*ra8_io_fsfmt_dir_close_fn_t)(void* directory_state);
160typedef ra8_err_t (*ra8_io_fsfmt_path_fn_t)(void* mount_ctx, const char* path);
162typedef ra8_err_t (*ra8_io_fsfmt_rename_fn_t)(void* mount_ctx,
163 const char* old_path,
164 const char* new_path);
166typedef ra8_err_t (*ra8_io_fsfmt_space_fn_t)(void* mount_ctx, ra8_fs_space_t* out);
167
202
219
235[[nodiscard]] ra8_err_t ra8_io_fsfmt_init(void);
236
257[[nodiscard]] ra8_err_t ra8_io_fsfmt_register(const ra8_io_fsfmt_t* fmt);
258
276[[nodiscard]] ra8_err_t ra8_io_fsfmt_get_builtin(ra8_fs_type_t type, const ra8_io_fsfmt_t** out);
277
298[[nodiscard]] ra8_err_t ra8_io_fsfmt_probe(const ra8_fs_backend_t* backend,
299 const ra8_io_fsfmt_t** out);
300
301#ifdef __cplusplus
302}
303#endif
-proof
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
Volume-level metadata: free space, volume label, and per-entry utime.
ra8_fs_type_t
FAT variant detected from the BPB cluster-count rule.
ra8_fs_mode_t
File-open modes accepted by ra8_fs_open().
void(* ra8_fs_listdir_cb_t)(const char *name, uint8_t attr, uint64_t size, void *ctx)
Callback invoked once per directory entry by ra8_fs_listdir().
ra8_io_fsfmt_name_limit_t
Public UTF-8 name-byte limits of the two built-in formats.
@ k_ra8_io_fsfmt_exfat_max_name_utf8
64 UTF-16 units, worst case.
@ k_ra8_io_fsfmt_fat_max_name_utf8
247 UTF-16 units, worst case.
ra8_err_t(* ra8_io_fsfmt_unmount_fn_t)(void *mount_ctx)
Release a context returned by ra8_io_fsfmt_mount_fn_t.
ra8_err_t(* ra8_io_fsfmt_sync_fn_t)(void *file_ctx)
Flush format-owned software state for one file.
ra8_err_t(* ra8_io_fsfmt_size_fn_t)(const void *file_ctx, uint64_t *out_bytes)
Report a format-private file context's size.
ra8_err_t(* ra8_io_fsfmt_path_fn_t)(void *mount_ctx, const char *path)
Apply a one-path namespace mutation.
ra8_err_t(* ra8_io_fsfmt_seek_fn_t)(void *file_ctx, uint64_t offset_bytes)
Seek a format-private file context.
ra8_err_t(* ra8_io_fsfmt_rename_fn_t)(void *mount_ctx, const char *old_path, const char *new_path)
Rename within one mounted format.
ra8_err_t ra8_io_fsfmt_init(void)
Reset the registry and register the built-in FAT + exFAT formats.
ra8_err_t ra8_io_fsfmt_probe(const ra8_fs_backend_t *backend, const ra8_io_fsfmt_t **out)
Detect the format of a volume by probing registered formats in order.
ra8_err_t(* ra8_io_fsfmt_stat_fn_t)(void *mount_ctx, const char *path, ra8_fs_stat_t *out)
Query path metadata in a mounted format.
bool(* ra8_io_fsfmt_probe_fn_t)(const ra8_fs_backend_t *backend)
Returns true if backend's volume looks like this format.
ra8_err_t(* ra8_io_fsfmt_tell_fn_t)(const void *file_ctx, uint64_t *out_offset)
Report a format-private file context's offset.
ra8_err_t ra8_io_fsfmt_register(const ra8_io_fsfmt_t *fmt)
Register a filesystem format (the foreign-format seam).
ra8_err_t(* ra8_io_fsfmt_dir_close_fn_t)(void *directory_state)
Close and consume a format-private directory cursor.
ra8_err_t(* ra8_io_fsfmt_dir_open_fn_t)(void *mount_ctx, const char *path, void *directory_state, uint32_t state_bytes)
Open a format-private directory cursor in caller workspace.
ra8_err_t(* ra8_io_fsfmt_mount_fn_t)(const ra8_fs_backend_t *backend, void **out_mount)
Mount a format over a block backend and return its private context.
ra8_err_t(* ra8_io_fsfmt_dir_next_fn_t)(void *directory_state, ra8_fs_dirent_t *out, bool *out_entry)
Copy the next stable entry from a format-private cursor.
ra8_err_t ra8_io_fsfmt_get_builtin(ra8_fs_type_t type, const ra8_io_fsfmt_t **out)
Return the built-in descriptor serving one native ra8_fs type.
ra8_err_t(* ra8_io_fsfmt_read_fn_t)(void *file_ctx, void *buf, uint32_t bytes, uint32_t *out_read)
Read from a format-private file context.
ra8_err_t(* ra8_io_fsfmt_write_fn_t)(void *file_ctx, const void *buf, uint32_t bytes)
Write to a format-private file context.
ra8_io_fsfmt_limits_t
Registry sizing.
@ k_ra8_io_fsfmt_max
Max registered formats (built-ins + foreign).
ra8_err_t(* ra8_io_fsfmt_listdir_fn_t)(void *mount_ctx, const char *path, ra8_fs_listdir_cb_t cb, void *cb_ctx)
Enumerate one directory in a mounted format.
ra8_err_t(* ra8_io_fsfmt_space_fn_t)(void *mount_ctx, ra8_fs_space_t *out)
Query capacity and free space in one mounted format.
ra8_err_t(* ra8_io_fsfmt_open_fn_t)(void *mount_ctx, const char *path, ra8_fs_mode_t mode, void **out_file)
Open a path and return a format-private file context.
ra8_err_t(* ra8_io_fsfmt_close_fn_t)(void *file_ctx)
Close a format-private file context.
Block-device interface that ra8_fs runs on top of.
Stable directory-entry value copied by ra8_fs_dir_next.
A mounted volume's capacity, free space, and cluster geometry.
Definition ra8_fs_meta.h:84
What ra8_fs_stat() read out of a directory entry.
What a filesystem format supports.
uint16_t max_open_directories
Concurrent caller-owned cursors.
bool durable_sync
true => sync reaches non-volatile media.
bool supports_dir_cursor
true => incremental directory cursor exists.
bool read_only
true => no writes/creates/erases.
bool atomic_rename
true => rename is power-loss atomic.
bool supports_rmdir
true => empty-directory removal.
uint32_t directory_workspace_bytes
Caller bytes required per cursor.
uint8_t directory_workspace_align
Required cursor-workspace alignment.
bool supports_mkdir
true => sub-directory creation.
bool case_sensitive
true => names compare case-sensitive.
bool supports_sync
true => an explicit software sync op exists.
uint16_t max_name_len
Max UTF-8 bytes in one name, excluding NUL.
bool supports_timestamps
true => stat reports entry timestamps.
bool unicode_names
true => public names are strict UTF-8.
bool supports_free_space
true => a cheap free-space query exists.
bool supports_streaming_write
true => open-for-write streaming.
Complete filesystem-format dispatch surface used by the VFS.
ra8_io_fsfmt_space_fn_t free_space
Query free/total bytes.
ra8_io_fsfmt_mount_fn_t mount
Bind a block backend.
ra8_io_fsfmt_seek_fn_t seek
Set stream offset.
ra8_io_fsfmt_listdir_fn_t listdir
Enumerate a directory.
ra8_io_fsfmt_path_fn_t mkdir
Create a directory.
ra8_io_fsfmt_tell_fn_t tell
Query stream offset.
ra8_io_fsfmt_probe_fn_t probe
Recognise an on-disk volume.
ra8_io_fsfmt_size_fn_t size
Query stream size.
ra8_io_fsfmt_close_fn_t close
Close a file stream.
ra8_io_fsfmt_read_fn_t read
Read stream bytes.
ra8_io_fsfmt_path_fn_t rmdir
Remove an empty directory.
ra8_io_fsfmt_sync_fn_t sync
Flush software state, when supported.
ra8_io_fsfmt_open_fn_t open
Open a file stream.
ra8_io_fsfmt_dir_open_fn_t dir_open
Open incremental directory cursor.
ra8_io_fsfmt_stat_fn_t stat
Query path metadata.
ra8_io_fsfmt_dir_next_fn_t dir_next
Copy next cursor entry.
ra8_io_fsfmt_rename_fn_t rename
Rename within the mount.
ra8_io_fsfmt_unmount_fn_t unmount
Release a mounted context.
ra8_io_fsfmt_path_fn_t unlink
Remove a plain file.
ra8_io_fsfmt_dir_close_fn_t dir_close
Close incremental directory cursor.
One registered filesystem format.
const char * name
Short format name, e.g.
ra8_io_fsfmt_caps_t caps
What the format supports.
const ra8_io_fsfmt_ops_t * ops
Runtime dispatch table.