From 7d9d20b6519808adeb3f45c7573a098ec39b50e9 Mon Sep 17 00:00:00 2001 From: Egggggg Date: Wed, 12 Jul 2023 15:48:49 -0400 Subject: [PATCH] Updataa --- README.md | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++-- holey-bytes | 2 +- 2 files changed, 73 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b04610c..bd12fcc 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,73 @@ -# ableos-vfs +# AbleOS VFS -A VFS driver for Able OS :D \ No newline at end of file +## Public API + +``` +// reads the whole file +pub fn read(file: FileHandle) -> Vec + +// overwrites the contents of the file +pub fn write(file: FileHandle, data: Vec) + +// opens a file for reading and writing +pub fn open(path: Path) + +// closes the file +pub fn close(file: FileHandle) + +// deletes a file +pub fn delete(path: Path) +``` + + +Opening a file opens it using the corresponding filesystem. Multiple processes can open the same file in any mode, and the file only leaves the FS cache when no process has it open anymore. + +## Minimal FS API + +``` +trait FileIO { + // reads the whole file + pub fn read(path: Path) -> Vec + + // overwrites the file contents + pub fn write(path: Path, data: Vec) + + // opens a file for reading and writing + pub fn open(path: Path) + + // closes a file, removing it from the cache + pub fn close(path: Path) + + // deletes a file + pub fn delete(path: Path) +} +``` + + +All filesystems must expose at least these functions in order to work with the VFS. + +## Structure + +### Mount Point Lookup Entry + +``` +path_len: u64 +path: [u8; ] +entries: u64 +addr: u64 +``` + + +There is one of these for each mount point, stored sequentially. The list ends when it finds a path_len of 0 + +### Sub Part + +``` +name_len: u64 +name: [u8; ] +dir: u8 +size: u64 +addr: u64 +``` + +There can be many of these in a mount point, and they can be nested within eachother. dir is 1 if the part is a directory, or 0 if it's a file. size specifies the number of sub parts within a directory, or the number of bytes within a file \ No newline at end of file diff --git a/holey-bytes b/holey-bytes index c1b2508..7599542 160000 --- a/holey-bytes +++ b/holey-bytes @@ -1 +1 @@ -Subproject commit c1b250874f87fab8533c61ac7254e0724cd35781 +Subproject commit 75995422262a192f2c87713d239856e98c799f41