|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Manage the caller-owned media export bump workspace. More...
Go to the source code of this file.
Functions | |
| void | mdl_export_workspace_init (mdl_export_workspace_t *ws, void *data, size_t cap) |
| Bind an exporter arena without allocating memory. | |
| void * | mdl_export_workspace_take (mdl_export_workspace_t *ws, size_t bytes, size_t alignment) |
| Reserve aligned bytes from an exporter arena. | |
Manage the caller-owned media export bump workspace.
Keeps arena initialization and aligned reservation independent of the format dispatcher so readers and validators can reuse the workspace contract without linking every exporter.
[Ring 4 / Domain] {World: NS}
Definition in file mdl_export_workspace.c.
| void mdl_export_workspace_init | ( | mdl_export_workspace_t * | ws, |
| void * | data, | ||
| size_t | cap ) |
Bind an exporter arena without allocating memory.
Initializes the caller-owned bump arena and clears usage counters; a NULL data pointer produces a zero-capacity workspace.
| [out] | ws | Workspace descriptor to initialize, or NULL for no operation. |
| [in,out] | data | Caller-owned writable arena bytes, or NULL. |
| [in] | cap | Number of bytes available at data. |
ws is NULL or points to writable descriptor storage. data remains alive while the workspace is used. cap only when data is non-NULL, otherwise zero. Definition at line 19 of file mdl_export_workspace.c.
References mdl_export_workspace::cap, mdl_export_workspace::data, mdl_export_workspace::high_water, and mdl_export_workspace::used.
Referenced by internal_main_init().
| void * mdl_export_workspace_take | ( | mdl_export_workspace_t * | ws, |
| size_t | bytes, | ||
| size_t | alignment ) |
Reserve aligned bytes from an exporter arena.
Advances the caller-owned bump cursor only after overflow and capacity checks and records the largest successfully used offset.
| [in,out] | ws | Initialized exporter workspace. |
| [in] | bytes | Nonzero number of bytes to reserve. |
| [in] | alignment | Nonzero power-of-two alignment. |
| non-NULL | A complete aligned reservation was made. |
| NULL | Arguments were invalid or bounded capacity was exhausted. |
ws is non-NULL and was initialized by mdl_export_workspace_init. alignment is a power of two. Definition at line 30 of file mdl_export_workspace.c.
References mdl_export_workspace::cap, mdl_export_workspace::data, mdl_export_workspace::high_water, memcpy(), and mdl_export_workspace::used.
Referenced by internal_allocate_builder(), internal_allocate_container(), internal_allocate_pipeline(), internal_epub_carve_workspace(), internal_jof_carve_webp(), internal_jof_load_source(), internal_jof_produce_page(), internal_list_pages_open_dir(), internal_zip_workspace_alloc(), mdl_export_chapter_meta_ws(), priv_mdl_export_tar_gzip(), and priv_mdl_verify_rabook().