Add mode to open operation
This commit is contained in:
parent
0977217188
commit
88815ccaea
@ -1,7 +1,7 @@
|
|||||||
use std::{
|
use std::{
|
||||||
fs::File,
|
fs::File,
|
||||||
io::{Read, Seek, SeekFrom},
|
io::{Read, Seek, SeekFrom},
|
||||||
os::mikros::{ipc, syscalls, Errno},
|
os::mikros::{ipc, syscalls, Errno, FileCreationMode, FileOpenMode, FileWriteMode},
|
||||||
path::Path,
|
path::Path,
|
||||||
sync::{atomic::{AtomicU64, Ordering}, Arc},
|
sync::{atomic::{AtomicU64, Ordering}, Arc},
|
||||||
};
|
};
|
||||||
@ -55,7 +55,7 @@ struct Serv {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl dev_driver_rpc::Server for 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)?);
|
let part = *(self.parts.get(path.to_str().unwrap()).ok_or(Errno::EBADF)?);
|
||||||
Ok(self.open_files.insert(OpenFile {
|
Ok(self.open_files.insert(OpenFile {
|
||||||
drive_file: part.0,
|
drive_file: part.0,
|
||||||
@ -281,7 +281,7 @@ fn main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let drive_file = vfs_client
|
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();
|
.unwrap();
|
||||||
|
|
||||||
for (i, part) in gpt_entries.iter().enumerate() {
|
for (i, part) in gpt_entries.iter().enumerate() {
|
||||||
@ -314,7 +314,7 @@ fn main() {
|
|||||||
println!("Disk has MBR");
|
println!("Disk has MBR");
|
||||||
|
|
||||||
let drive_file = vfs_client
|
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();
|
.unwrap();
|
||||||
|
|
||||||
for (i, part) in mbr_entries.iter().enumerate() {
|
for (i, part) in mbr_entries.iter().enumerate() {
|
||||||
|
Loading…
Reference in New Issue
Block a user