From b39db75cf47e21de3b34fb1ba8cd209fa29a494d Mon Sep 17 00:00:00 2001 From: Stephen Marz Date: Wed, 18 Mar 2020 10:40:27 -0400 Subject: [PATCH] Add fs and minix --- risc_v/src/fs.rs | 16 ++++++++++++++++ risc_v/src/lib.rs | 2 ++ risc_v/src/minixfs.rs | 11 +++++++++++ 3 files changed, 29 insertions(+) create mode 100755 risc_v/src/fs.rs create mode 100755 risc_v/src/minixfs.rs diff --git a/risc_v/src/fs.rs b/risc_v/src/fs.rs new file mode 100755 index 0000000..1efdaa5 --- /dev/null +++ b/risc_v/src/fs.rs @@ -0,0 +1,16 @@ +// fs.rs +// Filesystem for SOS +// Stephen Marz +// 16 March 2020 + +use alloc::string::String; + +pub trait FileSystem { + fn open(path: &String) -> Option; + fn read(desc: &Descriptor, buffer: *mut u8, offset: u32, size: u32) -> u32; +} + +/// A file descriptor +pub struct Descriptor { + +} diff --git a/risc_v/src/lib.rs b/risc_v/src/lib.rs index dfb2b18..35630ec 100755 --- a/risc_v/src/lib.rs +++ b/risc_v/src/lib.rs @@ -164,7 +164,9 @@ extern "C" fn kinit_hart(_hartid: usize) { pub mod block; pub mod cpu; +pub mod fs; pub mod kmem; +pub mod minixfs; pub mod page; pub mod plic; pub mod process; diff --git a/risc_v/src/minixfs.rs b/risc_v/src/minixfs.rs new file mode 100755 index 0000000..e1e1336 --- /dev/null +++ b/risc_v/src/minixfs.rs @@ -0,0 +1,11 @@ +// minixfs.rs +// Minix 3 Filesystem Implementation +// Stephen Marz +// 16 March 2020 + +use crate::fs::{Descriptor, FileSystem}; + +pub struct MinixFileSystem { + +} +