Skip to content

Commit 85b96b3

Browse files
nicholasbishopGabrielMajeri
authored andcommitted
Use open_protocol in file system test
1 parent 645ecb8 commit 85b96b3

File tree

1 file changed

+12
-2
lines changed
  • uefi-test-runner/src/proto/media

1 file changed

+12
-2
lines changed

uefi-test-runner/src/proto/media/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,18 @@ fn test_file_system_info(directory: &mut Directory) {
2727
pub fn test(image: Handle, bt: &BootServices) {
2828
info!("Testing Media Access protocols");
2929

30-
if let Ok(sfs) = bt.locate_protocol::<SimpleFileSystem>() {
31-
let sfs = unsafe { &mut *sfs.get() };
30+
if let Ok(handle) = bt.get_handle_for_protocol::<SimpleFileSystem>() {
31+
let mut sfs = bt
32+
.open_protocol::<SimpleFileSystem>(
33+
OpenProtocolParams {
34+
handle,
35+
agent: image,
36+
controller: None,
37+
},
38+
OpenProtocolAttributes::Exclusive,
39+
)
40+
.expect("failed to open SimpleFileSystem protocol");
41+
3242
let mut directory = sfs.open_volume().unwrap();
3343
let mut buffer = vec![0; 128];
3444
loop {

0 commit comments

Comments
 (0)