Skip to content

lib: rename basic_decode as decode_without_cm #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion efi/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn decode(input_path: &Path) -> Result<(), uefi::Error> {

let nodes = match CollateralManager::embedded_tree() {
Ok(mut cm) => crashlog.decode(&mut cm),
Err(_) => crashlog.basic_decode(),
Err(_) => crashlog.decode_without_cm(),
};

let serialized_data =
Expand Down
2 changes: 1 addition & 1 deletion lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ let crashlog = CrashLog::from_slice(&data).unwrap();
assert_eq!(crashlog.regions[0].records[0].header.version.revision, 1);

// Decode the headers of the Crash Log records into a register tree
let nodes = crashlog.basic_decode();
let nodes = crashlog.decode_without_cm();

// Export the register tree to JSON
assert_eq!(
Expand Down
4 changes: 2 additions & 2 deletions lib/src/crashlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ impl CrashLog {
}

/// Returns the register tree representation of the Crash Log record headers.
pub fn basic_decode(&self) -> Node {
pub fn decode_without_cm(&self) -> Node {
let mut root = Node::root();
for region in self.regions.iter() {
for record in region.records.iter() {
root.merge(record.basic_decode())
root.merge(record.decode_without_cm())
}
}
root
Expand Down
2 changes: 1 addition & 1 deletion lib/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ pub unsafe extern "C" fn crashlog_decode(
}
#[cfg(not(feature = "embedded_collateral_tree"))]
{
alloc(crashlog.basic_decode())
alloc(crashlog.decode_without_cm())
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//! assert_eq!(crashlog.regions[0].records[0].header.version.revision, 1);
//!
//! // Decode the headers of the Crash Log records into a register tree
//! let nodes = crashlog.basic_decode();
//! let nodes = crashlog.decode_without_cm();
//!
//! // Export the register tree to JSON
//! assert_eq!(
Expand Down
6 changes: 3 additions & 3 deletions lib/src/record/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ impl Record {
}

/// Decodes the [Record] header into a [Node] tree.
pub fn basic_decode(&self) -> Node {
pub fn decode_without_cm(&self) -> Node {
let root_path = self.header.get_root_path();
self.decode_header(&root_path)
}

#[cfg(feature = "collateral_manager")]
fn basic_decode_cm<T: CollateralTree>(&self, cm: &mut CollateralManager<T>) -> Node {
fn decode_header_using_cm<T: CollateralTree>(&self, cm: &mut CollateralManager<T>) -> Node {
let root_path = self.header.get_root_path_cm(cm);
self.decode_header(&root_path)
}
Expand Down Expand Up @@ -216,7 +216,7 @@ impl Record {
Ok(node) => node,
Err(err) => {
log::warn!("Cannot decode record: {err}. Only the header fields will be decoded.");
self.basic_decode_cm(cm)
self.decode_header_using_cm(cm)
}
}
}
Expand Down