|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Guarded incremental-directory dispatch for portable filesystem ports. More...
#include <stddef.h>#include <stdint.h>#include <string.h>#include "fw_if_fs.h"#include "fw_if_fs_backend.h"#include "ra8_attributes.h"#include "ra8_err.h"Go to the source code of this file.
Functions | |
| static ra8_err_t | internal_cursor_names (const fw_fs_namespace_t *names) |
| Validate one namespace facade used for cursor dispatch. | |
| static ra8_err_t | internal_cursor_workspace (void *workspace, uint32_t bytes, uint32_t need, uint8_t align) |
| Validate cursor workspace size and alignment. | |
| static ra8_err_t | internal_cursor_handle (const fw_fs_dir_t *directory) |
| Validate an open directory cursor before dispatch. | |
| static ra8_err_t | internal_cursor_entry (const fw_fs_caps_t *caps, const fw_fs_dirent_value_t *entry) |
| Validate one backend-produced stable directory value. | |
| ra8_err_t | fw_fs_dir_open (const fw_fs_namespace_t *names, const char *path, fw_fs_dir_t *directory, void *workspace, uint32_t workspace_size) |
| Open one directory cursor into caller-owned backend workspace. | |
| ra8_err_t | fw_fs_dir_next (fw_fs_dir_t *directory, fw_fs_dirent_value_t *out, bool *out_entry) |
| Copy one stable directory entry from an open cursor. | |
| ra8_err_t | fw_fs_dir_close (fw_fs_dir_t *directory) |
| Close and consume an open directory cursor, including on close error. | |
Guarded incremental-directory dispatch for portable filesystem ports.
Validates caller-owned cursor storage, lifecycle, and stable copied directory values before returning them to domain code.
Definition in file fw_if_fs_dir.c.
|
nodiscard |
Close and consume an open directory cursor, including on close error.
Definition at line 217 of file fw_if_fs_dir.c.
References fw_fs_dir_t::ctx, fw_fs_namespace_iface::dir_close, fw_fs_dir_t::iface, internal_cursor_handle(), k_ra8_ok, and fw_fs_dir_t::state.
Referenced by internal_library_close(), internal_list_pages(), internal_verify_artifacts(), and internal_verify_library_root().
|
nodiscard |
Copy one stable directory entry from an open cursor.
No backend lock remains held after return. A clean end reports *out_entry == false and a zeroed out value.
Definition at line 190 of file fw_if_fs_dir.c.
References fw_fs_dir_t::caps, fw_fs_dir_t::ctx, fw_fs_namespace_iface::dir_next, fw_fs_dir_t::iface, internal_cursor_entry(), internal_cursor_handle(), k_ra8_err_null_ptr, k_ra8_ok, and fw_fs_dir_t::state.
Referenced by internal_library_enumerate(), internal_library_first_child(), internal_list_pages(), internal_verify_artifacts(), and internal_verify_library_root().
|
nodiscard |
Open one directory cursor into caller-owned backend workspace.
Definition at line 150 of file fw_if_fs_dir.c.
References fw_fs_namespace_t::caps, fw_fs_namespace_t::ctx, fw_fs_namespace_iface::dir_open, fw_fs_caps_t::directory_workspace_align, fw_fs_caps_t::directory_workspace_bytes, fw_fs_path_validate(), fw_fs_namespace_t::iface, internal_cursor_names(), internal_cursor_workspace(), fw_fs_dir_t::is_open, k_ra8_err_busy, k_ra8_err_null_ptr, and k_ra8_ok.
Referenced by internal_library_enumerate(), internal_library_first_child(), internal_list_pages_open_dir(), internal_verify_artifacts(), and internal_verify_library_root().
|
static |
Validate one backend-produced stable directory value.
Checks bounded NUL termination, portable leaf-path syntax, node type, and the directory-size invariant at the trust boundary.
| [in] | caps | Immutable namespace limits. |
| [in] | entry | Candidate copied directory entry. |
| k_ra8_ok | The value is coherent and names one safe leaf. |
| k_ra8_err_invalid_state | A backend violated the cursor contract. |
entry is fully initialized. caps contains the immutable limits of the producing backend. Definition at line 129 of file fw_if_fs_dir.c.
References fw_fs_path_validate(), k_fw_fs_node_directory, k_fw_fs_node_none, k_fw_fs_node_other, k_fw_fs_path_cap, k_ra8_err_invalid_state, k_ra8_ok, memcpy(), fw_fs_dirent_value_t::name, fw_fs_dirent_value_t::name_bytes, fw_fs_caps_t::name_max_bytes, RA8_INTERNAL, fw_fs_dirent_value_t::size_bytes, strnlen(), and fw_fs_dirent_value_t::type.
Referenced by fw_fs_dir_next().
|
static |
Validate an open directory cursor before dispatch.
Rejects unopened and detached handles before dereferencing their backend callback table.
| [in] | directory | Directory cursor to inspect. |
| k_ra8_ok | The cursor is open and dispatchable. |
| k_ra8_err_null_ptr | directory is NULL. |
| k_ra8_err_invalid_state | The cursor is not open. |
| k_ra8_err_not_initialized | The cursor lacks a backend interface. |
directory. Definition at line 102 of file fw_if_fs_dir.c.
References fw_fs_dir_t::iface, fw_fs_dir_t::is_open, k_ra8_err_invalid_state, k_ra8_err_not_initialized, k_ra8_err_null_ptr, k_ra8_ok, and RA8_INTERNAL.
Referenced by fw_fs_dir_close(), and fw_fs_dir_next().
|
static |
Validate one namespace facade used for cursor dispatch.
Checks only the binding needed by incremental-directory operations; it does not inspect or mutate backend-owned state.
| [in] | names | Namespace facade to inspect. |
| k_ra8_ok | The facade is bound. |
| k_ra8_err_null_ptr | names is NULL. |
| k_ra8_err_not_initialized | No namespace vtable is bound. |
names. Definition at line 41 of file fw_if_fs_dir.c.
References fw_fs_namespace_t::iface, k_ra8_err_not_initialized, k_ra8_err_null_ptr, k_ra8_ok, and RA8_INTERNAL.
Referenced by fw_fs_dir_open().
|
static |
Validate cursor workspace size and alignment.
Enforces the opaque backend's published extent and power-of-two alignment contract before the backend can see caller storage.
| [in,out] | workspace | Caller-owned opaque storage. |
| [in] | bytes | Accessible storage extent. |
| [in] | need | Backend-required storage extent. |
| [in] | align | Backend-required power-of-two alignment. |
| k_ra8_ok | The workspace meets the backend contract. |
| k_ra8_err_null_ptr | workspace is NULL. |
| k_ra8_err_no_mem | bytes is less than need. |
| k_ra8_err_invalid_state | Backend alignment metadata is invalid. |
| k_ra8_err_invalid_arg | The workspace address is misaligned. |
bytes describes the accessible extent beginning at workspace. Definition at line 71 of file fw_if_fs_dir.c.
References k_ra8_err_invalid_arg, k_ra8_err_invalid_state, k_ra8_err_no_mem, k_ra8_err_null_ptr, and k_ra8_ok.
Referenced by fw_fs_dir_open().