19typedef enum : uint32_t {
46 for (
size_t index = 0U; destination[index] !=
'\0'; ++index) {
47 hash ^= (uint8_t)destination[index];
68 static const char k_hex[] =
"0123456789ABCDEF";
79 const char* directory,
80 const char* destination,
84 if ((output ==
nullptr) || (storage ==
nullptr) || (directory ==
nullptr) ||
85 (destination ==
nullptr) || (path ==
nullptr) || (capacity == 0U)) {
112 if ((source ==
nullptr) || (storage ==
nullptr) || (storage->
fs ==
nullptr) ||
132 uint64_t open_size = 0U;
150 if ((source ==
nullptr) || !source->
file.
is_open) {
166 if ((source ==
nullptr) || (destination ==
nullptr) || !source->
file.
is_open ||
168 ((uint64_t)length > (source->
size_bytes - offset))) {
176 while ((error ==
k_ra8_ok) && (done < length)) {
183 fw_fs_read(&source->
file, &((uint8_t*)destination)[done], (uint32_t)(length - done), &got);
185 if ((error ==
k_ra8_ok) && (got == 0U)) {
191 source->
error = error;
199 uint8_t* destination,
204 if (out_read !=
nullptr) {
207 if ((source ==
nullptr) || (destination ==
nullptr) || (out_read ==
nullptr)) {
213 (void)
memcpy(destination, &source->
bytes[offset], requested);
214 *out_read = requested;
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_stat(const fw_fs_namespace_t *names, const char *path, fw_fs_stat_t *out)
Query a path; a miss is success with out->exists == false.
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.
ra8_err_t fw_fs_seek(fw_fs_file_t *file, uint64_t absolute_offset)
Seek to an absolute byte offset from the beginning.
ra8_err_t fw_fs_file_size(fw_fs_file_t *file, uint64_t *out_size)
Report the open file's current length.
@ k_fw_fs_node_file
Regular byte stream.
@ k_fw_fs_open_read
Existing file, read-only.
ra8_err_t priv_mdl_export_path_join(char *out, size_t capacity, const char *directory, const char *leaf)
Join a canonical directory and leaf without truncation.
ra8_err_t priv_mdl_export_output_begin_new(mdl_export_output_t *output, mdl_storage_t *storage, const char *destination, mdl_format_t format)
Bind a create-new validated publication transaction.
Private bounded RABOOK export contracts for the media downloader.
ra8_err_t priv_mdl_rabook_temp_begin(mdl_export_output_t *output, mdl_storage_t *storage, const char *directory, const char *destination, char *path, size_t capacity)
Reserve one collision-free temporary EPUB publication path.
ra8_err_t priv_mdl_rabook_flat_read(void *opaque, uint32_t offset, uint8_t *destination, uint32_t requested, uint32_t *out_read)
Serve one exact flat-blob read to the RBKC writer.
mdl_rabook_io_limit_t
Bounded I/O and collision-attempt limits.
@ k_rabook_read_calls
EPUB random-read ceiling.
@ k_rabook_value_mask
Low 28 temporary-name bits.
@ k_rabook_fnv_prime
FNV-1a multiplier.
@ k_rabook_fnv_offset
FNV-1a seed for temp names.
@ k_rabook_temp_attempts
Create-new sibling candidates.
@ k_rabook_hex_digits
Hex digits in a temp leaf.
@ k_rabook_hex_mask
One hexadecimal nibble.
@ k_rabook_suffix_bytes
.EPB plus NUL terminator.
size_t priv_mdl_rabook_epub_read(void *opaque, uint64_t offset, void *destination, size_t length)
Serve one exact random EPUB read to the streamed reader.
static void internal_temp_leaf(uint32_t value, char leaf[13])
Render one collision candidate as an 8.3-compatible EPUB leaf.
ra8_err_t priv_mdl_rabook_epub_close(mdl_rabook_epub_source_t *source)
Close one temporary EPUB stream.
static uint32_t internal_temp_seed(const char *destination)
Hash one destination into a stable temporary-name seed.
ra8_err_t priv_mdl_rabook_epub_open(mdl_rabook_epub_source_t *source, mdl_storage_t *storage, const char *path)
Open one validated temporary EPUB as a portable random-read stream.
#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_exists
Item already exists – cannot create again.
@ 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_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 * memcpy(void *dst, const void *src, size_t n)
Copy memory area between non-overlapping regions.
bool is_open
Facade lifecycle guard.
Result of a portable metadata query.
uint64_t size_bytes
File length; zero for a directory.
bool exists
False means a clean lookup miss.
fw_fs_node_type_t type
Kind of node at the path.
fw_fs_stream_port_t streams
Byte-stream operations.
fw_fs_namespace_t names
Namespace operations.
One validated staged publication, including random ZIP backfill.
Open portable EPUB stream retained during one compile.
uint32_t calls
Bounded random-read call tally.
uint64_t size_bytes
Immutable complete EPUB extent.
fw_fs_file_t file
Borrowed portable file handle.
ra8_err_t error
First read/seek protocol failure.
Resident flat RABOOK1 source for the chunked container writer.
const uint8_t * bytes
Immutable flat blob bytes.
uint32_t size_bytes
Complete flat blob extent.
One non-reentrant downloader filesystem dependency bundle.
uint32_t file_workspace_bytes
File workspace extent.
const fw_fs_t * fs
Injected portable filesystem.
void * file_workspace
Open-file backend state.