diff --git a/src/fs/iso/iso9660.rs b/src/fs/iso/iso9660.rs index 5f440da..ac7fc16 100644 --- a/src/fs/iso/iso9660.rs +++ b/src/fs/iso/iso9660.rs @@ -27,14 +27,6 @@ struct IsoPathTable { } impl IsoPathTable { - pub fn from(mapping: &u8) -> &Self { - let ptr: *const u8 = mapping; - let path_table_ptr: *const Self = ptr as *const Self; - unsafe { - &*path_table_ptr - } - } - #[allow(unaligned_references)] pub fn get_idf(&self) -> &[u8] { unsafe { @@ -77,14 +69,6 @@ pub struct IsoDir { } impl IsoDir { - pub fn from(mapping: &u8) -> &Self { - let ptr: *const u8 = mapping; - let path_table_ptr: *const Self = ptr as *const Self; - unsafe { - &*path_table_ptr - } - } - #[allow(unaligned_references)] pub fn get_idf(&self) -> &[u8] { unsafe { diff --git a/src/lib.rs b/src/lib.rs index 8a02100..f8db8e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,7 @@ mod interrupts; mod memory; mod task; mod fs; +mod utils; //#[macro_use] extern crate alloc; diff --git a/src/utils/mod.rs b/src/utils/mod.rs new file mode 100644 index 0000000..c2664f7 --- /dev/null +++ b/src/utils/mod.rs @@ -0,0 +1,3 @@ +pub mod serialize; + +pub use serialize::unserialize; \ No newline at end of file diff --git a/src/utils/serialize.rs b/src/utils/serialize.rs new file mode 100644 index 0000000..bfb075e --- /dev/null +++ b/src/utils/serialize.rs @@ -0,0 +1,7 @@ +pub fn unserialize(mapping: &u8) -> &T { + let ptr: *const u8 = mapping; + let path_table_ptr: *const T = ptr as *const T; + unsafe { + &*path_table_ptr + } +} \ No newline at end of file