diff --git a/ecstore/src/utils/os/linux.rs b/ecstore/src/utils/os/linux.rs index 1e923727b..2616d9d83 100644 --- a/ecstore/src/utils/os/linux.rs +++ b/ecstore/src/utils/os/linux.rs @@ -20,30 +20,24 @@ pub fn get_info(p: impl AsRef) -> std::io::Result { let reserved = match bfree.checked_sub(bavail) { Some(reserved) => reserved, None => { - return Err(Error::new( - ErrorKind::Other, - format!( - "detected f_bavail space ({}) > f_bfree space ({}), fs corruption at ({}). please run 'fsck'", - bavail, - bfree, - p.as_ref().display() - ), - )); + return Err(Error::other(format!( + "detected f_bavail space ({}) > f_bfree space ({}), fs corruption at ({}). please run 'fsck'", + bavail, + bfree, + p.as_ref().display() + ))); } }; let total = match blocks.checked_sub(reserved) { Some(total) => total * bsize, None => { - return Err(Error::new( - ErrorKind::Other, - format!( - "detected reserved space ({}) > blocks space ({}), fs corruption at ({}). please run 'fsck'", - reserved, - blocks, - p.as_ref().display() - ), - )); + return Err(Error::other(format!( + "detected reserved space ({}) > blocks space ({}), fs corruption at ({}). please run 'fsck'", + reserved, + blocks, + p.as_ref().display() + ))); } }; @@ -51,15 +45,12 @@ pub fn get_info(p: impl AsRef) -> std::io::Result { let used = match total.checked_sub(free) { Some(used) => used, None => { - return Err(Error::new( - ErrorKind::Other, - format!( - "detected free space ({}) > total drive space ({}), fs corruption at ({}). please run 'fsck'", - free, - total, - p.as_ref().display() - ), - )); + return Err(Error::other(format!( + "detected free space ({}) > total drive space ({}), fs corruption at ({}). please run 'fsck'", + free, + total, + p.as_ref().display() + ))); } }; @@ -121,7 +112,7 @@ pub fn get_drive_stats(major: u32, minor: u32) -> Result { fn read_drive_stats(stats_file: &str) -> Result { let stats = read_stat(stats_file)?; if stats.len() < 11 { - return Err(Error::new(ErrorKind::Other, format!("found invalid format while reading {}", stats_file))); + return Err(Error::other(format!("found invalid format while reading {}", stats_file))); } let mut io_stats = IOStats { read_ios: stats[0],