-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a NVME FS prototype #192
Conversation
Looks like it's missing the submodule for the fat crate. Add it, and I'll rerun the CI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few questions and comments.
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: 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall the code looks good. I think you should add block comments to the main, visible, APIs that are used by others so they get put into the documentation by the Rust build system.
|
||
// specialization o_O | ||
|
||
// impl<const N: usize> Decode for [u8; N] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't check in commented out code. We use a version control system so if you need old code, you can always restore it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I copied it over from Leo's repo since it's private, I didn't check it too closely, will do.
fn framed_size(&mut self) -> Result<u64, S::Error> { | ||
Ok(#framed) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot of extra white space throuhout. Can we tighten this up? Perhaps @dbittman has thoughts on how the code looks as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing we need to do is setup a CI step that ensures that rustfmt is happy. @CPTforever is this code formatted with rustfmt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure I did, I ran cargo fmt in the crate's root but I'll double check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok today I found out it's not recursive, I'll commit the fix soon,
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. |
|
||
/// Runtime that implements std's FS support. Currently being implemented. | ||
pub trait RustFsRuntime { | ||
fn open(&self, path: &CStr) -> Result<RawFd, FsError>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the small comments I left. I will work on fixing CI for rust submodule.
* Add support for CHERI QEMU * Add Morello build target * Implement basic GICv3 support * Run cargo fmt * Fix interrupt initialization * Cleanup and comments
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, let's get this in.
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.