Add stub read_dir for root
This commit is contained in:
parent
d0572895cb
commit
652d4fc566
11
Cargo.lock
generated
11
Cargo.lock
generated
@ -1,6 +1,6 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atomic-polyfill"
|
name = "atomic-polyfill"
|
||||||
@ -50,6 +50,14 @@ version = "1.1.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f64009896348fc5af4222e9cf7d7d82a95a256c634ebcf61c53e4ea461422242"
|
checksum = "f64009896348fc5af4222e9cf7d7d82a95a256c634ebcf61c53e4ea461422242"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dir_rpc"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"parking_lot",
|
||||||
|
"postcard",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embedded-io"
|
name = "embedded-io"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
@ -302,6 +310,7 @@ dependencies = [
|
|||||||
name = "tarfs"
|
name = "tarfs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"dir_rpc",
|
||||||
"file_rpc",
|
"file_rpc",
|
||||||
"fs_rpc",
|
"fs_rpc",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
|
@ -4,6 +4,7 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
dir_rpc = { version = "0.1.0", path = "../dir_rpc" }
|
||||||
file_rpc = { version = "0.1.0", path = "../file_rpc" }
|
file_rpc = { version = "0.1.0", path = "../file_rpc" }
|
||||||
fs_rpc = { version = "0.1.0", path = "../fs_rpc" }
|
fs_rpc = { version = "0.1.0", path = "../fs_rpc" }
|
||||||
parking_lot = "0.12.3"
|
parking_lot = "0.12.3"
|
||||||
|
17
src/main.rs
17
src/main.rs
@ -57,7 +57,10 @@ impl fs_rpc::Server for Serv {
|
|||||||
Ok((None, (self.files.read().len() - 1) as u64))
|
Ok((None, (self.files.read().len() - 1) as u64))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open_dir(&self, _path: &std::path::Path, _mount_id: u64) -> Result<(Option<u64>, u64), Errno> {
|
fn open_dir(&self, path: &std::path::Path, _mount_id: u64) -> Result<(Option<u64>, u64), Errno> {
|
||||||
|
if path.to_str() == Some("") {
|
||||||
|
return Ok((None, 0)); // needed so chdir succeeds
|
||||||
|
}
|
||||||
// TODO
|
// TODO
|
||||||
Err(Errno::ENOSYS)
|
Err(Errno::ENOSYS)
|
||||||
}
|
}
|
||||||
@ -131,12 +134,24 @@ impl file_rpc::Server for Serv {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl dir_rpc::Server for Serv {
|
||||||
|
fn next_entry(&self, _fd: u64) -> Result<Option<String>, Errno> {
|
||||||
|
// TODO
|
||||||
|
Err(Errno::ENOSYS)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn close(&self, _fd: u64) -> Result<(), Errno> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let serv = Serv {
|
let serv = Serv {
|
||||||
mounts: Arc::new(RwLock::new(Vec::new())),
|
mounts: Arc::new(RwLock::new(Vec::new())),
|
||||||
files: Arc::new(RwLock::new(Vec::new())),
|
files: Arc::new(RwLock::new(Vec::new())),
|
||||||
};
|
};
|
||||||
fs_rpc::register_server(Box::new(serv.clone()));
|
fs_rpc::register_server(Box::new(serv.clone()));
|
||||||
|
dir_rpc::register_server(Box::new(serv.clone()));
|
||||||
file_rpc::register_server(Box::new(serv));
|
file_rpc::register_server(Box::new(serv));
|
||||||
let vfs_pid;
|
let vfs_pid;
|
||||||
loop {
|
loop {
|
||||||
|
Loading…
Reference in New Issue
Block a user