Skip to main content

Crate zoned

Crate zoned 

Source
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 DIOCZONECMD ioctl.

§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§

BlockSizes
Logical and physical block sizes.
DeviceBuilder
Builder for opening a ZonedDevice with optional validation checks.
DeviceGeometry
Device geometry: zone layout and capacity.
DeviceIdentity
Device vendor and model identification from sysfs.
DeviceInfo
Device-level information about a zoned block device.
DeviceLimits
Device I/O and zone limits.
DeviceProperties
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.
ZoneAllocator
Manages exclusive zone ownership for safe concurrent access.
ZoneFilter
A composable filter for selecting zones by type and/or condition.
ZoneHandle
Exclusive handle to a single zone on a zoned block device.
ZoneIndex
A zone index on a zoned block device.
ZoneIterator
Lazily iterates over all zones on a device, fetching in batches.
ZonedDevice
Handle to an open zoned block device.
ZonedDeviceCursor
A cursor wrapping a ZonedDevice that implements Read, Write, and Seek.

Enums§

DeviceModel
Model (type) of a zoned block device.
ZoneCondition
Current condition (state) of a zone.
ZoneType
Type of a zone on a zoned block device.
ZonedError
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>.