Connect schemes so that they can be used
This commit is contained in:
parent
9afe0645e1
commit
aeadd17bb5
5 changed files with 106 additions and 36 deletions
|
@ -1,7 +1,7 @@
|
|||
use core::str;
|
||||
|
||||
use syscall::Result;
|
||||
use super::{Scheme, Fd};
|
||||
use super::Scheme;
|
||||
|
||||
pub struct DebugScheme;
|
||||
|
||||
|
@ -14,21 +14,21 @@ impl Scheme for DebugScheme {
|
|||
/// Read the file `number` into the `buffer`
|
||||
///
|
||||
/// Returns the number of bytes read
|
||||
fn read(&mut self, _file: Fd, _buffer: &mut [u8]) -> Result<usize> {
|
||||
fn read(&mut self, _file: usize, _buffer: &mut [u8]) -> Result<usize> {
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
/// Write the `buffer` to the `file`
|
||||
///
|
||||
/// Returns the number of bytes written
|
||||
fn write(&mut self, _file: Fd, buffer: &[u8]) -> Result<usize> {
|
||||
fn write(&mut self, _file: usize, buffer: &[u8]) -> Result<usize> {
|
||||
//TODO: Write bytes, do not convert to str
|
||||
print!("{}", unsafe { str::from_utf8_unchecked(buffer) });
|
||||
Ok(buffer.len())
|
||||
}
|
||||
|
||||
/// Close the file `number`
|
||||
fn close(&mut self, _file: Fd) -> Result<()> {
|
||||
fn close(&mut self, _file: usize) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue