Skip to content

Commit

Permalink
refactor(csi-driver): replace MountIters with SafeMountIters
Browse files Browse the repository at this point in the history
Ref: openebs/mayastor-dependencies#65

Signed-off-by: Niladri Halder <[email protected]>
  • Loading branch information
niladrih committed Feb 20, 2024
1 parent 29d2d93 commit 4884741
Show file tree
Hide file tree
Showing 2 changed files with 7 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.

6 changes: 3 additions & 3 deletions control-plane/csi-driver/src/bin/node/mount.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Utility functions for mounting and unmounting filesystems.
use crate::filesystem_ops::FileSystem;
use csi_driver::filesystem::FileSystem as Fs;
use devinfo::mountinfo::{MountInfo, MountIter};
use devinfo::mountinfo::{MountInfo, SafeMountIter};

use std::{collections::HashSet, io::Error};
use sys_mount::{unmount, FilesystemType, Mount, MountFlags, UnmountFlags};
Expand Down Expand Up @@ -31,7 +31,7 @@ impl ReadOnly for &str {
pub(crate) fn find_mount(source: Option<&str>, target: Option<&str>) -> Option<MountInfo> {
let mut found: Option<MountInfo> = None;

for mount in MountIter::new().unwrap().flatten() {
for mount in SafeMountIter::get().unwrap().flatten() {
if let Some(value) = source {
if mount.source.to_string_lossy() == value {
if let Some(value) = target {
Expand All @@ -57,7 +57,7 @@ pub(crate) fn find_mount(source: Option<&str>, target: Option<&str>) -> Option<M
/// Return all mounts for a matching source.
/// Optionally ignore the given destination path.
pub(crate) fn find_src_mounts(source: &str, dest_ignore: Option<&str>) -> Vec<MountInfo> {
MountIter::new()
SafeMountIter::get()
.unwrap()
.flatten()
.filter(|mount| {
Expand Down

0 comments on commit 4884741

Please sign in to comment.