18typedef enum : uint32_t {
30 if ((filepath ==
nullptr) || (out_root ==
nullptr) || (out_leaf ==
nullptr)) {
33 const size_t len =
strlen(filepath);
34 if ((len == 0U) || (len >= root_cap) || ((len + 1U) >= leaf_cap)) {
37 const char* last_slash =
strrchr(filepath,
'/');
38 if (last_slash ==
nullptr) {
42 (void)
memcpy(&out_leaf[1], filepath, len + 1U);
43 }
else if (last_slash == filepath) {
46 (void)
memcpy(out_leaf, last_slash, len + 1U);
48 const size_t dir_len = len -
strlen(last_slash);
49 if (dir_len >= root_cap) {
52 (void)
memcpy(out_root, filepath, dir_len);
53 out_root[dir_len] =
'\0';
54 (void)
memcpy(out_leaf, last_slash, len - dir_len + 1U);
64 if ((file ==
nullptr) || (buffer ==
nullptr) || (out_size ==
nullptr)) {
68 uint32_t chunk_bytes = 0U;
69 for (uint32_t step = 0U;
73 uint32_t remaining = capacity - total;
74 if (remaining == 0U) {
77 const uint32_t read_limit =
83 if (chunk_bytes == 0U) {
103 sizeof(portable_path)) !=
k_ra8_ok) {
Word search puzzle solver API and bounded workspace definitions.
@ k_soup_max_file_capacity
Maximum supported puzzle file size.
ra8_err_t priv_alphabet_soup_read_all(fw_fs_file_t *file, uint8_t *buffer, uint32_t capacity, uint32_t *out_size)
ra8_err_t priv_alphabet_soup_load_file_contents(const char *filepath, uint8_t *out_buf, uint32_t buf_cap, uint32_t *out_len)
alphabet_soup_cli_limit_t
Buffer sizes and limits for host CLI file ingestion.
@ k_cli_file_work_capacity
File handle workspace bytes.
@ k_cli_read_chunk_bytes
Bounded read chunk bytes.
@ k_cli_path_buffer_capacity
Host path buffer bytes.
ra8_err_t priv_alphabet_soup_split_path(const char *filepath, char *out_root, size_t root_cap, char *out_leaf, size_t leaf_cap)
Private host-file helpers for the Alphabet Soup CLI wrapper.
Architecture-neutral filesystem namespace, stream, and transaction ports.
ra8_err_t fw_fs_open(const fw_fs_stream_port_t *streams, const char *path, fw_fs_open_mode_t mode, fw_fs_file_t *file, void *workspace, uint32_t workspace_size)
Open a file into a caller-owned handle and backend workspace.
ra8_err_t fw_fs_read(fw_fs_file_t *file, uint8_t *dst, uint32_t cap, uint32_t *out_read)
Read up to cap bytes; zero bytes is EOF.
ra8_err_t fw_fs_close(fw_fs_file_t *file)
Close and consume an open handle.
Root-confined hosted POSIX adapter for fw_if_fs.
ra8_err_t fw_fs_posix_deinit(fw_fs_posix_state_t *state)
Close the root descriptor; no bound operation is valid afterward.
ra8_err_t fw_fs_posix_init(fw_fs_t *out, fw_fs_posix_state_t *state, const fw_fs_posix_cfg_t *cfg)
Open/configure a root-confined POSIX binding.
@ k_fw_fs_open_read
Existing file, read-only.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
@ k_ra8_fail
Generic unspecified failure.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ 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).
@ k_ra8_err_invalid_size
Invalid size parameter (too large, too small, or misaligned).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
size_t strlen(const char *s)
Calculate string length.
void * memcpy(void *dst, const void *src, size_t n)
Copy memory area between non-overlapping regions.
char * strrchr(const char *s, int c)
Locate last occurrence of character in string.
Caller-owned open file; fields are private to the facade.
POSIX composition-root settings.
Caller-owned POSIX adapter state.
One complete composition-root filesystem binding.
fw_fs_stream_port_t streams
Byte-stream operations.