Expand description
Pure Rust library for zoned block device management (SMR/ZNS).
Provides a safe, idiomatic interface for interacting with zoned block devices such as Shingled Magnetic Recording (SMR) hard drives and Zoned Namespace (ZNS) NVMe SSDs.
§Platform Support
- Linux: Full support via kernel ioctls (
BLKREPORTZONE, etc.) and sysfs. - FreeBSD: Support via
DIOCZONECMDioctl.
§Example
use zoned::{Sector, ZonedDevice, sysfs};
// Check device model via sysfs
let props = sysfs::device_properties("/dev/sdb".as_ref())?;
println!("Model: {:?}, {} zones", props.model, props.geometry.nr_zones);
// Open the device and query zones
let dev = ZonedDevice::open("/dev/sdb")?;
let zones = dev.report_zones(Sector::ZERO, 32)?;
for zone in &zones {
println!("Zone at sector {}: {:?} ({:?})",
zone.start, zone.zone_type, zone.condition);
}Modules§
- sysfs
- Query zoned block device properties.
- validate
- Device validation functions for zoned block devices.
Structs§
- Block
Sizes - Logical and physical block sizes.
- Device
Builder - Builder for opening a
ZonedDevicewith optional validation checks. - Device
Geometry - Device geometry: zone layout and capacity.
- Device
Identity - Device vendor and model identification from sysfs.
- Device
Info - Device-level information about a zoned block device.
- Device
Limits - Device I/O and zone limits.
- Device
Properties - Extended device information read from sysfs.
- Sector
- A sector offset or count in 512-byte sectors.
- Zone
- Descriptor for a single zone on the device.
- Zone
Allocator - Manages exclusive zone ownership for safe concurrent access.
- Zone
Filter - A composable filter for selecting zones by type and/or condition.
- Zone
Handle - Exclusive handle to a single zone on a zoned block device.
- Zone
Index - A zone index on a zoned block device.
- Zone
Iterator - Lazily iterates over all zones on a device, fetching in batches.
- Zoned
Device - Handle to an open zoned block device.
- Zoned
Device Cursor - A cursor wrapping a
ZonedDevicethat implementsRead,Write, andSeek.
Enums§
- Device
Model - Model (type) of a zoned block device.
- Zone
Condition - Current condition (state) of a zone.
- Zone
Type - Type of a zone on a zoned block device.
- Zoned
Error - Errors that can occur when interacting with zoned block devices.
Constants§
- SECTOR_
SIZE - All sector values in this crate use 512-byte sectors, regardless of the device’s physical or logical block size. This matches the Linux kernel’s zoned block device interface.
Type Aliases§
- Result
- Alias for
std::result::Result<T, ZonedError>.