51 if (ctx->
file ==
nullptr) {
69 if (got > (len - done)) {
118 if (ctx->
file !=
nullptr) {
147 uint64_t expected_size,
209 if (ctx ==
nullptr) {
212 if (config ==
nullptr) {
218 if (config->
table ==
nullptr) {
224 if (config->
chunk ==
nullptr) {
227 if (config->
scratch ==
nullptr) {
244 .table = config->
table,
246 .chunk = config->
chunk,
258 const char* staging_path,
259 uint64_t total_bytes,
262 if (opaque ==
nullptr) {
265 if (staging_path ==
nullptr) {
268 if (sha256 ==
nullptr) {
275 if (ctx->
file !=
nullptr) {
300 if (ctx ==
nullptr) {
303 if (path ==
nullptr) {
309 if (ctx->
file !=
nullptr) {
330 if (ctx ==
nullptr) {
333 if (dst ==
nullptr) {
339 if (ctx->
file ==
nullptr) {
348 if (ctx ==
nullptr) {
351 if (out_header ==
nullptr) {
354 if (out_flat_size ==
nullptr) {
360 if (ctx->
file ==
nullptr) {
363 *out_header = ctx->
header;
370 if (ctx ==
nullptr) {
Demand-paged chunk reader for the "RBKC" .rabook container.
ra8_err_t book_chunked_validate_strict(book_chunked_t *rd, uint8_t *chunk, uint32_t chunk_cap, uint8_t *scratch, uint32_t scratch_cap, book_header_t *out_header)
Strictly validate the complete flat blob behind an open RBKC reader.
ra8_err_t book_chunked_read(void *ctx, uint64_t offset, uint8_t *buf, uint32_t len)
Serve one chunk-aligned read of the inflated flat blob.
ra8_err_t book_chunked_open(book_chunked_t *rd, ra8_vsource_read_fn file_read, void *file_ctx, uint64_t file_len, book_inflate_fn inflate, uint64_t *table_buf, uint32_t table_cap_entries, uint8_t *staging, uint32_t staging_cap)
Open a chunked .rabook container for demand-paged chunk reads.
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_close(mdl_rabook_vfs_t *ctx)
Close and release an open VFS reader facade.
static ra8_err_t internal_rabook_close(mdl_rabook_vfs_t *ctx)
Close a possibly live facade and clear open-derived state.
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.
static ra8_err_t internal_rabook_read_exact(void *opaque, uint64_t offset, uint8_t *dst, uint32_t len)
Read one exact random range through an already-open VFS stream.
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.
static void internal_rabook_clear_open(mdl_rabook_vfs_t *ctx)
Clear all state derived from an opened artifact.
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_init(mdl_rabook_vfs_t *ctx, const mdl_rabook_vfs_config_t *config)
Initialize one strict RBKC VFS workspace binding.
static ra8_err_t internal_rabook_validate_open(mdl_rabook_vfs_t *ctx, book_header_t *out_header)
Strictly validate the complete inner flat blob of an open reader.
static ra8_err_t internal_rabook_open_reader(mdl_rabook_vfs_t *ctx, const char *path, uint64_t expected_size, bool enforce_size)
Open and parse one exact-size RBKC container without strict payload validation.
Strict no-heap RBKC validator and reader over named RA8 VFS mounts.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_LOOP_BOUND(ceiling)
NASA Power-of-10 Rule 2: bind ONE loop to a compile-time ceiling.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ 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_protocol_error
Protocol-level error (e.g.
@ 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.
void * memset(void *dst, int value, size_t n)
Fill memory with a constant byte value.
void * memcpy(void *dst, const void *src, size_t n)
Copy memory area between non-overlapping regions.
@ k_ra8_fs_mode_read
Read-only, must exist.
ra8_io virtual filesystem – mount many volumes, address them by name.
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_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_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_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_seek(ra8_io_vfs_file_t *file, uint64_t offset_bytes)
Seek a format-neutral stream.
@ k_ra8_mdl_sha256_bytes
SHA-256 digest size in bytes.
One open chunked .rabook file: parsed geometry + caller storage.
uint64_t inflated_total
Served flat-blob length.
Caller-owned decompression and strict-validation workspace binding.
uint32_t table_cap
Entries available at table.
uint32_t compressed_cap
Bytes available at compressed.
uint32_t chunk_cap
Bytes available at chunk.
uint8_t * scratch
Strict semantic/CRC workspace.
uint64_t * table
Parsed RBKC offset-table workspace.
uint32_t scratch_cap
Bytes available at scratch.
uint8_t * compressed
One compressed-chunk staging span.
book_inflate_fn inflate_cb
Heap-free RFC 1950 inflater.
uint8_t * chunk
One complete inflated-chunk span.
One initialized strict validator or one open validated RBKC reader.
uint8_t * scratch
Caller strict workspace.
uint32_t table_cap
Table entry capacity.
uint8_t * chunk
Caller inflated chunk.
ra8_io_vfs_file_t * file
Borrowed VFS facade slot.
uint64_t * table
Caller table workspace.
uint8_t digest[k_ra8_mdl_sha256_bytes]
Transfer digest at validate.
book_header_t header
Strict decoded header.
uint8_t * compressed
Caller compressed staging.
uint32_t scratch_cap
Strict workspace bytes.
bool transfer_validated
Stage validation succeeded.
book_inflate_fn inflate_cb
Caller inflater.
uint64_t file_size
Validated RBKC byte length.
uint32_t chunk_cap
Inflated chunk bytes.
book_chunked_t reader
Bound RBKC reader.
uint32_t compressed_cap
Compressed staging bytes.
bool open
Live final-file reader.