17typedef enum : uint64_t {
23 if ((data ==
nullptr) || (len == 0U)) {
26 const uint8_t* p = (
const uint8_t*)data;
28 for (
size_t i = 0U; i < len; ++i) {
66 uint32_t buffer_bytes,
69 if ((file ==
nullptr) || (buffer ==
nullptr) || (buffer_bytes == 0U) || (out ==
nullptr)) {
75 uint64_t remaining = file_size;
79 if (remaining != 0U) {
80 want = (remaining < (uint64_t)buffer_bytes) ? (uint32_t)remaining : buffer_bytes;
87 if (remaining == 0U) {
94 if ((got == 0U) || ((uint64_t)got > remaining)) {
98 remaining -= (uint64_t)got;
105 if ((storage ==
nullptr) || (storage->
fs ==
nullptr) || (path ==
nullptr) || (out ==
nullptr)) {
132 uint64_t digest = 0U;
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.
@ k_fw_fs_node_file
Regular byte stream.
@ k_fw_fs_open_read
Existing file, read-only.
mdl_hash_bound_t
Exact regular-file bound accepted by mdl_hash_file.
@ k_hash_max_read_calls
Short-read + EOF call ceiling.
uint64_t mdl_hash_bytes(const void *data, size_t len)
FNV-1a 64 hash of a byte range.
ra8_err_t mdl_hash_file(mdl_storage_t *storage, const char *path, uint64_t *out)
FNV-1a 64 hash of a file's full contents.
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)
Fold an exact regular-file extent into a running FNV state.
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.
uint64_t mdl_hash_str(const char *s)
FNV-1a 64 hash of a NUL-terminated string (excluding the NUL).
Content-identity hashing (FNV-1a 64) for the media downloader's persistent library state.
@ k_mdl_fnv_prime
FNV-1a 64 prime.
@ k_mdl_hash_max_file_bytes
Exact file hash bound.
@ k_mdl_fnv_offset
FNV-1a 64 offset basis.
Annotation-attribute framework macros for ra8-firmware.
@ k_ra8_fail
Generic unspecified failure.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_not_found
Requested item not found (lookup / search missed).
@ 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.
size_t strlen(const char *s)
Calculate string length.
Caller-owned open file; fields are private to the facade.
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 non-reentrant downloader filesystem dependency bundle.
uint32_t file_workspace_bytes
File workspace extent.
uint8_t * io_buffer
Caller-owned stream scratch.
const fw_fs_t * fs
Injected portable filesystem.
void * file_workspace
Open-file backend state.
uint32_t io_buffer_bytes
Stream scratch extent.