@@ -120,13 +120,13 @@ struct BootServicesInternal {
120
120
register_protocol_notify : unsafe extern "efiapi" fn (
121
121
protocol : & Guid ,
122
122
event : uefi_raw:: Event ,
123
- registration : * mut Option < ProtocolSearchKey > ,
123
+ registration : * mut * const c_void ,
124
124
) -> Status ,
125
125
locate_handle : unsafe extern "efiapi" fn (
126
126
search_ty : i32 ,
127
- proto : Option < & Guid > ,
128
- key : Option < ProtocolSearchKey > ,
129
- buf_sz : & mut usize ,
127
+ proto : * const Guid ,
128
+ key : * const c_void ,
129
+ buf_sz : * mut usize ,
130
130
buf : * mut uefi_raw:: Handle ,
131
131
) -> Status ,
132
132
locate_device_path : unsafe extern "efiapi" fn (
@@ -209,9 +209,9 @@ struct BootServicesInternal {
209
209
) -> Status ,
210
210
locate_handle_buffer : unsafe extern "efiapi" fn (
211
211
search_ty : i32 ,
212
- proto : Option < & Guid > ,
213
- key : Option < ProtocolSearchKey > ,
214
- no_handles : & mut usize ,
212
+ proto : * const Guid ,
213
+ key : * const c_void ,
214
+ no_handles : * mut usize ,
215
215
buf : * mut * mut uefi_raw:: Handle ,
216
216
) -> Status ,
217
217
#[ deprecated = "open_protocol and open_protocol_exclusive are better alternatives and available since EFI 1.10 (2002)" ]
@@ -869,15 +869,17 @@ impl BootServices {
869
869
protocol : & Guid ,
870
870
event : Event ,
871
871
) -> Result < ( Event , SearchType ) > {
872
- let mut key = None ;
872
+ let mut key = ptr :: null ( ) ;
873
873
// Safety: we clone `event` a couple times, but there will be only one left once we return.
874
874
unsafe { ( self . 0 . register_protocol_notify ) ( protocol, event. as_ptr ( ) , & mut key) }
875
875
// Safety: as long as this call is successful, `key` will be valid.
876
876
. to_result_with_val ( || unsafe {
877
877
(
878
878
event. unsafe_clone ( ) ,
879
879
// OK to unwrap: key is non-null for Status::SUCCESS.
880
- SearchType :: ByRegisterNotify ( key. unwrap ( ) ) ,
880
+ SearchType :: ByRegisterNotify ( ProtocolSearchKey (
881
+ NonNull :: new ( key. cast_mut ( ) ) . unwrap ( ) ,
882
+ ) ) ,
881
883
)
882
884
} )
883
885
}
@@ -912,9 +914,11 @@ impl BootServices {
912
914
913
915
// Obtain the needed data from the parameters.
914
916
let ( ty, guid, key) = match search_ty {
915
- SearchType :: AllHandles => ( 0 , None , None ) ,
916
- SearchType :: ByRegisterNotify ( registration) => ( 1 , None , Some ( registration) ) ,
917
- SearchType :: ByProtocol ( guid) => ( 2 , Some ( guid) , None ) ,
917
+ SearchType :: AllHandles => ( 0 , ptr:: null ( ) , ptr:: null ( ) ) ,
918
+ SearchType :: ByRegisterNotify ( registration) => {
919
+ ( 1 , ptr:: null ( ) , registration. 0 . as_ptr ( ) . cast_const ( ) )
920
+ }
921
+ SearchType :: ByProtocol ( guid) => ( 2 , guid as * const Guid , ptr:: null ( ) ) ,
918
922
} ;
919
923
920
924
let status =
@@ -1504,9 +1508,11 @@ impl BootServices {
1504
1508
1505
1509
// Obtain the needed data from the parameters.
1506
1510
let ( ty, guid, key) = match search_ty {
1507
- SearchType :: AllHandles => ( 0 , None , None ) ,
1508
- SearchType :: ByRegisterNotify ( registration) => ( 1 , None , Some ( registration) ) ,
1509
- SearchType :: ByProtocol ( guid) => ( 2 , Some ( guid) , None ) ,
1511
+ SearchType :: AllHandles => ( 0 , ptr:: null ( ) , ptr:: null ( ) ) ,
1512
+ SearchType :: ByRegisterNotify ( registration) => {
1513
+ ( 1 , ptr:: null ( ) , registration. 0 . as_ptr ( ) . cast_const ( ) )
1514
+ }
1515
+ SearchType :: ByProtocol ( guid) => ( 2 , guid as * const _ , ptr:: null ( ) ) ,
1510
1516
} ;
1511
1517
1512
1518
unsafe { ( self . 0 . locate_handle_buffer ) ( ty, guid, key, & mut num_handles, & mut buffer) }
0 commit comments