|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Module-private mount-slot layout and path resolvers for the ra8_io VFS. More...
#include <stdint.h>#include "ra8_attributes.h"#include "ra8_err.h"#include "ra8_io_fsfmt.h"#include "ra8_io_vfs.h"Go to the source code of this file.
Data Structures | |
| struct | vfs_slot_t |
| One fixed named-mount slot. More... | |
Functions | |
| ra8_err_t | ra8_io_vfs_init_slot_test (vfs_slot_t *slot) |
| Test-only entry point for internal_vfs_init_slot(). | |
| 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_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. | |
Module-private mount-slot layout and path resolvers for the ra8_io VFS.
The named-mount dispatcher is implemented by two translation units. The mount table, its fixed storage, and the open-stream facade live in ra8_io_vfs.c; the path-namespace operations (removal, rename, metadata, listing, directory cursors, and directory creation) live in ra8_io_vfs_namespace.c. Both need the fixed slot layout and the bounded name/path resolvers declared here.
The mount and open-file tables themselves stay private to ra8_io_vfs.c: the namespace unit reaches a mount only through priv_ra8_io_vfs_find and priv_ra8_io_vfs_resolve, so there is exactly one owner of that state.
Definition in file ra8_io_vfs_internal.h.
| 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().
| ra8_err_t ra8_io_vfs_init_slot_test | ( | vfs_slot_t * | slot | ) |
Test-only entry point for internal_vfs_init_slot().
Exists so the reset-and-conditionally-unmount decision can be driven directly against a caller-built vfs_slot_t, without routing through ra8_io_vfs_mount / ra8_io_vfs_mount_auto to reach every in_use / owned combination.
| [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. 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.