|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Shared seek+read seam and flat-memory backing for the unarchivers. More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | unarch_mem_t |
| Bounded flat-memory backing for unarch_read_fn. More... | |
Typedefs | |
| typedef size_t(* | unarch_read_fn) (void *ctx, uint64_t offset, void *buf, size_t len) |
| Seek+read backing over an archive's bytes. | |
Functions | |
| size_t | unarch_mem_read (void *ctx, uint64_t offset, void *buf, size_t len) |
| unarch_read_fn over a flat unarch_mem_t view. | |
Shared seek+read seam and flat-memory backing for the unarchivers.
Every decoder in unarch (tar walker, gzip member, XZ stream) consumes its untrusted input through the same seek+read function shape the streaming EPUB / CBZ / CBR readers already use, so one ra8_fs file or ra8_vmem page-cache backing drives every container format identically. This header owns that typedef plus the one trivial backing everybody needs: a bounded flat-memory view (unarch_mem_t + unarch_mem_read) used to re-open the decompressed bytes of a wrapped archive (.tar.gz, .tar.xz) without copying them again.
Definition in file unarch_io.h.
| typedef size_t(* unarch_read_fn) (void *ctx, uint64_t offset, void *buf, size_t len) |
Seek+read backing over an archive's bytes.
Identical in shape to comic_read_fn / ra8_rar_read_fn: an absolute offset plus a byte count in, bytes-actually-read out. A return shorter than len signals end-of-file (or a backing error); the decoders treat any short read fail-closed.
| [in] | ctx | Opaque backing context. |
| [in] | offset | Absolute byte offset within the archive. |
| [out] | buf | Destination buffer (len writable bytes). |
| [in] | len | Bytes requested. |
Definition at line 55 of file unarch_io.h.
|
nodiscard |
unarch_read_fn over a flat unarch_mem_t view.
Serves [offset, offset + len) clamped to the view's bounds by plain copy. Reads at or past the end return 0 (EOF); a NULL context or view base also returns 0, which every decoder treats as a failed read (fail-closed).
| [in] | ctx | The unarch_mem_t view (may be NULL: reads 0). |
| [in] | offset | Absolute byte offset within the view. |
| [out] | buf | Destination buffer (len writable bytes, non-NULL). |
| [in] | len | Bytes requested. |
| 0 | NULL view / NULL destination, EOF, or a zero-length request. |
buf holds len writable bytes when len > 0. buf are written; nothing else changes. Definition at line 24 of file unarch_io.c.
References unarch_mem_t::base, unarch_mem_t::len, and memcpy().
Referenced by internal_open_unwrapped().