Add seek function
This commit is contained in:
parent
5812c831e5
commit
a34ccd9b99
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -25,9 +25,12 @@ checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.5.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 = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
@ -101,6 +104,7 @@ checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced"
|
|||||||
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",
|
||||||
|
@ -39,13 +39,12 @@ 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(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write(&self, _fd: u64, _pos: u64, data: &[u8]) -> Result<(), ()> {
|
fn write(&self, _fd: u64, data: &[u8]) -> Result<(), ()> {
|
||||||
let mut uart = self.0.lock();
|
let mut uart = self.0.lock();
|
||||||
for &byte in data {
|
for &byte in data {
|
||||||
while !uart.read_line_status().contains(LineStatus::TRANSMIT_EMPTY) {}
|
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> {
|
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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user