Skip to main content

Crate lamzfs

Crate lamzfs 

Source
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_id without a full import — used to group members into pools before import.
PoolMember
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§

EntryKind
The kind of a directory entry.
Error
A ZFS pool read or import failure.
LabelReason
Why a vdev label was rejected.
Location
Where in the read walk an Error::Inconsistent surfaced.

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::read will 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’s MAX_BOOT_FILE_BYTES). (SPEC-LAMZFS §2.5.)

Traits§

BlockRead
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 by PoolId::guid and pass each group to Zfs::import.