Add seek function

This commit is contained in:
pjht 2024-09-30 13:33:10 -05:00
parent 5812c831e5
commit a34ccd9b99
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A
2 changed files with 9 additions and 4 deletions

8
Cargo.lock generated
View File

@ -25,9 +25,12 @@ checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
[[package]]
name = "bitflags"
version = "2.5.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
dependencies = [
"serde",
]
[[package]]
name = "byteorder"
@ -101,6 +104,7 @@ checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced"
name = "file_rpc"
version = "0.1.0"
dependencies = [
"bitflags",
"parking_lot",
"postcard",
"serde",

View File

@ -39,13 +39,12 @@ impl file_rpc::Server for FileServ {
fn read(
&self,
_fd: u64,
_pos: u64,
_len: usize,
) -> std::result::Result<std::borrow::Cow<'_, [u8]>, ()> {
Err(())
}
fn write(&self, _fd: u64, _pos: u64, data: &[u8]) -> Result<(), ()> {
fn write(&self, _fd: u64, data: &[u8]) -> Result<(), ()> {
let mut uart = self.0.lock();
for &byte in data {
while !uart.read_line_status().contains(LineStatus::TRANSMIT_EMPTY) {}
@ -63,6 +62,8 @@ impl file_rpc::Server for FileServ {
fn dup(&self, fd: u64) -> Option<u64> {
Some(fd)
}
fn seek(&self, _fd: u64, _pos: file_rpc::SeekFrom) -> u64 { 0 }
}
fn main() {