Skip to content
Merged
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
18 changes: 8 additions & 10 deletions src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,18 +304,17 @@ pub(crate) fn init() {
const VERSION: &str = env!("CARGO_PKG_VERSION");
const UTC_BUILT_TIME: &str = build_time::build_time_utc!();

FILESYSTEM.set(Filesystem::new()).unwrap();
FILESYSTEM
.get()
.unwrap()
let root_filesystem = Filesystem::new();

root_filesystem
.mkdir("/tmp", AccessPermission::from_bits(0o777).unwrap())
.expect("Unable to create /tmp");
FILESYSTEM
.get()
.unwrap()
root_filesystem
.mkdir("/proc", AccessPermission::from_bits(0o777).unwrap())
.expect("Unable to create /proc");

FILESYSTEM.set(root_filesystem).unwrap();

if let Ok(mut file) = File::create("/proc/version") {
if write!(file, "Hermit version {VERSION} # UTC {UTC_BUILT_TIME}").is_err() {
error!("Unable to write in /proc/version");
Expand All @@ -324,12 +323,11 @@ pub(crate) fn init() {
error!("Unable to create /proc/version");
}

let mut cwd = WORKING_DIRECTORY.lock();
*cwd = Some("/tmp".to_owned());
drop(cwd);
*WORKING_DIRECTORY.lock() = Some("/tmp".to_owned());

#[cfg(feature = "virtio-fs")]
virtio_fs::init();

if crate::env::is_uhyve() {
uhyve::init();
}
Expand Down
Loading