Add mode to open operation

This commit is contained in:
pjht 2024-11-16 11:53:21 -06:00
parent 13238344bf
commit 30a3677fe0
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E

View File

@ -1,6 +1,6 @@
use std::{
collections::HashMap,
os::mikros::{ipc, syscalls, Errno},
os::mikros::{ipc, syscalls, Errno, FileOpenMode},
sync::Arc,
};
@ -18,10 +18,10 @@ impl fs_rpc::Server for Serv {
Ok(0)
}
fn open(&self, path: &std::path::Path, _mount_id: u64) -> Result<(Option<u64>, u64), Errno> {
fn open(&self, path: &std::path::Path, mode: FileOpenMode, _mount_id: u64) -> Result<(Option<u64>, u64), Errno> {
let name = path.to_str().ok_or(Errno::EINVALDAT)?;
let device_pid = *self.devices.read().get(name).ok_or(Errno::ENOENT)?;
let fd = dev_driver_rpc::Client::new(device_pid).open(path)?;
let fd = dev_driver_rpc::Client::new(device_pid).open(path, mode)?;
Ok((Some(device_pid), fd))
}