Skip to main content

Crate partitions

Crate partitions 

Source
Expand description

Partition-table probe (GPT/MBR) and filesystem-magic sniffer over any random-access block source.

See the crate-level README for design and scope.

Block-device abstractions come from fs_core; this crate re-exports the bits most consumers will use so callers can use partitions::BlockRead; without an extra dependency line.

Re-exports§

pub use error::Error;
pub use error::Result;
pub use mutation::PartitionRef;
pub use mutation::PartitionSet;
pub use mutation::PartitionTypeId;
pub use probe::probe;
pub use probe::Partition;
pub use probe::PartitionKind;
pub use probe::TableKind;
pub use sniff::sniff;
pub use sniff::FsKind;

Modules§

capi
C ABI for partition probing and FS sniffing.
error
gpt
GPT (GUID Partition Table) primary header + partition entry array.
gpt_write
GPT writer.
mbr
MBR (Master Boot Record) partition table.
mutation
Partition-table mutation API.
probe
Top-level probe: try GPT first, fall back to MBR. Logical (extended-MBR) chains are not walked yet — the four primary entries are reported as-is.
sniff
Filesystem-magic sniffer. Reads a small window from the start of a partition and identifies the filesystem by its on-disk signature. This does NOT validate the filesystem — it just answers “what is this likely to be?” The driver itself does proper validation when mounting.

Structs§

FileBlock
OwnedSlice
Owned slice over an Arc<dyn BlockRead>. Use when the parent’s lifetime can’t be expressed in a borrow — e.g. when the slice is handed across an FFI boundary or stored in a long-lived struct.
SliceReader
Borrowed slice of a parent BlockRead.

Traits§

BlockDevice
Read-write random-access block device. Implementors that genuinely support writes override write_at / flush / is_writable. The defaults model a strict read-only device.
BlockRead
Read-only random-access block device.