twizzler-operating-system / twizzler

The Twizzler Operating System
BSD 3-Clause "New" or "Revised" License
66 stars 14 forks source link

Added a NVME FS prototype #192

Closed CPTforever closed 3 weeks ago

CPTforever commented 2 months ago

I made one change to Xtask that will only open the nvme.img if it already exists then truncate it, otherwise create it then truncate.

I copied over the NVME driver code from the pager, and in the controller I detached the interrupt handler in the init_controller function in a thread pool since it seems that it doesn't work if it's solely async. I also commented out the part where it adds it to the interrupt task list. Otherwise it hangs and doesn't make any progress.

I made a quick IO handler on top of the NVME driver and then put Leo's Fat Filesystem on top of that to implement a basic file system in Twizzler.

dbittman commented 2 months ago

Looks like it's missing the submodule for the fat crate. Add it, and I'll rerun the CI.

CPTforever commented 1 month ago

I didn't intend to make it in the same PR but I also need to look at why the CICD failed.

But the changes made are adding 5 functions for the rust minimal runtime and reference runtime being and the corresponding functions within the std interface: open() read() write() close() seek()

The two new functions planned will be truncate() and stat().

The way I implemented it similar to how the thread runtime was implemented with a file descriptor defined in a static map that can reference a file descriptor which contains the pos variable that points to a place in the file, and an object handle for the backed file.

The data stored within the file is the data itself and the File Metadata which holds a magic number, the size, and a direct pointer list to support extensible files. However extensible files aren't implemented at this time.

Some limitations is that open doesn't actually create a file.

Also there is no error checking like seeing if the object is overflowing which I'm planning to rectify very soon.

CPTforever commented 1 month ago

Fixed a bug with the tests so the build system should pass it now.

I've also added changes that Daniel suggested including

Changed read and write in the runtime to accept slices instead of pointers

Defining ownedfd in std and defining a rawfd type=u32, which I implemented it by getting rid of OwnedFd and just having the file descriptor struct hold the rawfd.

Added display and error to the FsError type

Added a from impl for FsError to Io Error so that the ? operator works. I had to add a stable macro to do so, I'm not sure of another way to approach it.

Changed the Btree + atomic counter implementation to a stable vector for counting, I also added a feature that would choose a deleted fd slot before allocating a new one.

CPTforever commented 3 weeks ago

I tried committing the latest branch in the rust submodule but I got a compilation error saying that a function in the rust runtime is missing. So I moved it back one commit.