36static const char*
const s_tag =
"ra8_io_vfs_namespace";
42 const char* sub =
nullptr;
44 if (slot->
format->caps.read_only) {
47 if (slot->
format->ops->unlink ==
nullptr) {
81 const char** out_old_sub,
82 const char** out_new_sub)
98 const char* old_sub =
nullptr;
99 const char* new_sub =
nullptr;
106 if (slot ==
nullptr) {
109 if (slot->
format->caps.read_only) {
112 if (slot->
format->ops->rename ==
nullptr) {
124 const char* sub =
nullptr;
149 const char* sub =
nullptr;
157 uint16_t* out_max_open)
159 if ((path ==
nullptr) || (out_bytes ==
nullptr) || (out_align ==
nullptr) ||
160 (out_max_open ==
nullptr)) {
167 const char* sub =
nullptr;
173 if (!slot->
format->caps.supports_dir_cursor) {
176 *out_bytes = slot->
format->caps.directory_workspace_bytes;
177 *out_align = slot->
format->caps.directory_workspace_align;
178 *out_max_open = slot->
format->caps.max_open_directories;
185 uint32_t workspace_bytes)
187 if ((path ==
nullptr) || (directory ==
nullptr) || (workspace ==
nullptr)) {
194 const char* sub =
nullptr;
203 if (workspace_bytes < caps->directory_workspace_bytes) {
210 slot->
format->ops->dir_open(slot->
mount_ctx, sub, workspace, workspace_bytes);
216 .state_bytes = workspace_bytes,
223 if ((directory ==
nullptr) || (out ==
nullptr) || (out_entry ==
nullptr)) {
231 return directory->
format->ops->dir_next(directory->
state, out, out_entry);
236 if (directory ==
nullptr) {
251 const char* sub =
nullptr;
253 if (slot->
format->caps.read_only) {
256 if (!slot->
format->caps.supports_mkdir) {
259 if (slot->
format->ops->mkdir ==
nullptr) {
269 const char* sub =
nullptr;
271 if (slot->
format->caps.read_only) {
274 if (!slot->
format->caps.supports_rmdir) {
277 if (slot->
format->ops->rmdir ==
nullptr) {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_not_supported
Requested feature not compiled in, not wired, or not supported by this MCU variant.
@ k_ra8_err_no_mem
Static buffer exhausted (no dynamic memory on this project).
@ k_ra8_err_busy
Resource busy – blocking operation cannot proceed.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
@ k_ra8_err_not_found
Requested item not found (lookup / search missed).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
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 pluggable filesystem-format registry (probe + capabilities).
ra8_err_t priv_ra8_io_vfs_resolve(const char *path, vfs_slot_t **out_slot, uint8_t *out_index, const char **out_sub)
Resolve "name:sub" to a mount slot and sub-path.
ra8_err_t priv_ra8_io_vfs_split(const char *path, char *out_name, const char **out_sub)
Split "name:sub" into a bounded name and sub-path pointer.
bool priv_ra8_io_vfs_streq(const char *a, const char *b)
Compare two mount names within the fixed bound.
vfs_slot_t * priv_ra8_io_vfs_find(const char *name, uint8_t *out_index)
Find an occupied mount slot by name and optionally report its index.
ra8_io virtual filesystem – mount many volumes, address them by name.
@ k_ra8_io_vfs_name_max
Mount name length incl NUL.
Module-private mount-slot layout and path resolvers for the ra8_io VFS.
ra8_err_t ra8_io_vfs_dir_requirements(const char *path, uint32_t *out_bytes, uint8_t *out_align, uint16_t *out_max_open)
Query cursor workspace requirements for a qualified directory path.
ra8_err_t ra8_io_vfs_listdir(const char *path, ra8_fs_listdir_cb_t cb, void *ctx)
Enumerate a directory named "name:/path".
ra8_err_t ra8_io_vfs_dir_next(ra8_io_vfs_dir_t *directory, ra8_fs_dirent_t *out, bool *out_entry)
Copy one stable entry or report clean end-of-directory.
ra8_err_t ra8_io_vfs_mkdir(const char *path)
Create a directory named "name:/path".
ra8_err_t ra8_io_vfs_unlink(const char *path)
Delete a file by "name:/path".
ra8_err_t ra8_io_vfs_dir_close(ra8_io_vfs_dir_t *directory)
Close and consume one caller-owned VFS directory cursor.
ra8_err_t ra8_io_vfs_stat(const char *path, ra8_io_vfs_stat_t *out)
Query metadata for "name:/path".
ra8_err_t ra8_io_vfs_rmdir(const char *path)
Remove the empty directory named "name:/path".
ra8_err_t ra8_io_vfs_dir_open(const char *path, ra8_io_vfs_dir_t *directory, void *workspace, uint32_t workspace_bytes)
Open a format-neutral incremental directory cursor.
static ra8_err_t internal_vfs_rename_split(const char *old_path, const char *new_path, char *old_name, char *new_name, const char **out_old_sub, const char **out_new_sub)
Split both rename paths and require them to name the same mount.
ra8_err_t ra8_io_vfs_rename(const char *old_path, const char *new_path)
Rename a file within one mount.
Stable directory-entry value copied by ra8_fs_dir_next.
What ra8_fs_stat() read out of a directory entry.
ra8_fs_timestamp_t accessed
Last-accessed timestamp (date-only on FAT).
uint8_t attr
The entry's own FAT attribute byte.
uint64_t size_bytes
File length in bytes; 0 for a directory.
ra8_fs_timestamp_t modified
Last-modified timestamp.
bool is_directory
true => the ATTR_DIRECTORY bit is set.
ra8_fs_timestamp_t created
Creation timestamp, or invalid for the root.
What a filesystem format supports.
bool supports_dir_cursor
true => incremental directory cursor exists.
uint8_t directory_workspace_align
Required cursor-workspace alignment.
Caller-owned format-neutral directory cursor.
void * state
Caller-supplied format state.
bool is_open
VFS lifecycle guard.
const ra8_io_fsfmt_t * format
Format owning the cursor state.
Metadata returned by ra8_io_vfs_stat.
uint8_t attr
The entry's own FAT attribute byte.
uint64_t size_bytes
File size in bytes (0 for directories).
ra8_fs_timestamp_t modified
Last-modified time, when present.
bool is_directory
true => path names a directory.
ra8_fs_timestamp_t accessed
Last-accessed time/date, when present.
ra8_fs_timestamp_t created
Creation time, when present.
bool exists
true => the path resolves to an entry.
One fixed named-mount slot.
void * mount_ctx
Format-private mounted context.
const ra8_io_fsfmt_t * format
Selected format descriptor.