ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_export_io.c
Go to the documentation of this file.
1
13#include <limits.h>
14#include <stdio.h>
15#include <string.h>
16
18#include "mdl_hash.h"
19#include "mdl_verify.h"
20
22typedef enum : uint32_t {
23 k_export_io_calls = 2000001U,
25
34
36typedef struct {
37 const uint8_t* bytes;
38 size_t length;
39 size_t offset;
41
59{
60 if ((ctx == nullptr) || (staged == nullptr)) {
62 }
64 mdl_verify_report_t report = {};
65 const ra8_err_t err = mdl_verify_open_file(validation->storage,
66 validation->format,
67 staged,
68 validation->extent,
69 validation->workspace,
70 &report);
71 if (validation->workspace->high_water < validation->export_high_water) {
72 validation->workspace->high_water = validation->export_high_water;
73 }
74 return err;
75}
76
96 uint64_t offset,
97 const uint8_t* bytes,
98 size_t length)
99{
100 if ((offset > output->extent) || (length > (UINT64_MAX - offset))) {
102 }
103 ra8_err_t err = k_ra8_ok;
104 if (offset != output->offset) {
105 err = fw_fs_transaction_seek(&output->writer.transaction, offset);
106 }
107 size_t done = 0U;
108 while ((err == k_ra8_ok) && (done < length)) {
109 if (output->writer.write_calls >= (uint32_t)k_export_io_calls) {
111 }
112 const size_t remaining = length - done;
113 const uint32_t request = (remaining > UINT32_MAX) ? UINT32_MAX : (uint32_t)remaining;
114 uint32_t written = 0U;
115 err = fw_fs_transaction_write(&output->writer.transaction, bytes + done, request, &written);
116 ++output->writer.write_calls;
117 if ((err == k_ra8_ok) && (written == 0U)) {
119 }
120 done += written;
121 }
122 output->offset = offset + done;
123 if (output->offset > output->extent) {
124 output->extent = output->offset;
125 }
126 return err;
127}
128
130 mdl_storage_t* storage,
131 const char* destination,
132 mdl_format_t format)
133{
134 if ((output == nullptr) || (storage == nullptr) || (destination == nullptr) ||
135 !mdl_format_is_verifiable(format)) {
137 }
138 *output = (mdl_export_output_t){.format = format};
139 const ra8_err_t err = mdl_storage_txn_begin(&output->writer, storage, destination);
140 if (err != k_ra8_ok) {
141 *output = (mdl_export_output_t){};
142 }
143 return err;
144}
145
147 mdl_storage_t* storage,
148 const char* destination,
149 mdl_format_t format)
150{
151 if ((output == nullptr) || (storage == nullptr) || (destination == nullptr) ||
152 !mdl_format_is_verifiable(format)) {
154 }
155 *output = (mdl_export_output_t){.format = format};
156 const ra8_err_t err = mdl_storage_txn_begin_new(&output->writer, storage, destination);
157 if (err != k_ra8_ok) {
158 *output = (mdl_export_output_t){};
159 }
160 return err;
161}
162
164priv_mdl_export_output_write(mdl_export_output_t* output, const uint8_t* bytes, uint32_t length)
165{
166 if ((output == nullptr) || ((bytes == nullptr) && (length != 0U)) ||
167 !output->writer.transaction.active) {
169 }
170 const ra8_err_t err = internal_output_write_at(output, output->offset, bytes, length);
171 if ((err != k_ra8_ok) && (output->error == k_ra8_ok)) {
172 output->error = err;
173 }
174 return err;
175}
176
178 uint64_t offset,
179 const uint8_t* bytes,
180 uint32_t length,
181 uint32_t* out_written)
182{
183 mdl_export_output_t* output = (mdl_export_output_t*)opaque;
184 if (out_written != nullptr) {
185 *out_written = 0U;
186 }
187 if ((output == nullptr) || (out_written == nullptr) || ((bytes == nullptr) && (length != 0U)) ||
188 !output->writer.transaction.active || (output->error != k_ra8_ok)) {
190 }
191 const ra8_err_t err = internal_output_write_at(output, offset, bytes, length);
192 if (err != k_ra8_ok) {
193 output->error = err;
194 return err;
195 }
196 *out_written = length;
197 return k_ra8_ok;
198}
199
200size_t
201priv_mdl_export_zip_write(void* opaque, mz_uint64 file_offset, const void* bytes, size_t length)
202{
203 mdl_export_output_t* output = (mdl_export_output_t*)opaque;
204 if ((output == nullptr) || ((bytes == nullptr) && (length != 0U)) ||
205 !output->writer.transaction.active || (output->error != k_ra8_ok)) {
206 return 0U;
207 }
208 const ra8_err_t err =
209 internal_output_write_at(output, (uint64_t)file_offset, (const uint8_t*)bytes, length);
210 if (err != k_ra8_ok) {
211 output->error = err;
212 return 0U;
213 }
214 return length;
215}
216
218{
219 if (output == nullptr) {
221 }
222 const ra8_err_t err = mdl_storage_txn_abort(&output->writer);
223 if (err == k_ra8_ok) {
224 *output = (mdl_export_output_t){};
225 }
226 return err;
227}
228
230 mdl_export_workspace_t* workspace,
231 bool* out_published)
232{
233 if ((output == nullptr) || (workspace == nullptr) || (out_published == nullptr) ||
234 !output->writer.transaction.active) {
236 }
237 *out_published = false;
238 if (output->error != k_ra8_ok) {
239 const ra8_err_t primary = output->error;
240 const ra8_err_t aborted = priv_mdl_export_output_abort(output);
241 return (aborted == k_ra8_ok) ? primary : aborted;
242 }
243 internal_export_validation_t validation = {.storage = output->writer.storage,
244 .workspace = workspace,
245 .format = output->format,
246 .extent = output->extent,
247 .export_high_water = workspace->high_water};
250 (void*)&validation);
251 if (err == k_ra8_ok) {
252 err = fw_fs_transaction_commit(&output->writer.transaction, out_published);
253 }
254 if ((err == k_ra8_ok) && !*out_published) {
256 }
257 if ((err != k_ra8_ok) && output->writer.transaction.active) {
258 const ra8_err_t aborted = fw_fs_transaction_abort(&output->writer.transaction);
259 if (aborted != k_ra8_ok) {
260 return aborted;
261 }
262 }
263 if (!output->writer.transaction.active) {
264 *output = (mdl_export_output_t){};
265 }
266 return err;
267}
268
271{
272 if ((source == nullptr) || (storage == nullptr) || (storage->fs == nullptr) ||
273 (path == nullptr)) {
275 }
276 fw_fs_stat_t stat = {};
277 ra8_err_t err = fw_fs_stat(&storage->fs->names, path, &stat);
278 if (err != k_ra8_ok) {
279 return err;
280 }
281 if (!stat.exists) {
282 return k_ra8_err_not_found;
283 }
284 if (stat.type != k_fw_fs_node_file) {
286 }
287 if ((stat.size_bytes == 0U) || (stat.size_bytes > (uint64_t)k_mdl_hash_max_file_bytes)) {
289 }
290 *source = (mdl_export_source_t){.storage = storage,
291 .size = stat.size_bytes,
292 .hash = (uint64_t)k_mdl_fnv_offset};
293 err = fw_fs_open(&storage->fs->streams,
294 path,
296 &source->file,
297 storage->file_workspace,
298 storage->file_workspace_bytes);
299 uint64_t open_size = 0U;
300 if (err == k_ra8_ok) {
301 err = fw_fs_file_size(&source->file, &open_size);
302 }
303 if ((err == k_ra8_ok) && (open_size != source->size)) {
305 }
306 if ((err != k_ra8_ok) && source->file.is_open) {
307 (void)fw_fs_close(&source->file);
308 }
309 if (err != k_ra8_ok) {
310 *source = (mdl_export_source_t){};
311 }
312 return err;
313}
314
316{
317 if (source == nullptr) {
319 }
320 ra8_err_t err = k_ra8_ok;
321 if (source->file.is_open) {
322 err = fw_fs_close(&source->file);
323 }
324 if (err == k_ra8_ok) {
325 *source = (mdl_export_source_t){};
326 }
327 return err;
328}
329
330size_t
331priv_mdl_export_zip_read(void* opaque, mz_uint64 file_offset, void* destination, size_t capacity)
332{
333 mdl_export_source_t* source = (mdl_export_source_t*)opaque;
334 if ((source == nullptr) || (destination == nullptr) || !source->file.is_open ||
335 (source->error != k_ra8_ok) || ((uint64_t)file_offset != source->offset) ||
336 (source->offset > source->size)) {
337 if ((source != nullptr) && (source->error == k_ra8_ok)) {
339 }
340 return 0U;
341 }
342 const uint64_t remaining = source->size - source->offset;
343 size_t target = capacity;
344 if ((uint64_t)target > remaining) {
345 target = (size_t)remaining;
346 }
347 size_t done = 0U;
348 while ((done < target) && (source->error == k_ra8_ok)) {
349 if (source->calls >= (uint32_t)k_export_io_calls) {
351 break;
352 }
353 const size_t left = target - done;
354 const uint32_t request = (left > UINT32_MAX) ? UINT32_MAX : (uint32_t)left;
355 uint32_t got = 0U;
356 source->error = fw_fs_read(&source->file, (uint8_t*)destination + done, request, &got);
357 ++source->calls;
358 if ((source->error == k_ra8_ok) && (got == 0U)) {
360 }
361 source->hash = mdl_hash_bytes_seed((uint8_t*)destination + done, got, source->hash);
362 source->offset += got;
363 done += got;
364 }
365 return (source->error == k_ra8_ok) ? done : 0U;
366}
367
369{
370 if ((source == nullptr) || !source->file.is_open || (source->storage == nullptr)) {
372 }
373 ra8_err_t err = source->error;
374 if ((err == k_ra8_ok) && (source->offset != source->size)) {
376 }
377 uint64_t digest = 0U;
378 if (err == k_ra8_ok) {
379 err = fw_fs_seek(&source->file, 0U);
380 }
381 if (err == k_ra8_ok) {
382 err = mdl_hash_stream(&source->file,
383 source->size,
384 source->storage->io_buffer,
385 source->storage->io_buffer_bytes,
386 &digest);
387 }
388 if ((err == k_ra8_ok) && (digest != source->hash)) {
390 }
391 const ra8_err_t closed = fw_fs_close(&source->file);
392 if ((err == k_ra8_ok) && (closed != k_ra8_ok)) {
393 err = closed;
394 }
395 *source = (mdl_export_source_t){};
396 return err;
397}
398
400 mdl_storage_t* storage,
401 const char* member,
402 const char* path,
403 mz_uint flags)
404{
405 mdl_export_source_t source = {};
406 ra8_err_t err = priv_mdl_export_source_open(&source, storage, path);
407 if (err != k_ra8_ok) {
408 return err;
409 }
410 const mz_bool added = mz_zip_writer_add_read_buf_callback(zip,
411 member,
413 &source,
414 source.size,
415 nullptr,
416 nullptr,
417 0U,
418 flags,
419 nullptr,
420 0U,
421 nullptr,
422 0U);
423 if (added == MZ_FALSE) {
424 const ra8_err_t source_error = source.error;
425 const ra8_err_t closed = priv_mdl_export_source_close(&source);
426 if (source_error != k_ra8_ok) {
427 return source_error;
428 }
429 return (closed == k_ra8_ok) ? k_ra8_fail : closed;
430 }
431 const ra8_err_t verified = priv_mdl_export_source_verify_close(&source);
432 if (verified != k_ra8_ok) {
433 return verified;
434 }
435 return k_ra8_ok;
436}
437
455RA8_INTERNAL static size_t
456internal_memory_read(void* opaque, mz_uint64 offset, void* destination, size_t capacity)
457{
459 if ((memory == nullptr) || (destination == nullptr) || (offset != memory->offset) ||
460 (memory->offset > memory->length)) {
461 return 0U;
462 }
463 size_t amount = memory->length - memory->offset;
464 if (amount > capacity) {
465 amount = capacity;
466 }
467 memcpy(destination, &memory->bytes[memory->offset], amount);
468 memory->offset += amount;
469 return amount;
470}
471
473 const char* member,
474 const uint8_t* bytes,
475 size_t length,
476 mz_uint flags)
477{
478 if ((zip == nullptr) || (member == nullptr) || ((bytes == nullptr) && (length != 0U))) {
480 }
481 internal_export_memory_t memory = {.bytes = bytes, .length = length};
482 const mz_bool added = mz_zip_writer_add_read_buf_callback(zip,
483 member,
485 &memory,
486 length,
487 nullptr,
488 nullptr,
489 0U,
490 flags,
491 nullptr,
492 0U,
493 nullptr,
494 0U);
495 return ((added != MZ_FALSE) && (memory.offset == memory.length)) ? k_ra8_ok : k_ra8_fail;
496}
497
500{
501 if ((source == nullptr) || (sink == nullptr) || !source->file.is_open ||
502 (source->storage == nullptr)) {
504 }
505 while ((source->offset < source->size) && (source->error == k_ra8_ok)) {
506 const uint64_t remaining = source->size - source->offset;
507 uint32_t request = source->storage->io_buffer_bytes;
508 if ((uint64_t)request > remaining) {
509 request = (uint32_t)remaining;
510 }
511 const size_t got =
512 priv_mdl_export_zip_read(source, source->offset, source->storage->io_buffer, request);
513 if (got > 0U) {
514 source->error = sink(sink_ctx, source->storage->io_buffer, (uint32_t)got);
515 }
516 }
518}
519
521 const char* path,
522 uint8_t* destination,
523 size_t capacity,
524 size_t* out_length)
525{
526 if ((destination == nullptr) || (out_length == nullptr)) {
528 }
529 mdl_export_source_t source = {};
530 ra8_err_t err = priv_mdl_export_source_open(&source, storage, path);
531 if (err != k_ra8_ok) {
532 return err;
533 }
534 if ((source.size > capacity) || (source.size > SIZE_MAX)) {
535 (void)priv_mdl_export_source_close(&source);
537 }
538 const uint64_t expected = source.size;
539 const size_t got = priv_mdl_export_zip_read(&source, 0U, destination, (size_t)expected);
541 if ((err == k_ra8_ok) && (got != (size_t)expected)) {
543 }
544 if (err == k_ra8_ok) {
545 *out_length = got;
546 }
547 return err;
548}
549
551priv_mdl_export_path_join(char* out, size_t capacity, const char* directory, const char* leaf)
552{
553 if ((out == nullptr) || (capacity == 0U) || (directory == nullptr) || (leaf == nullptr)) {
555 }
556 const char* separator = (strcmp(directory, "/") == 0) ? "" : "/";
557 const int written = snprintf(out, capacity, "%s%s%s", directory, separator, leaf);
558 return ((written >= 0) && ((size_t)written < capacity)) ? k_ra8_ok : k_ra8_err_invalid_size;
559}
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.
Definition fw_if_fs.c:648
ra8_err_t fw_fs_transaction_seek(fw_fs_transaction_t *transaction, uint64_t absolute_offset)
Seek the staging writer to an absolute byte offset for bounded backfill.
Definition fw_if_fs.c:917
ra8_err_t fw_fs_transaction_abort(fw_fs_transaction_t *transaction)
Close and remove an unpublished staging artifact.
Definition fw_if_fs.c:976
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.
Definition fw_if_fs.c:480
ra8_err_t fw_fs_transaction_validate(fw_fs_transaction_t *transaction, fw_fs_validate_fn_t validator, void *validator_ctx)
Flush/reopen the stage and ask validator to inspect it read-only.
Definition fw_if_fs.c:929
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.
Definition fw_if_fs.c:699
ra8_err_t fw_fs_transaction_write(fw_fs_transaction_t *transaction, const uint8_t *source, uint32_t length, uint32_t *out_written)
Append bytes to the private staging artifact.
Definition fw_if_fs.c:892
ra8_err_t fw_fs_close(fw_fs_file_t *file)
Close and consume an open handle.
Definition fw_if_fs.c:783
ra8_err_t fw_fs_seek(fw_fs_file_t *file, uint64_t absolute_offset)
Seek to an absolute byte offset from the beginning.
Definition fw_if_fs.c:736
ra8_err_t fw_fs_transaction_commit(fw_fs_transaction_t *transaction, bool *out_published)
Publish a validated stage.
Definition fw_if_fs.c:951
ra8_err_t fw_fs_file_size(fw_fs_file_t *file, uint64_t *out_size)
Report the open file's current length.
Definition fw_if_fs.c:758
@ k_fw_fs_node_file
Regular byte stream.
@ k_fw_fs_open_read
Existing file, read-only.
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.
static ra8_err_t internal_output_write_at(mdl_export_output_t *output, uint64_t offset, const uint8_t *bytes, size_t length)
Write a complete byte span at one staged offset.
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.
mdl_export_io_limit_t
Bounded callback call count shared by archive stream adapters.
@ k_export_io_calls
Short-I/O progress ceiling.
static ra8_err_t internal_validate_stage(void *ctx, fw_fs_file_t *staged)
Dispatch structural validation for one staged artifact.
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.
static size_t internal_memory_read(void *opaque, mz_uint64 offset, void *destination, size_t capacity)
Serve a sequential ZIP read from immutable caller memory.
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.
Private portable byte-stream contracts for media exporters.
ra8_err_t(* mdl_export_sink_fn_t)(void *ctx, const uint8_t *bytes, uint32_t length)
Portable archive-output sink signature.
mdl_format_t
Artifact format selected by a media-download composition root.
Definition mdl_format.h:35
Content-identity hashing (FNV-1a 64) for the media downloader's persistent library state.
@ k_mdl_hash_max_file_bytes
Exact file hash bound.
Definition mdl_hash.h:37
@ k_mdl_fnv_offset
FNV-1a 64 offset basis.
Definition mdl_hash.h:35
ra8_err_t mdl_hash_stream(fw_fs_file_t *file, uint64_t file_size, uint8_t *buffer, uint32_t buffer_bytes, uint64_t *out)
Hash exactly one snapshotted extent from an already-open stream.
Definition mdl_hash.c:63
uint64_t mdl_hash_bytes_seed(const void *data, size_t len, uint64_t seed)
Continue an FNV-1a 64 fold over a byte range from a running state.
Definition mdl_hash.c:21
ra8_err_t mdl_storage_txn_begin_new(mdl_storage_txn_t *writer, mdl_storage_t *storage, const char *destination)
Begin one streamed create-new publication without replacement.
ra8_err_t mdl_storage_txn_abort(mdl_storage_txn_t *writer)
Abort and clear one streamed transaction.
ra8_err_t mdl_storage_txn_begin(mdl_storage_txn_t *writer, mdl_storage_t *storage, const char *destination)
Begin one streamed create or truthful atomic replacement.
Bounded, no-heap structural validation of mdl artifacts.
ra8_err_t mdl_verify_open_file(mdl_storage_t *storage, mdl_format_t format, fw_fs_file_t *file, uint64_t size_bytes, mdl_export_workspace_t *workspace, mdl_verify_report_t *report)
Validate an artifact through a borrowed open filesystem handle.
Definition mdl_verify.c:491
bool mdl_format_is_verifiable(mdl_format_t format)
Report whether a format has an in-process structural validator.
Definition mdl_verify.c:131
#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_fail
Generic unspecified failure.
Definition ra8_err.h:133
@ k_ra8_err_invalid_arg
Invalid function argument.
Definition ra8_err.h:152
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
Definition ra8_err.h:161
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
@ k_ra8_err_protocol_error
Protocol-level error (e.g.
Definition ra8_err.h:429
@ k_ra8_err_not_found
Requested item not found (lookup / search missed).
Definition ra8_err.h:173
@ k_ra8_err_invalid_size
Invalid size parameter (too large, too small, or misaligned).
Definition ra8_err.h:167
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
int strcmp(const char *s1, const char *s2)
Compare two null-terminated strings.
void * memcpy(void *dst, const void *src, size_t n)
Copy memory area between non-overlapping regions.
Caller-owned open file; fields are private to the facade.
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.
bool active
Begin succeeded.
Sequential view over one caller-owned ZIP memory member.
const uint8_t * bytes
Borrowed immutable payload.
size_t length
Complete payload extent.
size_t offset
Sequential read cursor.
Context retained while a staged artifact is structurally checked.
uint64_t extent
Exact staged extent.
mdl_format_t format
Exact artifact format.
mdl_export_workspace_t * workspace
Borrowed verifier arena.
size_t export_high_water
Pre-validation high-water.
mdl_storage_t * storage
Borrowed storage scratch.
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.
size_t high_water
Largest used value observed.
Definition mdl_export.h:221
One non-reentrant downloader filesystem dependency bundle.
Definition mdl_storage.h:40
uint32_t file_workspace_bytes
File workspace extent.
Definition mdl_storage.h:45
uint8_t * io_buffer
Caller-owned stream scratch.
Definition mdl_storage.h:44
const fw_fs_t * fs
Injected portable filesystem.
Definition mdl_storage.h:41
void * file_workspace
Open-file backend state.
Definition mdl_storage.h:42
uint32_t io_buffer_bytes
Stream scratch extent.
Definition mdl_storage.h:47
mdl_storage_t * storage
Exclusively borrowed storage binding.
Definition mdl_storage.h:59
fw_fs_transaction_t transaction
Active private filesystem stage.
Definition mdl_storage.h:60
uint32_t write_calls
Bounded backend write-call tally.
Definition mdl_storage.h:63