Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(io-engine): use SafeMountIter instead of proc_mounts::MountIter #1591

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading