Add mode to open operation
This commit is contained in:
parent
581bb3524a
commit
b6af654b1a
@ -3,7 +3,7 @@ mod ext2;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fs::File,
|
||||
os::mikros::{ipc, syscalls, Errno},
|
||||
os::mikros::{ipc, syscalls, Errno, FileOpenMode},
|
||||
sync::Arc, usize,
|
||||
};
|
||||
|
||||
@ -34,7 +34,11 @@ impl fs_rpc::Server for Serv {
|
||||
res
|
||||
}
|
||||
|
||||
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> {
|
||||
if !mode.readable() || mode.writable() {
|
||||
// WRiting isn't supported yet, so the only sensible mode is readonly.
|
||||
return Err(Errno::EACCES);
|
||||
}
|
||||
let mounts = self.mounts.read();
|
||||
let mount = &mounts[mount_id as usize];
|
||||
let file = mount.open(path)?;
|
||||
|
Loading…
Reference in New Issue
Block a user