34static const char*
const s_tag =
"ra8_vfs_compress";
69 const uint8_t* blob_buf,
70 const uint32_t* out_blob_len)
127 uint32_t scratch_len,
130 uint32_t* out_blob_len)
137 uint32_t blob_len = 0;
139 ra8_compress(src, src_len, blob_buf, blob_cap, scratch, scratch_len, &blob_len),
146 *out_blob_len = blob_len;
180 const uint8_t* blob_buf,
182 const uint32_t* out_len)
226 uint32_t* out_blob_len)
230 uint32_t blob_len = 0;
239 if (blob_len >= blob_cap) {
242 *out_blob_len = blob_len;
257 uint32_t blob_len = 0;
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
App-domain DEFLATE compress / decompress (zero-heap, firmware-safe).
ra8_err_t ra8_decompress(const uint8_t *src, uint32_t src_len, uint8_t *out, uint32_t out_cap, uint32_t *out_len)
Raw-DEFLATE decompress src into out.
ra8_err_t ra8_compress(const uint8_t *src, uint32_t src_len, uint8_t *out, uint32_t out_cap, void *scratch, uint32_t scratch_len, uint32_t *out_len)
Raw-DEFLATE compress src into out.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ 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.
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
ra8_err_t ra8_fs_write(ra8_fs_file_t *file, const uint8_t *buf, uint32_t len)
Write len bytes; allocate new clusters from FAT free-space scan as needed.
ra8_err_t ra8_fs_read(ra8_fs_file_t *file, uint8_t *buf, uint32_t max_len, uint32_t *got_len)
Read up to max_len bytes; advance the cluster chain on cluster crossings.
ra8_err_t ra8_fs_close(ra8_fs_file_t *file)
Close an open file, stamping its final modification time.
@ k_ra8_fs_mode_read
Read-only, must exist.
@ k_ra8_fs_mode_write
Truncate (or create) for writing.
ra8_io virtual filesystem – mount many volumes, address them by name.
ra8_err_t ra8_io_vfs_open(const char *path, ra8_fs_mode_t mode, ra8_fs_file_t **out_file)
Open a file by "name:/path".
static ra8_err_t internal_ra8_vfs_compress_store_blob(const char *path, const uint8_t *blob, uint32_t blob_len)
Open path for write, stream the compressed blob, and close.
static ra8_err_t internal_ra8_vfs_compress_write_validate(const char *path, const uint8_t *src, const void *scratch, const uint8_t *blob_buf, const uint32_t *out_blob_len)
Validate the five caller pointers handed to ra8_vfs_compress_write.
ra8_err_t ra8_vfs_compress_read(const char *path, uint8_t *blob_buf, uint32_t blob_cap, uint8_t *out, uint32_t out_cap, uint32_t *out_len)
Read a whole compressed file through the VFS and decompress it.
static ra8_err_t internal_ra8_vfs_compress_read_validate(const char *path, const uint8_t *blob_buf, const uint8_t *out, const uint32_t *out_len)
Validate the four caller pointers handed to ra8_vfs_compress_read.
static ra8_err_t internal_ra8_vfs_compress_load_blob(const char *path, uint8_t *blob_buf, uint32_t blob_cap, uint32_t *out_blob_len)
Open path for read, pull the whole blob into blob_buf, and close.
ra8_err_t ra8_vfs_compress_write(const char *path, const uint8_t *src, uint32_t src_len, void *scratch, uint32_t scratch_len, uint8_t *blob_buf, uint32_t blob_cap, uint32_t *out_blob_len)
Compress a payload and store it as a whole file through the VFS.
Transparent VFS-level whole-file compression (compress-on-write,decompress-on-read) over the ra8_io f...