Skip to content

Commit

Permalink
refactor(io-engine): use SafeMountIter instead of proc_mounts::MountIter
Browse files Browse the repository at this point in the history
Ref: openebs/mayastor-dependencies#65

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
  • Loading branch information
niladrih committed Feb 19, 2024
1 parent 9592602 commit 6259f6e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions io-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ async-process = { version = "1.8.1" }
rstack = { version = "0.3.3" }
tokio-stream = "0.1.14"

devinfo = { path = "../utils/dependencies/devinfo" }
jsonrpc = { path = "../jsonrpc"}
io-engine-api = { path = "../utils/dependencies/apis/io-engine" }
spdk-rs = { path = "../spdk-rs" }
Expand Down
9 changes: 6 additions & 3 deletions io-engine/src/host/blk_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ use std::{
collections::HashMap,
ffi::{OsStr, OsString},
io::Error,
io::ErrorKind
};

use crate::constants::{NEXUS_CAS_DRIVER, NVME_CONTROLLER_MODEL_ID};
use proc_mounts::{MountInfo, MountIter};
use devinfo::mountinfo::{MountInfo, SafeMountIter};
use udev::{Device, Enumerator};

// Struct representing a property value in a udev::Device struct (and possibly
Expand Down Expand Up @@ -278,7 +278,10 @@ fn new_device(
fn get_mounts() -> Result<HashMap<OsString, Vec<MountInfo>>, Error> {
let mut table: HashMap<OsString, Vec<MountInfo>> = HashMap::new();

for mount in (MountIter::new()?).flatten() {
for mount in SafeMountIter::get()
.map_err(|err| Error::new(ErrorKind::Other, err))?
.flatten()
{
let mount_source = OsString::from(mount.source.clone());
if !table.contains_key(&mount_source) {
table.insert(mount_source.clone(), Vec::new());
Expand Down

0 comments on commit 6259f6e

Please sign in to comment.