Expand description
lamzfs — a no_std + alloc read-only ZFS pool reader for UEFI
bootloaders.
lamzfs reads kernels, initrds, and boot configuration directly from a ZFS
pool (the unencrypted bpool of an Ubuntu/Debian Root-on-ZFS install) without
the OpenZFS kernel module, without std, and without a GPL UEFI filesystem
driver. Scope is deliberately narrow (SPEC-LAMZFS §1): import a single /
mirror / raidz1 pool, walk to one dataset, read its files; reject everything
else with a typed error.
In development. The on-disk decoders are vendored from rzfs
(github.com/cybojanek/rzfs, dual GPL-2.0 OR MIT; MIT elected — see
NOTICE); the orchestration (pool import, vdev routing, dataset walk,
path resolve, file read with decompression) is new lamzfs code.
Read-only by construction: no write path, no BlockWrite, no mutating call
site.
Structs§
- DirEntry
- A directory entry: a decoded name, its kind, and its object number within the selected dataset.
- PoolId
- A pool’s identity, read from a single member’s label by
peek_pool_idwithout a full import — used to group members into pools before import. - Pool
Member - One pool member handed to
crate::Zfs::import: a reader plus the byte length of that partition (accepted for device-bounds parity / future checks). - Stat
- Metadata for a path within a dataset: its kind and, for a regular file, its logical size in bytes (0 for non-files).
- Zfs
- An imported, read-only ZFS pool with one active dataset presented as a
single-rooted filesystem. Built by
Zfs::import.
Enums§
- Entry
Kind - The kind of a directory entry.
- Error
- A ZFS pool read or import failure.
- Label
Reason - Why a vdev label was rejected.
- Location
- Where in the read walk an
Error::Inconsistentsurfaced.
Constants§
- MAX_
DATASETS - Upper bound on datasets returned by
Zfs::datasets— a crafted DSL tree cannot drive an unbounded enumeration (SPEC-LAMZFS §2.5). - MAX_
DATASET_ DEPTH - Upper bound on dataset nesting depth walked by
Zfs::datasets. - MAX_
FILE_ BYTES - Largest file
Zfs::readwill allocate up front. A hostile dnode can declare a multi-GiB logical size while occupying almost no real blocks (a holey file); this cap refuses the allocation rather than letting it abort the boot (mirrors lamboot’sMAX_BOOT_FILE_BYTES). (SPEC-LAMZFS §2.5.)
Traits§
- Block
Read - Block-level reads for ONE leaf device of a pool. Identical in shape to
lambutter::BlockRead/lamxfs::BlockRead, so a consumer that already provides one needs only a one-line adapter.
Functions§
- peek_
pool_ id - Read one member device’s pool identity (
guid,name) from its vdev label, without importing the pool. A host may carry members of several pools; group them byPoolId::guidand pass each group toZfs::import.