Skip to content

Commit d5eab20

Browse files
committed
fixup! Remove vendored guid_macros crate
1 parent e4ffd50 commit d5eab20

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework_lib/src/capsule.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use std::prelude::v1::*;
1212

1313
use core::prelude::rust_2021::derive;
14-
use guid_create::GUID;
14+
use guid_create::Guid;
1515
#[cfg(not(feature = "uefi"))]
1616
use std::fs::File;
1717
#[cfg(not(feature = "uefi"))]
@@ -21,7 +21,7 @@ use std::io::prelude::*;
2121
#[repr(C)]
2222
pub struct EfiCapsuleHeader {
2323
/// A GUID that defines the contents of a capsule.
24-
pub capsule_guid: GUID,
24+
pub capsule_guid: Guid,
2525

2626
/// The size of the capsule header. This may be larger than the size of
2727
/// the EFI_CAPSULE_HEADER since CapsuleGuid may imply
@@ -205,14 +205,14 @@ mod tests {
205205
let data = fs::read(capsule_path).unwrap();
206206
let cap = parse_capsule_header(&data).unwrap();
207207
let expected_header = EfiCapsuleHeader {
208-
capsule_guid: esrt::WINUX_GUID,
208+
capsule_guid: Guid::from(esrt::WINUX_GUID),
209209
header_size: 28,
210210
flags: 65536,
211211
capsule_image_size: 676898,
212212
};
213213
assert_eq!(cap, expected_header);
214214

215-
assert_eq!(cap.capsule_guid, esrt::WINUX_GUID);
215+
assert_eq!(cap.capsule_guid, Guid::from(esrt::WINUX_GUID));
216216
let ux_header = parse_ux_header(&data);
217217
assert_eq!(
218218
ux_header,

framework_lib/src/commandline/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use alloc::format;
77
use alloc::string::String;
88
use alloc::string::ToString;
99
use alloc::vec::Vec;
10+
use guid_create::{Guid, GUID};
1011
use log::Level;
1112
use num_traits::FromPrimitive;
1213

@@ -995,7 +996,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
995996
println!(" Size: {:>20} B", data.len());
996997
println!(" Size: {:>20} KB", data.len() / 1024);
997998
if let Some(header) = analyze_capsule(&data) {
998-
if header.capsule_guid == esrt::WINUX_GUID {
999+
if header.capsule_guid == Guid::from(esrt::WINUX_GUID) {
9991000
let ux_header = capsule::parse_ux_header(&data);
10001001
if let Some(dump_path) = &args.dump {
10011002
// TODO: Better error handling, rather than just panicking
@@ -1397,7 +1398,7 @@ pub fn analyze_capsule(data: &[u8]) -> Option<capsule::EfiCapsuleHeader> {
13971398
let header = capsule::parse_capsule_header(data)?;
13981399
capsule::print_capsule_header(&header);
13991400

1400-
match header.capsule_guid {
1401+
match GUID::from(header.capsule_guid) {
14011402
esrt::TGL_BIOS_GUID => {
14021403
println!(" Type: Framework TGL Insyde BIOS");
14031404
}

framework_lib/src/esrt/mod.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use log::{debug, error, info, trace};
1515
use std::prelude::v1::*;
1616

1717
use core::prelude::v1::derive;
18-
use guid_create::GUID;
18+
use guid_create::{Guid, GUID};
1919

2020
#[cfg(target_os = "linux")]
2121
use std::fs;
@@ -179,8 +179,8 @@ pub enum FrameworkGuidKind {
179179
Unknown,
180180
}
181181

182-
pub fn match_guid_kind(guid: &GUID) -> FrameworkGuidKind {
183-
match *guid {
182+
pub fn match_guid_kind(guid: &Guid) -> FrameworkGuidKind {
183+
match GUID::from(*guid) {
184184
TGL_BIOS_GUID => FrameworkGuidKind::TglBios,
185185
ADL_BIOS_GUID => FrameworkGuidKind::AdlBios,
186186
RPL_BIOS_GUID => FrameworkGuidKind::RplBios,
@@ -296,7 +296,7 @@ pub fn print_esrt(esrt: &Esrt) {
296296
println!(" GUID: {}", entry.fw_class);
297297
println!(
298298
" GUID: {:?}",
299-
match_guid_kind(&entry.fw_class)
299+
match_guid_kind(&Guid::from(entry.fw_class))
300300
);
301301
println!(
302302
" Type: {:?}",
@@ -487,7 +487,7 @@ pub fn get_esrt() -> Option<Esrt> {
487487
let mut buf: Vec<u8> = Vec::new();
488488
let mut table = EfiGetTableIoc {
489489
buf: std::ptr::null_mut(),
490-
uuid: SYSTEM_RESOURCE_TABLE_GUID.to_bytes(),
490+
uuid: SYSTEM_RESOURCE_TABLE_GUID_BYTES,
491491
buf_len: 0,
492492
table_len: 0,
493493
};
@@ -513,6 +513,9 @@ pub const SYSTEM_RESOURCE_TABLE_GUID: GUID = GUID::build_from_components(
513513
0x4f68,
514514
&[0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80],
515515
);
516+
pub const SYSTEM_RESOURCE_TABLE_GUID_BYTES: [u8; 16] = [
517+
0xb1, 0x22, 0xa2, 0x63, 0x36, 0x61, 0x4f, 0x68, 0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80,
518+
];
516519

517520
#[cfg(feature = "uefi")]
518521
pub fn get_esrt() -> Option<Esrt> {

0 commit comments

Comments
 (0)