Add mode to open operation

This commit is contained in:
pjht 2024-11-16 11:54:09 -06:00
parent 0977217188
commit 88815ccaea
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E

View File

@ -1,7 +1,7 @@
use std::{
fs::File,
io::{Read, Seek, SeekFrom},
os::mikros::{ipc, syscalls, Errno},
os::mikros::{ipc, syscalls, Errno, FileCreationMode, FileOpenMode, FileWriteMode},
path::Path,
sync::{atomic::{AtomicU64, Ordering}, Arc},
};
@ -55,7 +55,7 @@ struct Serv {
}
impl dev_driver_rpc::Server for Serv {
fn open(&self, path: &std::path::Path) -> Result<u64, Errno> {
fn open(&self, path: &std::path::Path, _mode: FileOpenMode) -> Result<u64, Errno> {
let part = *(self.parts.get(path.to_str().unwrap()).ok_or(Errno::EBADF)?);
Ok(self.open_files.insert(OpenFile {
drive_file: part.0,
@ -281,7 +281,7 @@ fn main() {
.unwrap();
let drive_file = vfs_client
.open(Path::new(&format!("/dev/{}", dev_name)))
.open(Path::new(&format!("/dev/{}", dev_name)), FileOpenMode::ReadWrite(FileWriteMode::Start, FileCreationMode::NoCreate))
.unwrap();
for (i, part) in gpt_entries.iter().enumerate() {
@ -314,7 +314,7 @@ fn main() {
println!("Disk has MBR");
let drive_file = vfs_client
.open(Path::new(&format!("/dev/{}", dev_name)))
.open(Path::new(&format!("/dev/{}", dev_name)), FileOpenMode::ReadWrite(FileWriteMode::Start, FileCreationMode::NoCreate))
.unwrap();
for (i, part) in mbr_entries.iter().enumerate() {