Skip to content

Commit a3f2c56

Browse files
committed
load_image: LoadImageSource::FromFilePath => FromDevicePath
1 parent 11dcb4f commit a3f2c56

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- `CStr16::from_u8_with_nul`.
1010

1111
### Changed
12+
- Renamed `LoadImageSource::FromFilePath` to `LoadImageSource::FromDevicePath`
1213

1314
### Removed
1415

@@ -45,7 +46,6 @@
4546
`BUFFER_TOO_SMALL` error can only occur when reading a directory, not a file.
4647
- `RegularFile::read` now reads in 1 MiB chunks to avoid a bug in some
4748
firmware. This fix also applies to `fs::FileSystem::read`.
48-
4949
## uefi-services - 0.19.0 (2023-06-01)
5050

5151
### Changed

uefi-test-runner/src/boot/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ fn test_load_image(bt: &BootServices) {
9393

9494
log::debug!("load_image with FromBuffer strategy works");
9595
}
96-
// Variant B: FromFilePath
96+
// Variant B: FromDevicePath
9797
{
98-
let load_source = LoadImageSource::FromFilePath {
99-
file_path: image_device_path,
98+
let load_source = LoadImageSource::FromDevicePath {
99+
device_path: image_device_path,
100100
from_boot_manager: false,
101101
};
102102
let _ = bt

uefi/src/table/boot.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,8 +1026,8 @@ impl BootServices {
10261026
source_buffer = buffer.as_ptr();
10271027
source_size = buffer.len();
10281028
}
1029-
LoadImageSource::FromFilePath {
1030-
file_path,
1029+
LoadImageSource::FromDevicePath {
1030+
device_path: file_path,
10311031
from_boot_manager,
10321032
} => {
10331033
boot_policy = u8::from(from_boot_manager);
@@ -1697,11 +1697,21 @@ pub enum LoadImageSource<'a> {
16971697
/// behavior depends on `from_boot_manager`. If `true`, attempt to
16981698
/// load via the `LoadFile` protocol. If `false`, attempt to load
16991699
/// via the `LoadFile2` protocol, then fall back to `LoadFile`.
1700-
FromFilePath {
1701-
/// Device path from which to load the image.
1702-
file_path: &'a DevicePath,
1703-
1704-
/// Whether the request originates from the boot manager.
1700+
FromDevicePath {
1701+
/// The full device path from which to load the image.
1702+
///
1703+
/// The provided path should be a full device path and not just the
1704+
/// file path portion of it. So for example, it must be (the binary
1705+
/// representation)
1706+
/// `PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0xFFFF,0x0)/HD(1,MBR,0xBE1AFDFA,0x3F,0xFBFC1)/\\EFI\\BOOT\\BOOTX64.EFI`
1707+
/// and not just `\\EFI\\BOOT\\BOOTX64.EFI`.
1708+
device_path: &'a DevicePath,
1709+
1710+
/// If there is no instance of [`SimpleFileSystem`] protocol associated
1711+
/// with the given device path, then this function will attempt to use
1712+
/// `LoadFileProtocol` (`from_boot_manager` is `true`) or
1713+
/// `LoadFile2Protocol`, and then `LoadFileProtocol`
1714+
/// (`from_boot_manager` is `false`).
17051715
from_boot_manager: bool,
17061716
},
17071717
}

0 commit comments

Comments
 (0)