2016-08-15 05:38:32 +02:00
|
|
|
use core::str;
|
2016-08-26 01:03:01 +02:00
|
|
|
|
2016-08-15 05:38:32 +02:00
|
|
|
use syscall::Result;
|
2016-09-09 04:06:33 +02:00
|
|
|
use super::Scheme;
|
2016-08-15 05:38:32 +02:00
|
|
|
|
|
|
|
pub struct DebugScheme;
|
|
|
|
|
|
|
|
impl Scheme for DebugScheme {
|
2016-08-18 00:54:48 +02:00
|
|
|
fn open(&mut self, path: &[u8], _flags: usize) -> Result<usize> {
|
2016-08-15 05:38:32 +02:00
|
|
|
Ok(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Read the file `number` into the `buffer`
|
|
|
|
///
|
|
|
|
/// Returns the number of bytes read
|
2016-09-09 04:06:33 +02:00
|
|
|
fn read(&mut self, _file: usize, _buffer: &mut [u8]) -> Result<usize> {
|
2016-08-15 05:38:32 +02:00
|
|
|
Ok(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Write the `buffer` to the `file`
|
|
|
|
///
|
|
|
|
/// Returns the number of bytes written
|
2016-09-09 04:06:33 +02:00
|
|
|
fn write(&mut self, _file: usize, buffer: &[u8]) -> Result<usize> {
|
2016-08-15 05:38:32 +02:00
|
|
|
//TODO: Write bytes, do not convert to str
|
|
|
|
print!("{}", unsafe { str::from_utf8_unchecked(buffer) });
|
|
|
|
Ok(buffer.len())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Close the file `number`
|
2016-09-09 04:06:33 +02:00
|
|
|
fn close(&mut self, _file: usize) -> Result<()> {
|
2016-08-15 05:38:32 +02:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|