@@ -10,6 +10,7 @@ use crate::mem::memory_map::*;
1010use crate :: proto:: device_path:: DevicePath ;
1111use crate :: proto:: loaded_image:: LoadedImage ;
1212use crate :: proto:: media:: fs:: SimpleFileSystem ;
13+ use crate :: proto:: BootPolicy ;
1314use crate :: proto:: { Protocol , ProtocolPointer } ;
1415use crate :: util:: opt_nonnull_to_ptr;
1516use crate :: { Char16 , Error , Event , Guid , Handle , Result , Status , StatusExt } ;
@@ -848,17 +849,17 @@ impl BootServices {
848849 match source {
849850 LoadImageSource :: FromBuffer { buffer, file_path } => {
850851 // Boot policy is ignored when loading from source buffer.
851- boot_policy = 0 ;
852+ boot_policy = BootPolicy :: FALSE ;
852853
853854 device_path = file_path. map ( |p| p. as_ffi_ptr ( ) ) . unwrap_or ( ptr:: null ( ) ) ;
854855 source_buffer = buffer. as_ptr ( ) ;
855856 source_size = buffer. len ( ) ;
856857 }
857858 LoadImageSource :: FromDevicePath {
858859 device_path : file_path,
859- from_boot_manager ,
860+ bool_policy ,
860861 } => {
861- boot_policy = u8 :: from ( from_boot_manager ) ;
862+ boot_policy = bool_policy ;
862863 device_path = file_path. as_ffi_ptr ( ) ;
863864 source_buffer = ptr:: null ( ) ;
864865 source_size = 0 ;
@@ -868,7 +869,7 @@ impl BootServices {
868869 let mut image_handle = ptr:: null_mut ( ) ;
869870 unsafe {
870871 ( self . 0 . load_image ) (
871- boot_policy,
872+ boot_policy. into ( ) ,
872873 parent_image_handle. as_ptr ( ) ,
873874 device_path. cast ( ) ,
874875 source_buffer,
@@ -1403,9 +1404,9 @@ pub enum LoadImageSource<'a> {
14031404
14041405 /// Load an image via the [`SimpleFileSystem`] protocol. If there is
14051406 /// no instance of that protocol associated with the path then the
1406- /// behavior depends on `from_boot_manager` . If `true` , attempt to
1407- /// load via the `LoadFile` protocol. If `false` , attempt to load
1408- /// via the `LoadFile2` protocol, then fall back to `LoadFile`.
1407+ /// behavior depends on [`BootPolicy`] . If [`BootPolicy::TRUE`] , attempt to
1408+ /// load via the [ `LoadFile`] protocol. If [`BootPolicy::FALSE`] , attempt to
1409+ /// load via the [ `LoadFile2`] protocol, then fall back to [ `LoadFile`] .
14091410 FromDevicePath {
14101411 /// The full device path from which to load the image.
14111412 ///
@@ -1416,12 +1417,8 @@ pub enum LoadImageSource<'a> {
14161417 /// and not just `\\EFI\\BOOT\\BOOTX64.EFI`.
14171418 device_path : & ' a DevicePath ,
14181419
1419- /// If there is no instance of [`SimpleFileSystem`] protocol associated
1420- /// with the given device path, then this function will attempt to use
1421- /// `LoadFileProtocol` (`from_boot_manager` is `true`) or
1422- /// `LoadFile2Protocol`, and then `LoadFileProtocol`
1423- /// (`from_boot_manager` is `false`).
1424- from_boot_manager : bool ,
1420+ /// The [`BootPolicy`] to use.
1421+ bool_policy : BootPolicy ,
14251422 } ,
14261423}
14271424
0 commit comments