NOT ONE, but TWO deadlocks fixed!

This commit is contained in:
TheOddGarlic 2022-08-06 22:27:25 +03:00
parent 70342c5f46
commit 960da43383
2 changed files with 7 additions and 5 deletions

View file

@ -39,8 +39,8 @@ where
pub fn init() -> Result<()> { pub fn init() -> Result<()> {
let mut state = KERNEL_STATE.lock(); let mut state = KERNEL_STATE.lock();
let mut vfs = VFS.lock();
let fs = load_fs()?; let fs = load_fs()?;
let mut vfs = VFS.lock();
vfs.init(fs.root_node()); vfs.init(fs.root_node());
state.add_storage_device(fs); state.add_storage_device(fs);
Ok(()) Ok(())
@ -56,9 +56,12 @@ fn load_fs() -> Result<Ext2StorageDevice<Size1024, Vec<u8>>> {
pub fn walk<S: Into<String>>(dir: Arc<FsNode>, path: S) { pub fn walk<S: Into<String>>(dir: Arc<FsNode>, path: S) {
let path = path.into(); let path = path.into();
if let Some(dir) = dir.directory() { if let Some(dir) = dir.directory() {
let mut vfs = VFS.lock();
for entry in dir { for entry in dir {
let fs_node = vfs.fs_node(entry.node()).unwrap(); let fs_node = {
let mut vfs = VFS.lock();
vfs.fs_node(entry.node()).unwrap()
};
println!("{}/{} => {}", path, entry.name(), fs_node.inode()); println!("{}/{} => {}", path, entry.name(), fs_node.inode());
trace!("{entry:#?}"); trace!("{entry:#?}");
if entry.name() != "." && entry.name() != ".." { if entry.name() != "." && entry.name() != ".." {

View file

@ -10,14 +10,13 @@ use crate::devices::pci::brute_force_scan;
use crate::filesystem::vfs::VFS; use crate::filesystem::vfs::VFS;
use crate::systeminfo::{KERNEL_VERSION, RELEASE_TYPE}; use crate::systeminfo::{KERNEL_VERSION, RELEASE_TYPE};
use crate::time::fetch_time; use crate::time::fetch_time;
use crate::KERNEL_STATE; use crate::{filesystem, KERNEL_STATE};
use crate::{ use crate::{
arch::shutdown, arch::shutdown,
rhai_shell::KEYBUFF, rhai_shell::KEYBUFF,
vterm::VTerm, vterm::VTerm,
// wasm_jumploader::run_program, // wasm_jumploader::run_program,
}; };
use crate::{filesystem, KERNEL_STATE};
use acpi::{AcpiTables, PlatformInfo}; use acpi::{AcpiTables, PlatformInfo};
use cpuio::{inb, outb}; use cpuio::{inb, outb};