Add SystemArea and PVD
This commit is contained in:
parent
ff51f7db68
commit
23b0b20b59
|
@ -31,6 +31,8 @@ fn run_main() -> Result<(), Error> {
|
||||||
|
|
||||||
for element in desc.get_memory_layout().iter() {
|
for element in desc.get_memory_layout().iter() {
|
||||||
match element {
|
match element {
|
||||||
|
Layout::SystemArea(_) => println!("SystemArea:"),
|
||||||
|
Layout::PVD(_) => println!("PVD:"),
|
||||||
Layout::Directory{name, properties: _} => println!("Dir: {}", name),
|
Layout::Directory{name, properties: _} => println!("Dir: {}", name),
|
||||||
Layout::Data(data) => println!("File: {}", data),
|
Layout::Data(data) => println!("File: {}", data),
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,17 @@ macro_rules! declare_memory_layout {
|
||||||
pub fn new(parent: &$($val),* CDDesc) -> Vec<[< Layout$($val:camel),* >]> {
|
pub fn new(parent: &$($val),* CDDesc) -> Vec<[< Layout$($val:camel),* >]> {
|
||||||
let mut layout = Vec::new();
|
let mut layout = Vec::new();
|
||||||
|
|
||||||
|
layout.push([< Layout$($val:camel),* >]::SystemArea(&$($val),* parent.system_area));
|
||||||
|
layout.push([< Layout$($val:camel),* >]::PVD(&$($val),* parent.pvd));
|
||||||
|
|
||||||
[< add_dir_and_subdir $(_$val),* >](&mut layout, &$($val),* parent.root);
|
[< add_dir_and_subdir $(_$val),* >](&mut layout, &$($val),* parent.root);
|
||||||
layout
|
layout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum [< Layout$($val:camel),* >]<'a> {
|
pub enum [< Layout$($val:camel),* >]<'a> {
|
||||||
|
SystemArea(&'a $($val),* SystemArea),
|
||||||
|
PVD(&'a $($val),* PrimaryVolumeDescriptor),
|
||||||
Directory{name: &'a $($val),* DirectoryName, properties: &'a $($val),* Properties},
|
Directory{name: &'a $($val),* DirectoryName, properties: &'a $($val),* Properties},
|
||||||
Data(&'a $($val),* Data)
|
Data(&'a $($val),* Data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,15 @@ use cdtypes::types::cdstring::DString;
|
||||||
use tool_helper::Error;
|
use tool_helper::Error;
|
||||||
|
|
||||||
pub struct CDDesc {
|
pub struct CDDesc {
|
||||||
|
system_area: SystemArea,
|
||||||
|
pvd: PrimaryVolumeDescriptor,
|
||||||
pub root: Directory
|
pub root: Directory
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CDDesc {
|
impl CDDesc {
|
||||||
pub fn new() -> CDDesc {
|
pub fn new() -> CDDesc {
|
||||||
match Directory::new("root") {
|
match Directory::new("root") {
|
||||||
Ok(root) => CDDesc{root},
|
Ok(root) => CDDesc{system_area: SystemArea::new(), pvd: PrimaryVolumeDescriptor::new(), root},
|
||||||
Err(error) => panic!("Creating root directory failed with: {}", error)
|
Err(error) => panic!("Creating root directory failed with: {}", error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +26,24 @@ impl CDDesc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct SystemArea {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SystemArea {
|
||||||
|
pub fn new() -> SystemArea {
|
||||||
|
SystemArea{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct PrimaryVolumeDescriptor {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PrimaryVolumeDescriptor {
|
||||||
|
pub fn new() -> PrimaryVolumeDescriptor {
|
||||||
|
PrimaryVolumeDescriptor{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Directory {
|
pub struct Directory {
|
||||||
name: DirectoryName,
|
name: DirectoryName,
|
||||||
properties: Properties,
|
properties: Properties,
|
||||||
|
@ -121,12 +141,12 @@ impl std::fmt::Display for FileName {
|
||||||
|
|
||||||
pub struct Properties {
|
pub struct Properties {
|
||||||
pub lba: Option<usize>,
|
pub lba: Option<usize>,
|
||||||
pub length: Option<usize>
|
pub size_b: Option<usize>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Properties {
|
impl Default for Properties {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Properties{lba: None, length: None}
|
Properties{lba: None, size_b: None}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue