1414use log:: { debug, error, info, trace} ;
1515use std:: prelude:: v1:: * ;
1616
17+ use crate :: guid:: CGuid ;
1718use core:: prelude:: v1:: derive;
18- use guid_create:: { Guid , GUID } ;
19+ #[ cfg( not( feature = "uefi" ) ) ]
20+ use guid_create:: GUID ;
21+ #[ cfg( feature = "uefi" ) ]
22+ use guid_create_no_std:: GUID ;
1923
2024#[ cfg( target_os = "linux" ) ]
2125use std:: fs;
@@ -193,7 +197,7 @@ pub enum FrameworkGuidKind {
193197 Unknown ,
194198}
195199
196- pub fn match_guid_kind ( guid : & Guid ) -> FrameworkGuidKind {
200+ pub fn match_guid_kind ( guid : & CGuid ) -> FrameworkGuidKind {
197201 match GUID :: from ( * guid) {
198202 TGL_BIOS_GUID => FrameworkGuidKind :: TglBios ,
199203 ADL_BIOS_GUID => FrameworkGuidKind :: AdlBios ,
@@ -292,7 +296,7 @@ impl UpdateStatus {
292296// TODO: Decode into proper Rust types
293297#[ derive( Clone ) ]
294298pub struct EsrtResourceEntry {
295- pub fw_class : Guid ,
299+ pub fw_class : CGuid ,
296300 pub fw_type : u32 , // ResourceType
297301 pub fw_version : u32 ,
298302 pub lowest_supported_fw_version : u32 ,
@@ -364,7 +368,7 @@ fn esrt_from_sysfs(dir: &Path) -> io::Result<Esrt> {
364368 let last_attempt_version = fs:: read_to_string ( path. join ( "last_attempt_version" ) ) ?;
365369 let last_attempt_status = fs:: read_to_string ( path. join ( "last_attempt_status" ) ) ?;
366370 let esrt = EsrtResourceEntry {
367- fw_class : Guid :: from (
371+ fw_class : CGuid :: from (
368372 GUID :: parse ( fw_class. trim ( ) ) . expect ( "Kernel provided wrong value" ) ,
369373 ) ,
370374 fw_type : fw_type
@@ -436,7 +440,7 @@ pub fn get_esrt() -> Option<Esrt> {
436440 let ver_str = caps. get ( 2 ) . unwrap ( ) . as_str ( ) . to_string ( ) ;
437441
438442 let guid = GUID :: parse ( guid_str. trim ( ) ) . expect ( "Kernel provided wrong value" ) ;
439- let guid_kind = match_guid_kind ( & Guid :: from ( guid) ) ;
443+ let guid_kind = match_guid_kind ( & CGuid :: from ( guid) ) ;
440444 let ver = u32:: from_str_radix ( & ver_str, 16 ) . unwrap ( ) ;
441445 debug ! ( "ESRT Entry {}" , i) ;
442446 debug ! ( " Name: {:?}" , guid_kind) ;
@@ -456,7 +460,7 @@ pub fn get_esrt() -> Option<Esrt> {
456460 // TODO: The missing fields are present in Device Manager
457461 // So there must be a way to get at them
458462 let esrt = EsrtResourceEntry {
459- fw_class : Guid :: from ( guid) ,
463+ fw_class : CGuid :: from ( guid) ,
460464 fw_type,
461465 fw_version : ver,
462466 // TODO: Not exposed by windows
@@ -543,7 +547,7 @@ pub fn get_esrt() -> Option<Esrt> {
543547 for table in config_tables {
544548 // TODO: Why aren't they the same type?
545549 //debug!("Table: {:?}", table);
546- let table_guid: Guid = unsafe { std:: mem:: transmute ( table. guid ) } ;
550+ let table_guid: CGuid = unsafe { std:: mem:: transmute ( table. guid ) } ;
547551 let table_guid = GUID :: from ( table_guid) ;
548552 match table_guid {
549553 SYSTEM_RESOURCE_TABLE_GUID => unsafe {
0 commit comments