diff options
Diffstat (limited to 'init/src/mounts')
| -rw-r--r-- | init/src/mounts/fstab.rs | 17 | ||||
| -rw-r--r-- | init/src/mounts/rescue.rs | 3 |
2 files changed, 12 insertions, 8 deletions
diff --git a/init/src/mounts/fstab.rs b/init/src/mounts/fstab.rs index c0cfd58..b8708e2 100644 --- a/init/src/mounts/fstab.rs +++ b/init/src/mounts/fstab.rs @@ -1,7 +1,7 @@ -use crate::log::{log_critical_error, log_warning, log_success}; +use crate::log::{log_critical_error, log_success, log_warning}; +use libc::syscall; use std::ffi::CString; use std::{fmt, fs}; -use libc::syscall; #[derive(Debug)] pub struct FstabEntry { @@ -114,15 +114,20 @@ impl FstabEntry { Ok((flags, data)) } - pub fn mount(&self) -> Result<(), Box<dyn std::error::Error>> { - log_success(&format!("Started mounting {} from {}", self.mountpoint, self.source)); + log_success(&format!( + "Started mounting {} from {}", + self.mountpoint, self.source + )); if self.fstype == "swap" { - log_success(&format!("Filesystem type contains swap, upping it: {}", self.source)); + log_success(&format!( + "Filesystem type contains swap, upping it: {}", + self.source + )); unsafe { - syscall(libc::SYS_swapon, &self.source, 0); + syscall(libc::SYS_swapon, &self.source, 0); } return Ok(()); diff --git a/init/src/mounts/rescue.rs b/init/src/mounts/rescue.rs index ad80a84..078984d 100644 --- a/init/src/mounts/rescue.rs +++ b/init/src/mounts/rescue.rs @@ -31,11 +31,10 @@ pub fn mount_system() -> Result<(), Box<dyn std::error::Error>> { ); if ret != 0 { - let errno = errno::errno().0; return Err(format!( "Failed to mount {}: {}", target, - std::io::Error::from_raw_os_error(errno) + std::io::Error::last_os_error() ) .into()); } |
