Add seek function
This commit is contained in:
parent
8650d60a74
commit
0a7a42c227
@ -114,7 +114,7 @@ impl dev_driver_rpc::Server for Serv {
|
||||
}
|
||||
|
||||
impl file_rpc::Server for Serv {
|
||||
fn read(&self, fd: u64, _pos: u64, len: usize) -> Result<Cow<'_, [u8]>, ()> {
|
||||
fn read(&self, fd: u64, len: usize) -> Result<Cow<'_, [u8]>, ()> {
|
||||
if fd as usize >= usize::MAX / 2 {
|
||||
let ptys = self.ptys.read();
|
||||
let pty = &ptys[fd as usize - usize::MAX / 2];
|
||||
@ -126,7 +126,7 @@ impl file_rpc::Server for Serv {
|
||||
}
|
||||
}
|
||||
|
||||
fn write(&self, fd: u64, _pos: u64, data: &[u8]) -> Result<(), ()> {
|
||||
fn write(&self, fd: u64, data: &[u8]) -> Result<(), ()> {
|
||||
if fd as usize >= usize::MAX / 2 {
|
||||
let ptys = self.ptys.read();
|
||||
let pty = &ptys[fd as usize - usize::MAX / 2];
|
||||
@ -187,6 +187,8 @@ impl file_rpc::Server for Serv {
|
||||
fn cancel_poll(&self, poll_id: u64) {
|
||||
self.polls.lock().remove(poll_id as usize);
|
||||
}
|
||||
|
||||
fn seek(&self, _fd: u64, _pos: file_rpc::SeekFrom) -> u64 { 0 }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
Loading…
Reference in New Issue
Block a user