src/tools/disks.rs: new helper disk_by_name()
This commit is contained in:
parent
ff30caeaf8
commit
042afd6e52
|
@ -106,6 +106,12 @@ impl DiskManage {
|
|||
})
|
||||
}
|
||||
|
||||
/// Get a `Disk` for a name in `/sys/block/<name>`.
|
||||
pub fn disk_by_name(self: Arc<Self>, name: &str) -> io::Result<Disk> {
|
||||
let syspath = format!("/sys/block/{}", name);
|
||||
self.disk_by_sys_path(&syspath)
|
||||
}
|
||||
|
||||
/// Gather information about mounted disks:
|
||||
fn mounted_devices(&self) -> Result<&HashSet<dev_t>, Error> {
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
|
|
Loading…
Reference in New Issue