Add Ext2 fs and basic bio layer

This commit is contained in:
LI Qing
2023-09-18 11:47:17 +08:00
committed by Tate, Hongliang Tian
parent 1616f2d32c
commit 9473889c6b
51 changed files with 5346 additions and 427 deletions

View File

@ -3,7 +3,7 @@ use crate::prelude::*;
use super::fs_resolver::{FsPath, FsResolver};
use super::procfs::ProcFS;
use super::ramfs::RamFS;
use super::utils::{InodeMode, InodeType, MountNode};
use super::utils::{FileSystem, InodeMode, InodeType, MountNode};
use cpio_decoder::{CpioDecoder, FileType};
use lending_iterator::LendingIterator;
@ -77,11 +77,18 @@ pub fn init(initramfs_buf: &[u8]) -> Result<()> {
// Mount DevFS
let dev_dentry = fs.lookup(&FsPath::try_from("/dev")?)?;
dev_dentry.mount(RamFS::new())?;
println!("[kernel] rootfs is ready");
Ok(())
}
pub fn mount_fs_at(fs: Arc<dyn FileSystem>, fs_path: &FsPath) -> Result<()> {
let target_dentry = FsResolver::new().lookup(fs_path)?;
target_dentry.mount(fs)?;
Ok(())
}
static ROOT_MOUNT: Once<Arc<MountNode>> = Once::new();
pub fn init_root_mount() {