|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Named-mount VFS dispatch over pluggable filesystem-format operations. More...
#include "ra8_io_vfs.h"#include <stdint.h>#include "ra8_attributes.h"#include "ra8_check.h"#include "ra8_err.h"#include "ra8_fs.h"#include "ra8_io_fsfmt.h"#include "ra8_io_vfs_internal.h"Go to the source code of this file.
Data Structures | |
| struct | ra8_io_vfs_file |
| Publicly opaque stream facade, drawn from s_files. More... | |
Functions | |
| bool | priv_ra8_io_vfs_streq (const char *a, const char *b) |
| Compare two mount names within the fixed bound. | |
| static bool | internal_name_ok (const char *name) |
| Validate a non-empty bounded mount name with no path separators. | |
| static void | internal_copy_name (char *dst, const char *src) |
| Copy one already-validated mount name into a fixed slot. | |
| 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. | |
| static vfs_slot_t * | internal_free_mount (void) |
| Find one free mount slot. | |
| 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. | |
| 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. | |
| static bool | internal_is_native (const ra8_io_fsfmt_t *format) |
| Test whether a descriptor is one of the native ra8_fs built-ins. | |
| static void | internal_store_mount (vfs_slot_t *slot, const char *name, const ra8_io_fsfmt_t *format, void *mount_ctx, bool owned) |
| Populate a previously selected free mount slot. | |
| static bool | internal_mode_valid (ra8_fs_mode_t mode) |
| Test whether a value is one of the three public stream modes. | |
| static ra8_err_t | internal_can_open (const ra8_io_fsfmt_t *format, ra8_fs_mode_t mode) |
| Capability-gate a requested open mode. | |
| static ra8_io_vfs_file_t * | internal_free_file (void) |
| Find one free generic-file facade. | |
| static bool | internal_file_valid (const ra8_io_vfs_file_t *file) |
| Verify a facade is currently owned by the fixed file table. | |
| static ra8_err_t | internal_vfs_init_slot (vfs_slot_t *slot) |
| Reset one mount slot for global reinit, unmounting it first if owned. | |
| ra8_err_t | ra8_io_vfs_init_slot_test (vfs_slot_t *slot) |
| Implementation of ra8_io_vfs_init_slot_test(). | |
| ra8_err_t | ra8_io_vfs_init (void) |
| Reset the VFS mount table to empty. | |
| ra8_err_t | ra8_io_vfs_mount (const char *name, ra8_fs_mount_t *mount) |
| Register a mounted volume under a name. | |
| static ra8_err_t | internal_vfs_probe_and_mount (const ra8_fs_backend_t *backend, const ra8_io_fsfmt_t **out_format, void **out_mount_ctx) |
| Probe a backend's format and mount it through that format, guarded. | |
| ra8_err_t | ra8_io_vfs_mount_auto (const char *name, const ra8_fs_backend_t *backend) |
| Probe and mount a block backend through the registered format ops. | |
| ra8_err_t | ra8_io_vfs_unmount (const char *name) |
| Remove a named mount from the table. | |
| static ra8_err_t | internal_vfs_open_resolve (const char *path, ra8_fs_mode_t mode, vfs_slot_t **out_slot, const char **out_sub) |
| Resolve a raw-open path and require the target format be native. | |
| ra8_err_t | ra8_io_vfs_open (const char *path, ra8_fs_mode_t mode, ra8_fs_file_t **out_file) |
| Open a file by "name:/path". | |
| static ra8_err_t | internal_vfs_file_open_resolve (const char *path, ra8_fs_mode_t mode, vfs_slot_t **out_slot, uint8_t *out_index, const char **out_sub) |
Resolve a facade-open path and require the format support mode. | |
| ra8_err_t | ra8_io_vfs_file_open (const char *path, ra8_fs_mode_t mode, ra8_io_vfs_file_t **out_file) |
| Open a format-neutral stream through a mounted format's ops. | |
| ra8_err_t | ra8_io_vfs_file_close (ra8_io_vfs_file_t *file) |
| Close and always release one format-neutral stream facade. | |
| ra8_err_t | ra8_io_vfs_file_read (ra8_io_vfs_file_t *file, void *buf, uint32_t bytes, uint32_t *out_read) |
| Read bytes through a format-neutral stream. | |
| ra8_err_t | ra8_io_vfs_file_write (ra8_io_vfs_file_t *file, const void *buf, uint32_t bytes) |
| Write bytes, or return not-supported when capability-gated. | |
| ra8_err_t | ra8_io_vfs_file_seek (ra8_io_vfs_file_t *file, uint64_t offset_bytes) |
| Seek a format-neutral stream. | |
| ra8_err_t | ra8_io_vfs_file_tell (const ra8_io_vfs_file_t *file, uint64_t *out_offset) |
| Report a format-neutral stream's current offset. | |
| ra8_err_t | ra8_io_vfs_file_size (const ra8_io_vfs_file_t *file, uint64_t *out_bytes) |
| Report a format-neutral stream's size. | |
| ra8_err_t | ra8_io_vfs_file_sync (ra8_io_vfs_file_t *file) |
| Explicitly sync a stream, or return not-supported when unavailable. | |
| ra8_err_t | ra8_io_vfs_get_caps (const char *name, ra8_io_fsfmt_caps_t *out) |
| Copy the truthful capabilities of a named mounted format. | |
| ra8_err_t | ra8_io_vfs_free_space (const char *name, ra8_fs_space_t *out) |
| Query free and total bytes through a mounted format's ops. | |
Variables | |
| static const char *const | s_tag = "ra8_io_vfs" |
| Module log tag. | |
| static vfs_slot_t | s_table [(uint32_t) k_ra8_io_vfs_max_mounts] |
| Fixed mount table. | |
| static ra8_io_vfs_file_t | s_files [(uint32_t) k_ra8_io_vfs_max_files] |
| Fixed format-neutral open-file table. | |
Named-mount VFS dispatch over pluggable filesystem-format operations.
Fixed mount and file tables route "name:/path" requests through the selected ra8_io_fsfmt_ops_t. A legacy native ra8_fs mount and an automatically probed foreign mount therefore share one namespace path. All storage is static and all capability failures are explicit.
Definition in file ra8_io_vfs.c.
|
static |
Capability-gate a requested open mode.
Read is universal; writes require a writable streaming implementation.
| [in] | format | Selected format descriptor. |
| [in] | mode | Requested mode. |
| k_ra8_ok | The mode may be dispatched. |
| k_ra8_err_invalid_arg | The mode is invalid. |
| k_ra8_err_not_supported | The format cannot provide the mode. |
format and format->ops are non-NULL. Definition at line 299 of file ra8_io_vfs.c.
References internal_mode_valid(), k_ra8_err_invalid_arg, k_ra8_err_not_supported, k_ra8_fs_mode_read, and k_ra8_ok.
Referenced by internal_vfs_file_open_resolve(), and internal_vfs_open_resolve().
|
static |
Copy one already-validated mount name into a fixed slot.
Performs a bounded copy and always terminates the destination.
| [out] | dst | Fixed destination buffer. |
| [in] | src | Validated source name. |
dst and src are non-NULL. dst has VFS-name capacity and src terminates within that capacity. dst contains a NUL-terminated copy. Definition at line 108 of file ra8_io_vfs.c.
References k_ra8_io_vfs_name_max.
Referenced by internal_store_mount().
|
static |
Verify a facade is currently owned by the fixed file table.
Rejects NULL, foreign pointers, and released facade slots.
| [in] | file | Candidate facade. |
| true | Pointer names a live table entry. |
| false | Pointer is NULL, foreign, or released. |
file may be any pointer value supplied by a caller. Definition at line 358 of file ra8_io_vfs.c.
References k_ra8_io_vfs_max_files, and s_files.
Referenced by ra8_io_vfs_file_close(), ra8_io_vfs_file_read(), ra8_io_vfs_file_seek(), ra8_io_vfs_file_size(), ra8_io_vfs_file_sync(), ra8_io_vfs_file_tell(), and ra8_io_vfs_file_write().
|
static |
Find one free generic-file facade.
Searches the fixed file table in ascending slot order.
| non-NULL | First free facade. |
| NULL | The facade table is full. |
Definition at line 333 of file ra8_io_vfs.c.
References k_ra8_io_vfs_max_files, and s_files.
Referenced by ra8_io_vfs_file_open().
|
static |
Find one free mount slot.
Searches the fixed mount table in ascending slot order.
| non-NULL | First free slot. |
| NULL | The table is full. |
Definition at line 150 of file ra8_io_vfs.c.
References k_ra8_io_vfs_max_mounts, and s_table.
Referenced by ra8_io_vfs_mount(), and ra8_io_vfs_mount_auto().
|
static |
Test whether a descriptor is one of the native ra8_fs built-ins.
Compares descriptor identity against the FAT and exFAT built-ins.
| [in] | format | Candidate descriptor. |
| true | Descriptor uses native ra8_fs contexts. |
| false | Descriptor is foreign. |
format is non-NULL. Definition at line 214 of file ra8_io_vfs.c.
References k_ra8_fs_type_exfat, k_ra8_fs_type_fat16, and ra8_io_fsfmt_get_builtin().
Referenced by internal_store_mount().
|
static |
Test whether a value is one of the three public stream modes.
Accepts read, write, and append only.
| [in] | mode | Candidate mode. |
| true | Mode is supported by the API vocabulary. |
| false | Mode is outside the enum's defined values. |
mode is an arbitrary value representable by its enum type. mode. Definition at line 271 of file ra8_io_vfs.c.
References k_ra8_fs_mode_append, k_ra8_fs_mode_read, and k_ra8_fs_mode_write.
Referenced by internal_can_open().
|
static |
Validate a non-empty bounded mount name with no path separators.
Rejects empty, unterminated, colon-bearing, and slash-bearing names.
| [in] | name | Candidate name. |
| true | Name is valid. |
| false | Name is invalid. |
name is non-NULL. name addresses readable memory through its terminator or the bound. Definition at line 73 of file ra8_io_vfs.c.
References k_ra8_io_vfs_name_max.
Referenced by ra8_io_vfs_mount(), and ra8_io_vfs_mount_auto().
|
static |
Populate a previously selected free mount slot.
Copies the name and records format, context, ownership, and native status.
| [out] | slot | Free mount slot. |
| [in] | name | Validated mount name. |
| [in] | format | Selected format descriptor. |
| [in,out] | mount_ctx | Format-private mounted context. |
| [in] | owned | Whether VFS must invoke unmount. |
slot is free and name fits the fixed name buffer. slot is occupied and resolves under name. Definition at line 242 of file ra8_io_vfs.c.
References vfs_slot_t::format, vfs_slot_t::in_use, internal_copy_name(), internal_is_native(), vfs_slot_t::mount_ctx, vfs_slot_t::name, vfs_slot_t::native, and vfs_slot_t::owned.
Referenced by ra8_io_vfs_mount(), and ra8_io_vfs_mount_auto().
|
static |
Resolve a facade-open path and require the format support mode.
Reuses priv_ra8_io_vfs_resolve to locate the mount, sub-path, and mount-table index, then requires the format to support mode.
| [in] | path | Full VFS path to resolve. |
| [in] | mode | Requested open mode. |
| [out] | out_slot | Resolved mount slot on success. |
| [out] | out_index | Resolved mount-table index on success. |
| [out] | out_sub | Sub-path within the mount on success. |
| k_ra8_ok | out_slot, out_index, and out_sub are all valid. |
| k_ra8_err_not_found | No mount matches the resolved name. |
| k_ra8_err_not_supported | The mount's format does not support mode. |
path, out_slot, out_index, and out_sub are non-NULL. mode is the mode the caller will hand to the format's open. out_index names the same slot as out_slot. Definition at line 585 of file ra8_io_vfs.c.
References internal_can_open(), k_ra8_ok, priv_ra8_io_vfs_resolve(), RA8_INTERNAL, RA8_RETURN_ON_ERROR, and s_tag.
Referenced by ra8_io_vfs_file_open().
|
static |
Reset one mount slot for global reinit, unmounting it first if owned.
Unmounts through the bound format only when the slot is both in use and owned by the VFS (a caller-supplied mount is never unmounted here), then always clears the slot.
| [in,out] | slot | Mount slot to tear down and reset. |
| k_ra8_ok | The slot was already idle, borrowed, or unmounted cleanly. |
| other | The bound format's unmount reported a failure. |
slot is non-NULL. slot is zero-initialized. Definition at line 387 of file ra8_io_vfs.c.
References vfs_slot_t::format, vfs_slot_t::in_use, k_ra8_ok, vfs_slot_t::mount_ctx, vfs_slot_t::owned, and RA8_INTERNAL.
Referenced by ra8_io_vfs_init(), and ra8_io_vfs_init_slot_test().
|
static |
Resolve a raw-open path and require the target format be native.
Reuses priv_ra8_io_vfs_resolve to locate the mount and sub-path, then requires the mount's format to hand back a native handle, then requires the format to support mode.
| [in] | path | Full VFS path to resolve. |
| [in] | mode | Requested open mode. |
| [out] | out_slot | Resolved mount slot on success. |
| [out] | out_sub | Sub-path within the mount on success. |
| k_ra8_ok | out_slot and out_sub are both valid for a raw open. |
| k_ra8_err_not_found | No mount matches the resolved name. |
| k_ra8_err_not_supported | The mount's format has no native handle, or does not support mode. |
path, out_slot, and out_sub are non-NULL. mode is the mode the caller will hand to the format's open. Definition at line 534 of file ra8_io_vfs.c.
References internal_can_open(), k_ra8_err_not_supported, k_ra8_ok, priv_ra8_io_vfs_resolve(), RA8_INTERNAL, RA8_RETURN_ON_ERROR, and s_tag.
Referenced by ra8_io_vfs_open().
|
static |
Probe a backend's format and mount it through that format, guarded.
Wraps the two format-layer calls each already guarded by RA8_RETURN_ON_ERROR so their expansion is counted against a dedicated frame rather than the caller's.
| [in] | backend | Candidate raw storage backend to probe and mount. |
| [out] | out_format | Probed format on success. |
| [out] | out_mount_ctx | Opaque mount context on success. |
| k_ra8_ok | out_format and out_mount_ctx are both valid. |
| other | The probe or the mount call failed; both outputs are indeterminate. |
backend, out_format, and out_mount_ctx are non-NULL. backend. Definition at line 457 of file ra8_io_vfs.c.
References k_ra8_ok, RA8_INTERNAL, ra8_io_fsfmt_probe(), RA8_RETURN_ON_ERROR, and s_tag.
Referenced by ra8_io_vfs_mount_auto().
| 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.
Searches the fixed mount table in ascending slot order.
| [in] | name | Valid mount name. |
| [out] | out_index | Optional slot-index destination. |
| non-NULL | Occupied matching slot. |
| NULL | No slot matched. |
name is non-NULL and bounded. out_index is NULL or writable. Definition at line 120 of file ra8_io_vfs.c.
References k_ra8_io_vfs_max_mounts, priv_ra8_io_vfs_streq(), RA8_PRIV, and s_table.
Referenced by priv_ra8_io_vfs_resolve(), ra8_io_vfs_free_space(), ra8_io_vfs_get_caps(), ra8_io_vfs_mount(), ra8_io_vfs_mount_auto(), ra8_io_vfs_rename(), and ra8_io_vfs_unmount().
| 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.
Splits the prefix then looks up the named fixed-table slot.
| [in] | path | Qualified VFS path. |
| [out] | out_slot | Receives the mounted slot. |
| [out] | out_index | Optional slot-index destination. |
| [out] | out_sub | Receives the volume-relative sub-path. |
| k_ra8_ok | Mount resolved. |
| k_ra8_err_not_found | Name is not mounted. |
| k_ra8_err_invalid_arg | Path cannot be split. |
path, out_slot, and out_sub are non-NULL. out_index is NULL or writable. Definition at line 181 of file ra8_io_vfs.c.
References k_ra8_err_not_found, k_ra8_io_vfs_name_max, k_ra8_ok, priv_ra8_io_vfs_find(), priv_ra8_io_vfs_split(), and RA8_PRIV.
Referenced by internal_vfs_file_open_resolve(), internal_vfs_open_resolve(), ra8_io_vfs_dir_open(), ra8_io_vfs_dir_requirements(), ra8_io_vfs_listdir(), ra8_io_vfs_mkdir(), ra8_io_vfs_rmdir(), ra8_io_vfs_stat(), and ra8_io_vfs_unlink().
| 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.
Finds the colon within the name bound and copies only the prefix.
| [in] | path | Qualified VFS path. |
| [out] | out_name | Fixed mount-name buffer. |
| [out] | out_sub | Receives a pointer after the colon. |
| k_ra8_ok | Path split. |
| k_ra8_err_invalid_arg | No bounded colon exists. |
out_name has VFS-name capacity. Definition at line 160 of file ra8_io_vfs.c.
References k_ra8_err_invalid_arg, k_ra8_io_vfs_name_max, k_ra8_ok, and RA8_PRIV.
Referenced by internal_vfs_rename_split(), and priv_ra8_io_vfs_resolve().
| bool priv_ra8_io_vfs_streq | ( | const char * | a, |
| const char * | b ) |
Compare two mount names within the fixed bound.
Stops at the first mismatch or shared terminator.
| [in] | a | First name. |
| [in] | b | Second name. |
| true | Names are equal. |
| false | Names differ. |
a and b are non-NULL. Definition at line 45 of file ra8_io_vfs.c.
References k_ra8_io_vfs_name_max, and RA8_PRIV.
Referenced by internal_vfs_rename_split(), and priv_ra8_io_vfs_find().
|
nodiscard |
Close and always release one format-neutral stream facade.
Definition at line 625 of file ra8_io_vfs.c.
References internal_file_valid(), k_ra8_err_invalid_state, RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_close_writer(), and internal_rabook_close().
|
nodiscard |
Open a format-neutral stream through a mounted format's ops.
Unlike the legacy ra8_io_vfs_open native-handle adapter, this API works for every registered format. The facade comes from a fixed static pool; no heap allocation occurs.
| [in] | path | "name:/path" string. |
| [in] | mode | Read, write, or append. |
| [out] | out_file | Opaque VFS stream on success. |
| k_ra8_ok | Stream opened. |
| k_ra8_err_not_supported | The format is read-only or lacks the mode. |
| k_ra8_err_no_mem | The fixed stream table is full. |
| k_ra8_err_* | Resolution or format error. |
Definition at line 598 of file ra8_io_vfs.c.
References vfs_slot_t::format, internal_free_file(), internal_vfs_file_open_resolve(), k_ra8_err_no_mem, k_ra8_ok, vfs_slot_t::mount_ctx, RA8_CHECK_NULL_PTR, RA8_RETURN_ON_ERROR, and s_tag.
Referenced by internal_begin(), and internal_rabook_open_reader().
|
nodiscard |
Read bytes through a format-neutral stream.
Definition at line 637 of file ra8_io_vfs.c.
References internal_file_valid(), k_ra8_err_invalid_state, RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_rabook_read_exact().
|
nodiscard |
Seek a format-neutral stream.
Definition at line 667 of file ra8_io_vfs.c.
References internal_file_valid(), k_ra8_err_invalid_state, RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_rabook_read_exact().
|
nodiscard |
Report a format-neutral stream's size.
Definition at line 686 of file ra8_io_vfs.c.
References internal_file_valid(), k_ra8_err_invalid_state, RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_rabook_open_reader().
|
nodiscard |
Explicitly sync a stream, or return not-supported when unavailable.
Definition at line 696 of file ra8_io_vfs.c.
References internal_file_valid(), k_ra8_err_invalid_state, k_ra8_err_not_supported, RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_close_writer().
|
nodiscard |
Report a format-neutral stream's current offset.
Definition at line 676 of file ra8_io_vfs.c.
References internal_file_valid(), k_ra8_err_invalid_state, RA8_CHECK_NULL_PTR, and s_tag.
|
nodiscard |
Write bytes, or return not-supported when capability-gated.
Definition at line 648 of file ra8_io_vfs.c.
References internal_file_valid(), k_ra8_err_invalid_state, k_ra8_err_not_supported, RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_write().
|
nodiscard |
Query free and total bytes through a mounted format's ops.
| [in] | name | Mount name without a colon. |
| [out] | out | Space snapshot. |
| k_ra8_err_not_supported | The format lacks a free-space operation. |
Definition at line 723 of file ra8_io_vfs.c.
References vfs_slot_t::format, k_ra8_err_not_found, k_ra8_err_not_supported, vfs_slot_t::mount_ctx, priv_ra8_io_vfs_find(), RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_space().
|
nodiscard |
Copy the truthful capabilities of a named mounted format.
| [in] | name | Mount name without a colon. |
| [out] | out | Capability snapshot. |
| k_ra8_ok | Capabilities copied. |
| k_ra8_err_not_found | No mount has that name. |
Definition at line 711 of file ra8_io_vfs.c.
References vfs_slot_t::format, k_ra8_err_not_found, k_ra8_ok, priv_ra8_io_vfs_find(), RA8_CHECK_NULL_PTR, and s_tag.
|
nodiscard |
Reset the VFS mount table to empty.
| k_ra8_ok | All mount slots released. |
Definition at line 403 of file ra8_io_vfs.c.
References internal_vfs_init_slot(), k_ra8_io_vfs_max_files, k_ra8_io_vfs_max_mounts, k_ra8_ok, s_files, and s_table.
Referenced by internal_mount_sd(), internal_sd_demo_roundtrip(), and sdhi_demo_mount_via_io().
| ra8_err_t ra8_io_vfs_init_slot_test | ( | vfs_slot_t * | slot | ) |
Implementation of ra8_io_vfs_init_slot_test().
Test-only entry point for internal_vfs_init_slot().
Definition at line 398 of file ra8_io_vfs.c.
References internal_vfs_init_slot(), and RA8_TEST_HELPER.
|
nodiscard |
Register a mounted volume under a name.
| [in] | name | Mount name (1..15 chars, no : or /). |
| [in] | mount | Live ra8_fs_mount_t (must out-live the registration). |
| k_ra8_ok | Volume registered. |
| k_ra8_err_null_ptr | name or mount was NULL. |
| k_ra8_err_invalid_arg | Name empty or too long. |
| k_ra8_err_exists | The name is already mounted. |
| k_ra8_err_no_mem | The mount table is full. |
Definition at line 418 of file ra8_io_vfs.c.
References internal_free_mount(), internal_name_ok(), internal_store_mount(), k_ra8_err_exists, k_ra8_err_invalid_arg, k_ra8_err_no_mem, k_ra8_ok, priv_ra8_io_vfs_find(), RA8_CHECK_NULL_PTR, ra8_io_fsfmt_get_builtin(), RA8_RETURN_ON_ERROR, s_tag, and ra8_fs_mount_t::type.
Referenced by internal_demo_mount(), internal_demo_mount(), internal_mount_sd(), internal_ra8_io_roundtrip_format_mount(), internal_swap_run_one(), ra8_io_roundtrip_mount(), and sdhi_demo_mount_via_io().
|
nodiscard |
Probe and mount a block backend through the registered format ops.
| [in] | name | Mount name (1..15 chars, no : or /). |
| [in] | backend | Device-neutral block backend to probe and mount. |
| k_ra8_ok | A registered format claimed and mounted the volume. |
| k_ra8_err_null_ptr | An argument was NULL. |
| k_ra8_err_invalid_arg | The mount name was invalid. |
| k_ra8_err_exists | The name is already mounted. |
| k_ra8_err_no_mem | The fixed mount table is full. |
| k_ra8_err_not_found | No registered format claimed the volume. |
| k_ra8_err_* | The selected format's mount error. |
Definition at line 466 of file ra8_io_vfs.c.
References internal_free_mount(), internal_name_ok(), internal_store_mount(), internal_vfs_probe_and_mount(), k_ra8_err_exists, k_ra8_err_invalid_arg, k_ra8_err_no_mem, k_ra8_ok, priv_ra8_io_vfs_find(), RA8_CHECK_NULL_PTR, and s_tag.
|
nodiscard |
Open a file by "name:/path".
| [in] | path | "name:/path" string. |
| [in] | mode | Open mode (read / write / append). |
| [out] | out_file | Populated file handle on success. |
| k_ra8_ok | File opened. |
| k_ra8_err_null_ptr | path or out_file was NULL. |
| k_ra8_err_invalid_arg | path has no name: prefix. |
| k_ra8_err_not_found | The mount name or the file is absent. |
| k_ra8_err_* | Propagated from ra8_fs_open. |
Definition at line 547 of file ra8_io_vfs.c.
References vfs_slot_t::format, internal_vfs_open_resolve(), k_ra8_ok, vfs_slot_t::mount_ctx, RA8_CHECK_NULL_PTR, RA8_RETURN_ON_ERROR, and s_tag.
Referenced by internal_demo_read_once(), internal_open(), internal_ra8_io_roundtrip_read_verify(), internal_ra8_io_roundtrip_write_subdir(), internal_ra8_vfs_compress_load_blob(), internal_ra8_vfs_compress_store_blob(), internal_swap_vfs_read_verify(), internal_swap_vfs_write(), ra8_io_roundtrip_read_verify(), ra8_io_roundtrip_subdir_file(), sdhi_demo_read_and_verify(), and sdhi_demo_write_payload().
|
nodiscard |
Remove a named mount from the table.
| [in] | name | Mount name to release. |
| k_ra8_ok | Mount released. |
| k_ra8_err_null_ptr | name was NULL. |
| k_ra8_err_not_found | The name was not mounted. |
Definition at line 490 of file ra8_io_vfs.c.
References vfs_slot_t::format, k_ra8_err_busy, k_ra8_err_not_found, k_ra8_io_vfs_max_files, k_ra8_ok, vfs_slot_t::mount_ctx, vfs_slot_t::owned, priv_ra8_io_vfs_find(), RA8_CHECK_NULL_PTR, s_files, and s_tag.
Referenced by internal_swap_run_one().
|
static |
Fixed format-neutral open-file table.
Definition at line 43 of file ra8_io_vfs.c.
|
static |
Fixed mount table.
Definition at line 41 of file ra8_io_vfs.c.
Referenced by internal_bind_transfer(), internal_free_mount(), priv_ra8_io_vfs_find(), and ra8_io_vfs_init().
|
static |
Module log tag.
Definition at line 30 of file ra8_io_vfs.c.