Skip to content
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
4 changes: 3 additions & 1 deletion src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ pub(crate) fn init() {

#[cfg(all(feature = "fuse", feature = "pci"))]
fuse::init();
uhyve::init();
if crate::env::is_uhyve() {
uhyve::init();
}
}

pub fn create_file(name: &str, data: &'static [u8], mode: AccessPermission) -> io::Result<()> {
Expand Down
23 changes: 10 additions & 13 deletions src/fs/uhyve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use uhyve_interface::parameters::{
use uhyve_interface::{GuestPhysAddr, GuestVirtAddr, Hypercall};

use crate::arch::mm::paging;
use crate::env::is_uhyve;
use crate::errno::Errno;
use crate::fs::{
self, AccessPermission, FileAttr, NodeKind, ObjectInterface, OpenOption, SeekWhence, VfsNode,
Expand Down Expand Up @@ -230,16 +229,14 @@ impl VfsNode for UhyveDirectory {

pub(crate) fn init() {
info!("Try to initialize uhyve filesystem");
if is_uhyve() {
let mount_point = hermit_var_or!("UHYVE_MOUNT", "/root").to_string();
info!("Mounting uhyve filesystem at {mount_point}");
fs::FILESYSTEM
.get()
.unwrap()
.mount(
&mount_point,
Box::new(UhyveDirectory::new(Some(mount_point.clone()))),
)
.expect("Mount failed. Duplicate mount_point?");
}
let mount_point = hermit_var_or!("UHYVE_MOUNT", "/root").to_string();
info!("Mounting uhyve filesystem at {mount_point}");
fs::FILESYSTEM
.get()
.unwrap()
.mount(
&mount_point,
Box::new(UhyveDirectory::new(Some(mount_point.clone()))),
)
.expect("Mount failed. Duplicate mount_point?");
}