Add seek function

This commit is contained in:
pjht 2024-09-30 13:33:02 -05:00
parent 8650d60a74
commit 0a7a42c227
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A

View File

@ -114,7 +114,7 @@ impl dev_driver_rpc::Server for Serv {
} }
impl file_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 { if fd as usize >= usize::MAX / 2 {
let ptys = self.ptys.read(); let ptys = self.ptys.read();
let pty = &ptys[fd as usize - usize::MAX / 2]; 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 { if fd as usize >= usize::MAX / 2 {
let ptys = self.ptys.read(); let ptys = self.ptys.read();
let pty = &ptys[fd as usize - usize::MAX / 2]; 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) { fn cancel_poll(&self, poll_id: u64) {
self.polls.lock().remove(poll_id as usize); self.polls.lock().remove(poll_id as usize);
} }
fn seek(&self, _fd: u64, _pos: file_rpc::SeekFrom) -> u64 { 0 }
} }
fn main() { fn main() {