Improve member name
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
use super::{helper::{force_convert_ascii_to_str}, lsb_msb::{EndianFamilyTypes, ReadWriteEndian, LittleEndianFamily, BigEndianFamily}};
|
||||
|
||||
pub type PathTableL = PathTableBase<LittleEndianFamily>;
|
||||
pub type PathTableM = PathTableBase<BigEndianFamily>;
|
||||
pub type PathTableB = PathTableBase<BigEndianFamily>;
|
||||
|
||||
#[repr(packed(1))]
|
||||
pub struct PathTableBase<EndianFamily: EndianFamilyTypes> {
|
||||
pub name_length: [u8; 1],
|
||||
pub extended_attribute_length: [u8; 1],
|
||||
pub directory_logical_block: EndianFamily::U32,
|
||||
pub parent_logical_block: EndianFamily::U16,
|
||||
pub parent_table_id: EndianFamily::U16,
|
||||
//name: DString<name_length>
|
||||
//padding: only if name_length is odd
|
||||
}
|
||||
@@ -19,7 +19,7 @@ impl<EndianFamily: EndianFamilyTypes> PathTableBase<EndianFamily> {
|
||||
name_length: [name.len() as u8],
|
||||
extended_attribute_length: [0],
|
||||
directory_logical_block: EndianFamily::U32::default(),
|
||||
parent_logical_block: EndianFamily::U16::default(),
|
||||
parent_table_id: EndianFamily::U16::default(),
|
||||
};
|
||||
|
||||
self.set_name(name);
|
||||
@@ -65,7 +65,7 @@ impl<EndianFamily: EndianFamilyTypes> PathTableBase<EndianFamily> {
|
||||
impl<EndianFamily: EndianFamilyTypes> std::fmt::Display for PathTableBase<EndianFamily> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let (dir_block, parent_block) = unsafe {
|
||||
(std::ptr::addr_of!(self.directory_logical_block).read_unaligned().read(), std::ptr::addr_of!(self.parent_logical_block).read_unaligned().read())
|
||||
(std::ptr::addr_of!(self.directory_logical_block).read_unaligned().read(), std::ptr::addr_of!(self.parent_table_id).read_unaligned().read())
|
||||
};
|
||||
|
||||
write!(f, "\"{}\" @{} ^{}", self.get_name(), dir_block, parent_block)
|
||||
|
Reference in New Issue
Block a user