Add support for VirtIO 9p devices, including the implementation of drivers and related functionalities.#216
Add support for VirtIO 9p devices, including the implementation of drivers and related functionalities.#216luodeb wants to merge 3 commits intorcore-os:masterfrom
Conversation
…ivers and related functionalities.
…g for the VirtIO 9p device.
| mod embedded_io; | ||
| mod hal; | ||
| mod queue; | ||
| /// Virtqueue implementation and helpers. |
There was a problem hiding this comment.
Move the doc comment to an inner doc comment (i.e. //!) in the module file.
| @@ -1,5 +1,6 @@ | |||
| #![deny(unsafe_op_in_unsafe_fn)] | |||
|
|
|||
| /// Owning variants of virtqueue helpers. | |||
There was a problem hiding this comment.
Move this to an inner doc comment in the module file.
| mod hal; | ||
| mod queue; | ||
| /// Virtqueue implementation and helpers. | ||
| pub mod queue; |
There was a problem hiding this comment.
Why does this need to be public now?
| } | ||
|
|
||
| fn read_mount_tag<T: Transport>(transport: &T) -> Option<String> { | ||
| let tag_len: u16 = transport.read_config_space(0).ok()?; |
There was a problem hiding this comment.
If read_config_space returns an error it should be propagated to the caller so that it can be reported properly, not just treated as there being no mount tag.
| bytes.push(b); | ||
| } | ||
|
|
||
| String::from_utf8(bytes).ok() |
There was a problem hiding this comment.
Invalid UTF-8 should probably also be reported as an error rather than just ignored.
| let version = core::str::from_utf8(&resp[13..name_end]).ok()?; | ||
| info!("virtio-9p rversion: msize={}, version={}", msize, version); | ||
| Some(()) | ||
| } |
There was a problem hiding this comment.
Why are these functions to construct and parse 9p requests and responses here in the example rather than in the driver?
Also, it might be possible to use repr(C) structs with zerocopy and the zerocopy::byteorder types rather than manually slicing up byte buffers.
| .queue | ||
| .add_notify_wait_pop(&[req], &mut [resp], &mut self.transport)?; | ||
|
|
||
| let size = u32::from_le_bytes([resp[0], resp[1], resp[2], resp[3]]) as usize; |
There was a problem hiding this comment.
Is this size always the same as used_len?
No description provided.