|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Strict no-heap RBKC validator and reader over named RA8 VFS mounts. More...
#include <stdint.h>#include "book_chunked.h"#include "ra8_c6link_mdl_transfer.h"#include "ra8_io_vfs.h"Go to the source code of this file.
Data Structures | |
| struct | mdl_rabook_vfs_config_t |
| Caller-owned decompression and strict-validation workspace binding. More... | |
| struct | mdl_rabook_vfs_t |
| One initialized strict validator or one open validated RBKC reader. More... | |
Functions | |
| ra8_err_t | mdl_rabook_vfs_init (mdl_rabook_vfs_t *ctx, const mdl_rabook_vfs_config_t *config) |
| Initialize one strict RBKC VFS workspace binding. | |
| ra8_err_t | mdl_rabook_vfs_validate (void *opaque, const char *staging_path, uint64_t total_bytes, const uint8_t sha256[k_ra8_mdl_sha256_bytes]) |
| Strictly validate one closed private RBKC staging object. | |
| ra8_err_t | mdl_rabook_vfs_open (mdl_rabook_vfs_t *ctx, const char *path) |
| Open and strictly revalidate a published RBKC object for consumption. | |
| ra8_err_t | mdl_rabook_vfs_read_chunk (mdl_rabook_vfs_t *ctx, uint64_t offset, uint8_t *dst, uint32_t len) |
| Read one exact chunk-aligned flat-blob span from an open book. | |
| ra8_err_t | mdl_rabook_vfs_info (const mdl_rabook_vfs_t *ctx, book_header_t *out_header, uint64_t *out_flat_size) |
| Copy metadata from an open strictly validated book. | |
| ra8_err_t | mdl_rabook_vfs_close (mdl_rabook_vfs_t *ctx) |
| Close and release an open VFS reader facade. | |
Strict no-heap RBKC validator and reader over named RA8 VFS mounts.
Adapts the existing format-neutral ra8_io_vfs_file_t stream to the strict book_chunked_t reader. The same caller-owned workspace can be used as the artifact validator in mdl_storage_vfs_config_t and, after the transaction publishes, reopened on the final path for demand-paged reading. No file object is retained by validation; an open reader is retained only between mdl_rabook_vfs_open and mdl_rabook_vfs_close.
This module does not create a second filesystem facade. It only composes the existing VFS and book contracts and owns no heap, static workspace, mount, path, or publication policy.
Definition in file mdl_rabook_vfs.h.
|
nodiscard |
Close and release an open VFS reader facade.
| [in,out] | ctx | Initialized context. |
ctx. Definition at line 368 of file mdl_rabook_vfs.c.
References internal_rabook_close(), and k_ra8_err_null_ptr.
Referenced by internal_consume().
|
nodiscard |
Copy metadata from an open strictly validated book.
| [in] | ctx | Open validated context. |
| [out] | out_header | Receives the decoded flat RABOOK1 header. |
| [out] | out_flat_size | Receives the inflated flat-blob length. |
| k_ra8_ok | Both outputs were initialized. |
| k_ra8_err_null_ptr | A required pointer is null. |
| k_ra8_err_invalid_state | No validated reader is open. |
ctx. Definition at line 346 of file mdl_rabook_vfs.c.
References mdl_rabook_vfs_t::file, mdl_rabook_vfs_t::header, book_chunked_t::inflated_total, k_ra8_err_invalid_state, k_ra8_err_null_ptr, k_ra8_ok, mdl_rabook_vfs_t::open, and mdl_rabook_vfs_t::reader.
Referenced by internal_consume().
|
nodiscard |
Initialize one strict RBKC VFS workspace binding.
| [out] | ctx | Caller-owned context. |
| [in] | config | Complete inflater and workspace descriptor. |
| k_ra8_ok | The context is ready for validation or open. |
| k_ra8_err_null_ptr | A required pointer is null. |
| k_ra8_err_invalid_size | A workspace capacity is zero or table has fewer than two entries. |
ctx. ctx closed with no retained VFS facade. ctx unchanged. Definition at line 207 of file mdl_rabook_vfs.c.
References mdl_rabook_vfs_config_t::chunk, mdl_rabook_vfs_config_t::chunk_cap, mdl_rabook_vfs_config_t::compressed, mdl_rabook_vfs_config_t::compressed_cap, mdl_rabook_vfs_config_t::inflate_cb, k_ra8_err_invalid_size, k_ra8_err_null_ptr, k_ra8_ok, mdl_rabook_vfs_config_t::scratch, mdl_rabook_vfs_config_t::scratch_cap, mdl_rabook_vfs_config_t::table, and mdl_rabook_vfs_config_t::table_cap.
Referenced by internal_bind_transfer().
|
nodiscard |
Open and strictly revalidate a published RBKC object for consumption.
| [in,out] | ctx | Initialized closed context. |
| [in] | path | Named VFS path of the published .rabook. |
| k_ra8_err_invalid_state | A reader is already open. |
Definition at line 298 of file mdl_rabook_vfs.c.
References mdl_rabook_vfs_t::file, mdl_rabook_vfs_t::header, internal_rabook_close(), internal_rabook_open_reader(), internal_rabook_validate_open(), k_ra8_err_invalid_state, k_ra8_err_null_ptr, k_ra8_ok, and mdl_rabook_vfs_t::open.
Referenced by internal_consume().
|
nodiscard |
Read one exact chunk-aligned flat-blob span from an open book.
| [in,out] | ctx | Open validated context. |
| [in] | offset | Chunk-aligned inflated-blob offset. |
| [out] | dst | Destination for exactly len bytes. |
| [in] | len | Exact inflated span for the selected chunk. |
len bytes in dst. Definition at line 328 of file mdl_rabook_vfs.c.
References book_chunked_read(), mdl_rabook_vfs_t::file, k_ra8_err_invalid_state, k_ra8_err_null_ptr, mdl_rabook_vfs_t::open, and mdl_rabook_vfs_t::reader.
Referenced by internal_consume().
|
nodiscard |
Strictly validate one closed private RBKC staging object.
Opens staging_path read-only, proves its exact size, validates every RBKC stream and the complete canonical RABOOK1 payload, then closes it. This signature directly satisfies mdl_storage_vfs_validate_fn.
| [in,out] | opaque | Initialized mdl_rabook_vfs_t. |
| [in] | staging_path | Named VFS path to the private closed artifact. |
| [in] | total_bytes | Independently verified transfer byte count. |
| [in] | sha256 | Independently verified transfer digest. |
opaque. Definition at line 257 of file mdl_rabook_vfs.c.
References mdl_rabook_vfs_t::digest, mdl_rabook_vfs_t::file, mdl_rabook_vfs_t::file_size, mdl_rabook_vfs_t::header, internal_rabook_close(), internal_rabook_open_reader(), internal_rabook_validate_open(), k_ra8_err_invalid_state, k_ra8_err_null_ptr, k_ra8_mdl_sha256_bytes, k_ra8_ok, memcpy(), memset(), mdl_rabook_vfs_t::open, and mdl_rabook_vfs_t::transfer_validated.
Referenced by internal_bind_transfer().