|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Portable temporary EPUB and flat-blob adapters for RABOOK export. More...
Go to the source code of this file.
Enumerations | |
| enum | mdl_rabook_io_limit_t : uint32_t { k_rabook_temp_attempts = 16U , k_rabook_read_calls = 1000000U , k_rabook_fnv_offset = 2166136261U , k_rabook_fnv_prime = 16777619U , k_rabook_hex_digits = 7U , k_rabook_hex_mask = 0x0FU , k_rabook_suffix_bytes = 5U , k_rabook_value_mask = 0x0FFFFFFFU } |
| Bounded I/O and collision-attempt limits. More... | |
Functions | |
| static uint32_t | internal_temp_seed (const char *destination) |
| Hash one destination into a stable temporary-name seed. | |
| 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_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_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. | |
| ra8_err_t | priv_mdl_rabook_epub_close (mdl_rabook_epub_source_t *source) |
| Close one temporary EPUB stream. | |
| 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. | |
| 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. | |
Portable temporary EPUB and flat-blob adapters for RABOOK export.
Owns bounded collision handling plus exact random-read callbacks; it contains no compiler profile or final publication policy.
[Ring 4 / Domain] {World: NS}
Definition in file mdl_export_rabook_io.c.
| enum mdl_rabook_io_limit_t : uint32_t |
Bounded I/O and collision-attempt limits.
Definition at line 19 of file mdl_export_rabook_io.c.
|
static |
Render one collision candidate as an 8.3-compatible EPUB leaf.
Writes R plus seven uppercase hexadecimal digits and .EPB without a variadic formatter or hidden stream dependency.
| [in] | value | Low 28 bits used for the hexadecimal suffix. |
| [out] | leaf | Writable thirteen-byte leaf buffer. |
leaf is non-NULL and spans exactly thirteen writable bytes. value are ignored by design. leaf contains one complete NUL-terminated 8.3 name. Definition at line 66 of file mdl_export_rabook_io.c.
References k_rabook_hex_digits, k_rabook_hex_mask, k_rabook_suffix_bytes, memcpy(), and RA8_INTERNAL.
Referenced by priv_mdl_rabook_temp_begin().
|
static |
Hash one destination into a stable temporary-name seed.
Applies 32-bit FNV-1a to the complete NUL-terminated path.
| [in] | destination | Stable final destination path. |
| other | The 32-bit FNV-1a hash of the complete destination string. |
destination is non-NULL and NUL-terminated. Definition at line 43 of file mdl_export_rabook_io.c.
References k_rabook_fnv_offset, k_rabook_fnv_prime, and RA8_INTERNAL.
Referenced by priv_mdl_rabook_temp_begin().
| ra8_err_t priv_mdl_rabook_epub_close | ( | mdl_rabook_epub_source_t * | source | ) |
Close one temporary EPUB stream.
Delegates to the injected file adapter and clears retained state only after the close operation succeeds.
| [in,out] | source | Open source state. |
| k_ra8_ok | The file closed and state was cleared. |
| other | The portable close operation failed. |
source is non-NULL and owns an open file. Definition at line 148 of file mdl_export_rabook_io.c.
References mdl_rabook_epub_source_t::file, fw_fs_close(), fw_fs_file_t::is_open, k_ra8_err_invalid_arg, k_ra8_ok, and RA8_PRIV.
Referenced by internal_close_compile_sources().
| 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.
Stats and opens one regular file, retaining its exact immutable extent for the callback lifetime.
| [out] | source | Caller-owned stream state. |
| [in,out] | storage | Exclusive portable storage binding. |
| [in] | path | Canonical temporary EPUB path. |
| k_ra8_ok | A nonempty regular file is open with a stable extent. |
| k_ra8_err_invalid_arg | The node is nonregular or an argument is invalid. |
source owns no open file. path. source clear and owns no file. Definition at line 108 of file mdl_export_rabook_io.c.
References fw_fs_stat_t::exists, mdl_rabook_epub_source_t::file, mdl_storage_t::file_workspace, mdl_storage_t::file_workspace_bytes, mdl_storage_t::fs, fw_fs_close(), fw_fs_file_size(), fw_fs_open(), fw_fs_stat(), fw_fs_file_t::is_open, k_fw_fs_node_file, k_fw_fs_open_read, k_ra8_err_invalid_arg, k_ra8_err_protocol_error, k_ra8_ok, fw_fs_t::names, RA8_PRIV, fw_fs_stat_t::size_bytes, mdl_rabook_epub_source_t::size_bytes, fw_fs_t::streams, and fw_fs_stat_t::type.
Referenced by internal_compile_temp().
| 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.
Bounds the request against the retained extent, seeks explicitly, and latches any short read or excessive callback count.
| [in,out] | opaque | Bound mdl_rabook_epub_source_t. |
| [in] | offset | Absolute archive byte offset. |
| [out] | destination | Writable destination. |
| [in] | length | Exact requested byte count. |
length on complete success, otherwise zero. | 0 | The request was invalid, out of range, short, or faulted. |
| other | The exact positive length requested by the reader. |
destination spans length writable bytes. Definition at line 160 of file mdl_export_rabook_io.c.
References mdl_rabook_epub_source_t::calls, mdl_rabook_epub_source_t::error, mdl_rabook_epub_source_t::file, fw_fs_read(), fw_fs_seek(), fw_fs_file_t::is_open, k_ra8_err_invalid_size, k_ra8_err_invalid_state, k_ra8_err_out_of_range, k_ra8_ok, k_rabook_read_calls, RA8_PRIV, and mdl_rabook_epub_source_t::size_bytes.
Referenced by internal_compile_temp().
| 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.
Validates offset arithmetic before copying the requested resident span and reporting its exact transferred count.
| [in] | opaque | Bound mdl_rabook_flat_source_t. |
| [in] | offset | Flat blob byte offset. |
| [out] | destination | Writable destination. |
| [in] | requested | Exact requested byte count. |
| [out] | out_read | Exact copied count on success. |
| k_ra8_ok | The complete requested range was copied. |
| k_ra8_err_out_of_range | The range exceeds the flat blob. |
out_read to zero. Definition at line 197 of file mdl_export_rabook_io.c.
References mdl_rabook_flat_source_t::bytes, k_ra8_err_invalid_arg, k_ra8_err_out_of_range, k_ra8_ok, memcpy(), RA8_PRIV, and mdl_rabook_flat_source_t::size_bytes.
Referenced by internal_emit_container().
| 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.
Hashes the final destination into bounded 8.3-compatible sibling names and uses create-new transactions so no prior file is replaced.
| [out] | output | Active create-new EPUB output on success. |
| [in,out] | storage | Exclusive portable storage binding. |
| [in] | directory | Canonical directory that will contain the temporary file. |
| [in] | destination | Final RABOOK path used only as a deterministic salt. |
| [out] | path | Destination for the chosen canonical temporary path. |
| [in] | capacity | Writable bytes at path. |
| k_ra8_ok | One private EPUB stage is active. |
| k_ra8_err_exists | Every bounded candidate already exists. |
| k_ra8_err_invalid_size | The temporary path cannot fit. |
output is inactive and storage is exclusively owned. path and one active output transaction. output inactive. Definition at line 77 of file mdl_export_rabook_io.c.
References internal_temp_leaf(), internal_temp_seed(), k_mdl_format_epub, k_ra8_err_exists, k_ra8_err_invalid_arg, k_ra8_err_invalid_size, k_ra8_ok, k_rabook_temp_attempts, k_rabook_value_mask, priv_mdl_export_output_begin_new(), priv_mdl_export_path_join(), and RA8_PRIV.
Referenced by internal_write_temp_epub().