21typedef enum : uint32_t {
61 if ((offset > io->size_bytes) || ((uint64_t)length > (io->size_bytes - offset))) {
66 while ((error ==
k_ra8_ok) && (done < length)) {
71 error =
fw_fs_read(io->file, &destination[done], length - done, &got);
73 if ((error ==
k_ra8_ok) && (got == 0U)) {
104 size_t destination_bytes,
107 const size_t result = tinfl_decompress_mem_to_mem(
112 (
int)(TINFL_FLAG_PARSE_ZLIB_HEADER | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF));
113 if (result == TINFL_DECOMPRESS_MEM_TO_MEM_FAILED) {
125 if ((file ==
nullptr) || (workspace ==
nullptr) || (report ==
nullptr)) {
134 _Alignof(max_align_t));
137 _Alignof(max_align_t));
140 _Alignof(max_align_t));
141 if ((table ==
nullptr) || (compressed ==
nullptr) || (chunk ==
nullptr) || (scratch ==
nullptr)) {
167 report->metadata_present =
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_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 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_seek(fw_fs_file_t *file, uint64_t absolute_offset)
Seek to an absolute byte offset from the beginning.
void * mdl_export_workspace_take(mdl_export_workspace_t *ws, size_t bytes, size_t alignment)
Reserve aligned bytes from an exporter arena.
struct mdl_export_workspace mdl_export_workspace_t
Caller-owned bounded arena for all exporter scratch state.
@ k_rabook_compressed_bytes
One complete zlib stream.
@ k_rabook_chunk_bytes
Independent RBKC chunk size.
@ k_rabook_read_calls
EPUB random-read ceiling.
static ra8_err_t internal_rabook_read(void *opaque, uint64_t offset, uint8_t *destination, uint32_t length)
Serve one exact positioned RBKC read through the portable file facade.
ra8_err_t priv_mdl_verify_rabook(fw_fs_file_t *file, uint64_t size_bytes, mdl_export_workspace_t *workspace, mdl_verify_report_t *report)
Strictly validate one borrowed RBKC .rabook file.
mdl_verify_rabook_limit_t
Bounded strict-reader workspace profile.
@ k_rabook_table_entries
At most 65,536 RBKC chunks.
@ k_rabook_scratch_bytes
CRC and node ownership work.
static ra8_err_t internal_rabook_inflate(const void *source, size_t source_bytes, void *destination, size_t destination_bytes, size_t *out_bytes)
Inflate one complete RFC 1950 chunk into caller storage.
Private strict RBKC validator seam for media downloader artifacts.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
@ k_ra8_err_out_of_range
Sensor or peripheral output out of valid range.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_err_validation_failed
Validation rule failed (caller-supplied invariant not satisfied).
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ 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.
One open chunked .rabook file: parsed geometry + caller storage.
Caller-owned open file; fields are private to the facade.
Positioned exact-read adapter state.
uint64_t size_bytes
Immutable complete extent.
fw_fs_file_t * file
Borrowed portable file.
uint32_t calls
Bounded backend read attempts.