Add seek function

This commit is contained in:
pjht 2024-09-30 13:32:41 -05:00
parent d0c5f8b706
commit 75b12fdac4
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A
2 changed files with 7 additions and 2 deletions

4
Cargo.lock generated
View File

@ -63,6 +63,9 @@ name = "bitflags"
version = "2.6.0" version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "byteorder" name = "byteorder"
@ -128,6 +131,7 @@ checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
name = "file_rpc" name = "file_rpc"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"bitflags",
"parking_lot", "parking_lot",
"postcard", "postcard",
"serde", "serde",

View File

@ -350,14 +350,13 @@ impl file_rpc::Server for FileServ {
fn read( fn read(
&self, &self,
_fd: u64, _fd: u64,
_pos: u64,
_len: usize, _len: usize,
) -> std::result::Result<std::borrow::Cow<'_, [u8]>, ()> { ) -> std::result::Result<std::borrow::Cow<'_, [u8]>, ()> {
Err(()) Err(())
} }
#[allow(clippy::significant_drop_tightening)] #[allow(clippy::significant_drop_tightening)]
fn write(&self, _fd: u64, _pos: u64, data: &[u8]) -> Result<(), ()> { fn write(&self, _fd: u64, data: &[u8]) -> Result<(), ()> {
let string = str::from_utf8(data).map_err(|_| ())?; let string = str::from_utf8(data).map_err(|_| ())?;
let mut fbwriter = self.fbwriter.lock(); let mut fbwriter = self.fbwriter.lock();
let mut fbuffer = self.fbuffer.lock(); let mut fbuffer = self.fbuffer.lock();
@ -375,6 +374,8 @@ impl file_rpc::Server for FileServ {
fn dup(&self, fd: u64) -> Option<u64> { fn dup(&self, fd: u64) -> Option<u64> {
Some(fd) Some(fd)
} }
fn seek(&self, _fd: u64, _pos: file_rpc::SeekFrom) -> u64 { 0 }
} }
fn main() { fn main() {