Sync computers
This commit is contained in:
@@ -159,8 +159,8 @@ impl Scheduler {
|
||||
/// Attempts to open `path`, load its contents into memory and create a new
|
||||
/// kernel process that will execute the loaded binary. Returns the PID of the
|
||||
/// created process, or -1 on failure.
|
||||
pub fn create_process_from_file<'a, T: Into<Path<'a>>>(&mut self, path: T) -> i64 {
|
||||
let path = path.into();
|
||||
pub fn create_process_from_file<T: AsRef<Path>>(&mut self, path: T) -> i64 {
|
||||
let path = path.as_ref();
|
||||
let name = path.as_str();
|
||||
|
||||
// Open and read the binary file
|
||||
|
||||
@@ -16,11 +16,11 @@ pub unsafe fn dealloc(ptr: *mut u8, layout: core::alloc::Layout) {
|
||||
unsafe { alloc::alloc::dealloc(ptr, layout) }
|
||||
}
|
||||
|
||||
pub fn open<'a, P: Into<Path<'a>>>(
|
||||
pub fn open<P: AsRef<Path>>(
|
||||
path: P,
|
||||
in_kernel: bool,
|
||||
) -> Result<Box<dyn VirtualNode + Send>, Error<<Disk as bffs::io::IoBase>::Error>> {
|
||||
let path = path.into();
|
||||
let path = path.as_ref();
|
||||
let file = match path.split_path() {
|
||||
("dev", path) => {
|
||||
todo!()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use alloc::boxed::Box;
|
||||
use bffs::path::Path;
|
||||
use bffs::path::{Path, PathBuf};
|
||||
use hashbrown::HashMap;
|
||||
|
||||
pub trait VirtualNode {
|
||||
@@ -7,15 +7,18 @@ pub trait VirtualNode {
|
||||
}
|
||||
|
||||
pub trait VirtualFileSystem {
|
||||
fn open<'a, P: Into<Path<'a>>>(path: P) -> Result<Box<dyn VirtualNode + Send>, ()>;
|
||||
fn open(&mut self, path: &Path) -> Result<Box<dyn VirtualNode + Send>, ()>;
|
||||
}
|
||||
|
||||
pub struct MainFileSystem {
|
||||
mounts: HashMap<PathBuf>
|
||||
mounts: HashMap<PathBuf, Box<dyn VirtualFileSystem>>,
|
||||
}
|
||||
|
||||
impl VirtualFileSystem for MainFileSystem {
|
||||
fn open<'a, P: Into<Path<'a>>>(path: P) -> Result<Box<dyn VirtualNode + Send>, ()> {
|
||||
fn open(&mut self, path: &Path) -> Result<Box<dyn VirtualNode + Send>, ()> {
|
||||
for mount in self.mounts.iter() {
|
||||
|
||||
}
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user