ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_export_io_internal.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <stddef.h>
18#include <stdint.h>
19
20#include "mdl_export.h"
21#include "mdl_storage.h"
22#include "miniz.h"
23#include "ra8_attributes.h"
24#include "ra8_err.h"
25
27typedef struct {
30 uint64_t size;
31 uint64_t offset;
32 uint64_t hash;
33 uint32_t calls;
36
45
47typedef ra8_err_t (*mdl_export_sink_fn_t)(void* ctx, const uint8_t* bytes, uint32_t length);
48
68 mdl_storage_t* storage,
69 const char* destination,
70 mdl_format_t format);
71
92 mdl_storage_t* storage,
93 const char* destination,
94 mdl_format_t format);
95
114 const uint8_t* bytes,
115 uint32_t length);
116
138 uint64_t offset,
139 const uint8_t* bytes,
140 uint32_t length,
141 uint32_t* out_written);
142
160RA8_PRIV size_t priv_mdl_export_zip_write(void* opaque,
161 mz_uint64 file_offset,
162 const void* bytes,
163 size_t length);
164
183 mdl_export_workspace_t* workspace,
184 bool* out_published);
185
202
221 mdl_storage_t* storage,
222 const char* path);
223
240
258RA8_PRIV size_t priv_mdl_export_zip_read(void* opaque,
259 mz_uint64 file_offset,
260 void* destination,
261 size_t capacity);
262
279
300 mdl_storage_t* storage,
301 const char* member,
302 const char* path,
303 mz_uint flags);
304
325 const char* member,
326 const uint8_t* bytes,
327 size_t length,
328 mz_uint flags);
329
349 void* sink_ctx);
350
371 const char* path,
372 uint8_t* destination,
373 size_t capacity,
374 size_t* out_length);
375
395 size_t capacity,
396 const char* directory,
397 const char* leaf);
Package a downloaded chapter folder into a reader-openable container.
struct mdl_export_workspace mdl_export_workspace_t
Caller-owned bounded arena for all exporter scratch state.
ra8_err_t priv_mdl_export_zip_add_file(mz_zip_archive *zip, mdl_storage_t *storage, const char *member, const char *path, mz_uint flags)
Add one portable source file through miniz callbacks.
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_abort(mdl_export_output_t *output)
Abort one unpublished export stage, retaining cleanup failure.
size_t priv_mdl_export_zip_write(void *opaque, mz_uint64 file_offset, const void *bytes, size_t length)
Adapt random-offset miniz output to the active export stage.
ra8_err_t priv_mdl_export_output_commit(mdl_export_output_t *output, mdl_export_workspace_t *workspace, bool *out_published)
Structurally validate and publish one completed export stage.
ra8_err_t(* mdl_export_sink_fn_t)(void *ctx, const uint8_t *bytes, uint32_t length)
Portable archive-output sink signature.
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.
ra8_err_t priv_mdl_export_source_copy(mdl_export_source_t *source, mdl_export_sink_fn_t sink, void *sink_ctx)
Stream one portable source into a bounded caller sink.
ra8_err_t priv_mdl_export_output_begin(mdl_export_output_t *output, mdl_storage_t *storage, const char *destination, mdl_format_t format)
Bind a validated publication transaction to one destination.
ra8_err_t priv_mdl_export_source_close(mdl_export_source_t *source)
Close one open source and clear its retained binding.
ra8_err_t priv_mdl_export_output_write_at(void *opaque, uint64_t offset, const uint8_t *bytes, uint32_t length, uint32_t *out_written)
Write one complete span at an absolute active-stage offset.
ra8_err_t priv_mdl_export_output_write(mdl_export_output_t *output, const uint8_t *bytes, uint32_t length)
Append one complete byte span to an active export stage.
ra8_err_t priv_mdl_export_zip_add_memory(mz_zip_archive *zip, const char *member, const uint8_t *bytes, size_t length, mz_uint flags)
Add caller-owned memory through the deterministic ZIP read seam.
ra8_err_t priv_mdl_export_source_slurp(mdl_storage_t *storage, const char *path, uint8_t *destination, size_t capacity, size_t *out_length)
Read one complete bounded portable source into caller storage.
ra8_err_t priv_mdl_export_source_verify_close(mdl_export_source_t *source)
Verify the first source pass against an independent reread.
ra8_err_t priv_mdl_export_source_open(mdl_export_source_t *source, mdl_storage_t *storage, const char *path)
Open one regular source and snapshot its exact nonempty extent.
size_t priv_mdl_export_zip_read(void *opaque, mz_uint64 file_offset, void *destination, size_t capacity)
Adapt one sequential miniz source read to a portable file stream.
mdl_format_t
Artifact format selected by a media-download composition root.
Definition mdl_format.h:35
Injected portable storage resources for downloader domain code.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Caller-owned open file; fields are private to the facade.
One validated staged publication, including random ZIP backfill.
uint64_t extent
Greatest written byte edge.
uint64_t offset
Current staged write position.
mdl_storage_txn_t writer
Active storage transaction.
ra8_err_t error
First callback error, if any.
mdl_format_t format
Canonical verifier selection.
One open regular source with a snapshotted identity.
mdl_storage_t * storage
Borrowed exclusive storage binding.
uint32_t calls
Bounded read-call tally.
ra8_err_t error
First callback error, if any.
fw_fs_file_t file
Open portable source stream.
uint64_t hash
First-pass FNV identity.
uint64_t offset
Sequential callback cursor.
uint64_t size
Snapshotted source extent.
One non-reentrant downloader filesystem dependency bundle.
Definition mdl_storage.h:40
Caller-owned streaming publication transaction with running identity.
Definition mdl_storage.h:58