Refactor all io APIs of vfs based on VmReader/VmWriter

This commit is contained in:
Shaowei Song
2024-08-22 07:52:20 +00:00
committed by Tate, Hongliang Tian
parent 837c7bebb6
commit dce796cdde
50 changed files with 566 additions and 376 deletions

View File

@ -19,12 +19,12 @@ impl Device for Null {
}
impl FileIo for Null {
fn read(&self, _buf: &mut [u8]) -> Result<usize> {
fn read(&self, _writer: &mut VmWriter) -> Result<usize> {
Ok(0)
}
fn write(&self, buf: &[u8]) -> Result<usize> {
Ok(buf.len())
fn write(&self, reader: &mut VmReader) -> Result<usize> {
Ok(reader.remain())
}
fn poll(&self, mask: IoEvents, poller: Option<&mut Poller>) -> IoEvents {