Skip to content

Commit c9ecaba

Browse files
committed
Rustdoc dir and part, and rename part::part -> part::generic
Signed-off-by: Daniel Maslowski <[email protected]>
1 parent d483c29 commit c9ecaba

File tree

9 files changed

+26
-17
lines changed

9 files changed

+26
-17
lines changed

src/clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use intel_fw::{
22
EMPTY,
33
ifd::{IFD, IfdError},
44
me::ME,
5-
part::part::ClearOptions,
5+
part::generic::ClearOptions,
66
};
77
use log::warn;
88

src/dir.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/// Directories for ME generation 2 and 3
2+
///
3+
/// There are multiple kinds of partitioning schemes, and some partitions may
4+
/// contain directories, but directories could also be referenced by other data
5+
/// structures, such as in the case of IFWI, so they are separate here.
16
pub mod gen2;
27
pub mod gen3;
38
pub mod man;

src/me.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ use crate::dir::{
1212
gen2::Directory as Gen2Directory,
1313
gen3::{CPD_MAGIC_BYTES, CodePartitionDirectory},
1414
};
15-
use crate::part::fpt::FTPR;
16-
use crate::part::gen2::DirPartition;
17-
use crate::part::gen3::CPDPartition;
18-
use crate::part::part::Partition;
1915
use crate::part::{
20-
fpt::{FPT, MIN_FPT_SIZE},
21-
gen2::Gen2Partition,
22-
gen3::Gen3Partition,
23-
part::ClearOptions,
16+
fpt::{FPT, FTPR, MIN_FPT_SIZE},
17+
gen2::{DirPartition, Gen2Partition},
18+
gen3::{CPDPartition, Gen3Partition},
19+
generic::{ClearOptions, Partition},
2420
partitions::Partitions,
2521
};
2622
use crate::ver::Version;

src/part.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
/// Partitioning for ME generation 2 and 3
2+
///
3+
/// There are multiple kinds of partitioning schemes, and some partitions may
4+
/// contain directories, but directories could also be referenced by other data
5+
/// structures, such as in the case of IFWI, so they are separate.
16
pub mod fpt;
27
pub mod gen2;
38
pub mod gen3;
4-
pub mod part;
9+
pub mod generic;
510
pub mod partitions;

src/part/fpt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use zerocopy_derive::{FromBytes, Immutable, IntoBytes};
2525

2626
use crate::{
2727
EMPTY,
28-
part::part::{ClearOptions, retain},
28+
part::generic::{ClearOptions, retain},
2929
ver::Version,
3030
};
3131

src/part/gen2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::dir::gen2::{ALWAYS_RETAIN, Directory, LUT_HEADER_SIZE};
55
use crate::dump48;
66
use crate::part::{
77
fpt::{FPT, FPTEntry, FTPR},
8-
part::{
8+
generic::{
99
ClearOptions, DataPartition, Partition, UnknownOrMalformedPartition, dir_clean, retain,
1010
strs_to_strings,
1111
},

src/part/gen3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::dir::{
77
use crate::dump48;
88
use crate::part::{
99
fpt::{DIR_PARTS, FPT, FPTEntry, FS_PARTS, FTPR},
10-
part::{
10+
generic::{
1111
ClearOptions, Partition, UnknownOrMalformedPartition, dir_clean, retain, strs_to_strings,
1212
},
1313
};

src/part/part.rs renamed to src/part/generic.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
1+
/// Generic data structures and helpers for partitions
12
use serde::{Deserialize, Serialize};
23

34
use crate::{
45
EMPTY, Removables,
56
part::fpt::{FPTEntry, FTPR},
67
};
78

9+
/// Data partitions are for now treated uniformly, but may carry semantics.
810
#[derive(Serialize, Deserialize, Clone, Debug)]
911
pub struct DataPartition {
1012
pub entry: FPTEntry,
1113
pub data: Vec<u8>,
1214
}
1315

16+
/// Last resort if a partition cannot be classified
1417
#[derive(Serialize, Deserialize, Clone, Debug)]
1518
pub struct UnknownOrMalformedPartition {
1619
pub entry: FPTEntry,
1720
pub data: Vec<u8>,
1821
pub note: String,
1922
}
2023

24+
/// Common trait for partitions and their relationship with the FPT
2125
pub trait Partition {
2226
fn entry(&self) -> &FPTEntry;
2327
fn data(&self) -> &Vec<u8>;
@@ -62,6 +66,7 @@ pub fn strs_to_strings(strs: &[&str]) -> Vec<String> {
6266
Vec::from(strs).iter().map(|s| String::from(*s)).collect()
6367
}
6468

69+
/// Options for clearing partitions and directories
6570
pub struct ClearOptions {
6671
pub keep_modules: bool,
6772
pub parts_force_retention: Vec<String>,

src/part/partitions.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ use zerocopy::IntoBytes;
55

66
use crate::EMPTY;
77
use crate::dir::gen3::CPD_MAGIC_BYTES;
8-
use crate::part::fpt::PartitionKind;
9-
use crate::part::part::ClearOptions;
108
use crate::part::{
11-
fpt::{FPT, FPTEntry},
9+
fpt::{FPT, FPTEntry, PartitionKind},
1210
gen2::{self, Gen2Partition},
1311
gen3::{self, Gen3Partition},
14-
part::{GenUnknownPartition, Partition},
12+
generic::{ClearOptions, GenUnknownPartition, Partition},
1513
};
1614
use crate::ver::Version;
1715

0 commit comments

Comments
 (0)