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 21, 2024
1 parent c6fe079 commit 9dee1de
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 28 deletions.
25 changes: 3 additions & 22 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion io-engine-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ nix = "0.27.1"
once_cell = "1.18.0"
parking_lot = "0.12.1"
pin-utils = "0.1.0"
proc-mounts = "0.3.0"
prost = "0.12.1"
prost-derive = "0.12.1"
rand = "0.8.5"
Expand Down
2 changes: 1 addition & 1 deletion io-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ nix = { version = "0.27.1", default-features = false, features = [ "hostname", "
once_cell = "1.18.0"
parking_lot = "0.12.1"
pin-utils = "0.1.0"
proc-mounts = "0.3.0"
prost = "0.12.1"
prost-derive = "0.12.1"
rand = "0.8.5"
Expand All @@ -98,6 +97,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
7 changes: 3 additions & 4 deletions io-engine/src/host/blk_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
//! of consistency, the mount table is also checked to ENSURE that the device
//! is not mounted)

use crate::constants::{NEXUS_CAS_DRIVER, NVME_CONTROLLER_MODEL_ID};
use devinfo::mountinfo::{MountInfo, SafeMountIter};
use std::{
collections::HashMap,
ffi::{OsStr, OsString},
io::Error,
};

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

// Struct representing a property value in a udev::Device struct (and possibly
Expand Down Expand Up @@ -278,7 +277,7 @@ 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()?.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 9dee1de

Please sign in to comment.