diff --git a/src/tools/disks.rs b/src/tools/disks.rs index d21cc8df..76318c6c 100644 --- a/src/tools/disks.rs +++ b/src/tools/disks.rs @@ -106,6 +106,12 @@ impl DiskManage { }) } + /// Get a `Disk` for a name in `/sys/block/`. + pub fn disk_by_name(self: Arc, name: &str) -> io::Result { + let syspath = format!("/sys/block/{}", name); + self.disk_by_sys_path(&syspath) + } + /// Gather information about mounted disks: fn mounted_devices(&self) -> Result<&HashSet, Error> { use std::os::unix::fs::MetadataExt;