implements PLN-0058
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
use crate::fs::{FsBackend, FsState};
|
||||
use crate::os::SystemOS;
|
||||
|
||||
pub struct FsFacade<'a> {
|
||||
pub(in crate::os) os: &'a mut SystemOS,
|
||||
}
|
||||
|
||||
impl<'a> FsFacade<'a> {
|
||||
pub fn needs_mount(&self) -> bool {
|
||||
matches!(self.os.fs_state, FsState::Unmounted | FsState::Error(_))
|
||||
}
|
||||
|
||||
pub fn mount(&mut self, backend: Box<dyn FsBackend>) {
|
||||
self.os.vm_runtime.mount_fs(
|
||||
&mut self.os.log_service,
|
||||
&mut self.os.fs,
|
||||
&mut self.os.fs_state,
|
||||
backend,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn unmount(&mut self) {
|
||||
self.os.fs.unmount();
|
||||
self.os.fs_state = FsState::Unmounted;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user