From 96e7b1cd8eb68f6c82f97b963d47d2cab859b982 Mon Sep 17 00:00:00 2001 From: Julien CLEMENT Date: Sat, 17 Dec 2022 19:59:29 +0100 Subject: [PATCH] oops iso was gitignored Signed-off-by: Julien CLEMENT --- src/fs/iso/iso9660.rs | 25 +++++++++++++++++++++++++ src/fs/iso/mod.rs | 1 + 2 files changed, 26 insertions(+) create mode 100644 src/fs/iso/iso9660.rs create mode 100644 src/fs/iso/mod.rs diff --git a/src/fs/iso/iso9660.rs b/src/fs/iso/iso9660.rs new file mode 100644 index 0000000..9eb5c56 --- /dev/null +++ b/src/fs/iso/iso9660.rs @@ -0,0 +1,25 @@ +#[repr(C, packed)] +pub struct IsoPathTable { + idf_len: u8, // Identifier name length + ext_size: u8, // Extended attribute record length + data_blk: u8, // File data block index + parent_dir: u16, // Number of the parent dir + // idf: [char] // Directory name, of size Self::idf_len +} + +impl IsoPathTable { + pub fn from(mapping: &u8) -> &Self { + let ptr: *const u8 = mapping; + let path_table_ptr: *const IsoPathTable = ptr as *const IsoPathTable; + unsafe { + &*path_table_ptr + } + } + + pub fn get_idf(&self) -> *const char { + let ptr: *const IsoPathTable = self; + unsafe { + ptr.offset(1) as *const char + } + } +} \ No newline at end of file diff --git a/src/fs/iso/mod.rs b/src/fs/iso/mod.rs new file mode 100644 index 0000000..481c442 --- /dev/null +++ b/src/fs/iso/mod.rs @@ -0,0 +1 @@ +mod iso9660; \ No newline at end of file