starting to work on open(2)
continuous-integration/drone/push Build is passing

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
juju committed 2022-12-22 22:03:06 +01:00
1 parent e2c2586a19
commit d66fb31c9a
4 files changed
+23 -4

No files matched your search

+13 -3
View File
@@ -6,7 +6,7 @@ use crate::drivers::atapi::{DRIVE};
use crate::fd::{FD_TABLE, FDt};
use crate::utils::unserialize;
use iso9660::{IsoPrimVolDesc};
use iso9660::{IsoPrimVolDesc, IsoDir};
use fd::IsoFD;
pub async fn get_prim_vol_desc() -> IsoPrimVolDesc {
@@ -20,8 +20,18 @@ pub async fn get_prim_vol_desc() -> IsoPrimVolDesc {
*unserialize::<IsoPrimVolDesc>(desc_block.as_ptr())
}
pub async fn open() -> FDt {
pub async fn open(path: &str, flags: u32) -> Option<FDt> {
if flags != crate::syscalls::io::O_RDONLY {
return None;
}
let voldesc = get_prim_vol_desc().await;
if voldesc.std_identifier != "CD001".as_bytes() {
return None;
}
let fd = IsoFD::new();
FD_TABLE.lock().await.register_fd(fd.clone());
fd
Some(fd)
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.