Skip to content

Commit 35c97a2

Browse files
committed
guid-create: All changes merged upstream
Just waiting for release Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 1fcbe45 commit 35c97a2

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework_lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spin = { version = "0.9.8" }
3434
no-std-compat = { version = "0.4.1", features = [ "alloc" ] }
3535
hidapi = { version = "2.6.3", features = [ "windows-native" ], optional = true }
3636
rusb = { version = "0.9.4", optional = true }
37-
guid-create = { git = "https://github.com/FrameworkComputer/guid-create", branch = "no-rand", default-features = false }
37+
guid-create = { git = "https://github.com/kurtlawrence/guid-create", default-features = false }
3838

3939
[target.'cfg(target_os = "uefi")'.dependencies]
4040
uefi = { version = "0.20", features = ["alloc"] }

framework_lib/src/capsule.rs

Lines changed: 4 additions & 4 deletions
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::CGuid;
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: CGuid,
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: Guid::from(esrt::WINUX_GUID),
208+
capsule_guid: CGuid::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, Guid::from(esrt::WINUX_GUID));
215+
assert_eq!(cap.capsule_guid, CGuid::from(esrt::WINUX_GUID));
216216
let ux_header = parse_ux_header(&data);
217217
assert_eq!(
218218
ux_header,

framework_lib/src/commandline/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +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};
10+
use guid_create::{CGuid, GUID};
1111
use log::Level;
1212
use num_traits::FromPrimitive;
1313

@@ -1275,7 +1275,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
12751275
println!(" Size: {:>20} B", data.len());
12761276
println!(" Size: {:>20} KB", data.len() / 1024);
12771277
if let Some(header) = analyze_capsule(&data) {
1278-
if header.capsule_guid == Guid::from(esrt::WINUX_GUID) {
1278+
if header.capsule_guid == CGuid::from(esrt::WINUX_GUID) {
12791279
let ux_header = capsule::parse_ux_header(&data);
12801280
if let Some(dump_path) = &args.dump {
12811281
// TODO: Better error handling, rather than just panicking

framework_lib/src/esrt/mod.rs

Lines changed: 7 additions & 7 deletions
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, GUID};
18+
use guid_create::{CGuid, GUID};
1919

2020
#[cfg(target_os = "linux")]
2121
use std::fs;
@@ -193,7 +193,7 @@ pub enum FrameworkGuidKind {
193193
Unknown,
194194
}
195195

196-
pub fn match_guid_kind(guid: &Guid) -> FrameworkGuidKind {
196+
pub fn match_guid_kind(guid: &CGuid) -> FrameworkGuidKind {
197197
match GUID::from(*guid) {
198198
TGL_BIOS_GUID => FrameworkGuidKind::TglBios,
199199
ADL_BIOS_GUID => FrameworkGuidKind::AdlBios,
@@ -292,7 +292,7 @@ impl UpdateStatus {
292292
// TODO: Decode into proper Rust types
293293
#[derive(Clone)]
294294
pub struct EsrtResourceEntry {
295-
pub fw_class: Guid,
295+
pub fw_class: CGuid,
296296
pub fw_type: u32, // ResourceType
297297
pub fw_version: u32,
298298
pub lowest_supported_fw_version: u32,
@@ -364,7 +364,7 @@ fn esrt_from_sysfs(dir: &Path) -> io::Result<Esrt> {
364364
let last_attempt_version = fs::read_to_string(path.join("last_attempt_version"))?;
365365
let last_attempt_status = fs::read_to_string(path.join("last_attempt_status"))?;
366366
let esrt = EsrtResourceEntry {
367-
fw_class: Guid::from(
367+
fw_class: CGuid::from(
368368
GUID::parse(fw_class.trim()).expect("Kernel provided wrong value"),
369369
),
370370
fw_type: fw_type
@@ -436,7 +436,7 @@ pub fn get_esrt() -> Option<Esrt> {
436436
let ver_str = caps.get(2).unwrap().as_str().to_string();
437437

438438
let guid = GUID::parse(guid_str.trim()).expect("Kernel provided wrong value");
439-
let guid_kind = match_guid_kind(&Guid::from(guid));
439+
let guid_kind = match_guid_kind(&CGuid::from(guid));
440440
let ver = u32::from_str_radix(&ver_str, 16).unwrap();
441441
debug!("ESRT Entry {}", i);
442442
debug!(" Name: {:?}", guid_kind);
@@ -456,7 +456,7 @@ pub fn get_esrt() -> Option<Esrt> {
456456
// TODO: The missing fields are present in Device Manager
457457
// So there must be a way to get at them
458458
let esrt = EsrtResourceEntry {
459-
fw_class: Guid::from(guid),
459+
fw_class: CGuid::from(guid),
460460
fw_type,
461461
fw_version: ver,
462462
// TODO: Not exposed by windows
@@ -543,7 +543,7 @@ pub fn get_esrt() -> Option<Esrt> {
543543
for table in config_tables {
544544
// TODO: Why aren't they the same type?
545545
//debug!("Table: {:?}", table);
546-
let table_guid: Guid = unsafe { std::mem::transmute(table.guid) };
546+
let table_guid: CGuid = unsafe { std::mem::transmute(table.guid) };
547547
let table_guid = GUID::from(table_guid);
548548
match table_guid {
549549
SYSTEM_RESOURCE_TABLE_GUID => unsafe {

0 commit comments

Comments
 (0)