Remove path argument from mount function

This commit is contained in:
pjht 2024-06-18 16:43:00 -05:00
parent f01058efc6
commit 9a807874e2
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E

View File

@ -12,7 +12,7 @@ static SERVER: RwLock<Option<Box<dyn Server>>> = RwLock::new(None);
const PROTO: u16 = 3;
pub trait Server: Send + Sync {
fn mount(&self, dev: &Path, path: &Path) -> Result<u64, ()>;
fn mount(&self, dev: &Path) -> Result<u64, ()>;
fn open(&self, path: &Path, mount_id: u64) -> Result<(Option<u64>, u64), ()>;
}
@ -24,9 +24,9 @@ impl Client {
Self(pid)
}
pub fn mount(self, dev: &Path, path: &Path) -> Result<u64, ()> {
pub fn mount(self, dev: &Path) -> Result<u64, ()> {
postcard::from_bytes(
&rpc::send_call(self.0, PROTO, 0, &postcard::to_stdvec(&(dev, path)).unwrap())
&rpc::send_call(self.0, PROTO, 0, &postcard::to_stdvec(&dev).unwrap())
.get_return(),
)
.unwrap()
@ -60,8 +60,8 @@ fn callback(call: IncomingCall) {
let server_lock = SERVER.read();
let server = server_lock.as_ref().unwrap();
if call.func == 0 {
let (dev, path) = postcard::from_bytes(&call.args).unwrap();
let ret = postcard::to_stdvec(&server.mount(dev, path)).unwrap();
let dev = postcard::from_bytes(&call.args).unwrap();
let ret = postcard::to_stdvec(&server.mount(dev)).unwrap();
call.send_return(&ret);
} else if call.func == 1 {
let (path, mount_id) = postcard::from_bytes(&call.args).unwrap();