1#[derive(Debug)]
2pub struct IoReader {
4 pub fd: usize,
5 pub offset: usize,
6}
7
8#[derive(Debug)]
9pub struct IoWriter {
11 pub fd: usize,
12 pub offset: usize,
13}
14
15impl IoReader {
16 pub fn new(fd: usize) -> Self {
18 Self { fd, offset: 0 }
19 }
20
21 #[cfg(feature = "userspace")]
22 pub fn read(&mut self, buf: &mut [u8]) -> Result<usize, super::error::Error> {
24 super::call::read(self.fd, buf)
25 }
26}
27
28impl IoWriter {
29 pub fn new(fd: usize) -> Self {
31 Self { fd, offset: 0 }
32 }
33
34 #[cfg(feature = "userspace")]
35 pub fn write(&mut self, buf: &[u8]) -> Result<usize, super::error::Error> {
37 super::call::write(self.fd, buf)
38 }
39}