Skip to content

Commit 7151e7f

Browse files
e820nicholasbishop
authored andcommitted
Move close_event() to callback
1 parent 468c4af commit 7151e7f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use uefi::proto::media::fs::SimpleFileSystem;
1010
use uefi::table::boot::{EventType, MemoryType, OpenProtocolAttributes, OpenProtocolParams, Tpl};
1111
use uefi::table::runtime::{Daylight, Time, TimeParams};
1212
use uefi::Event;
13+
use uefi_services::system_table;
1314

1415
/// Test directory entry iteration.
1516
fn test_existing_dir(directory: &mut Directory) {
@@ -181,12 +182,14 @@ fn test_raw_disk_io(handle: Handle, image: Handle, bt: &BootServices) {
181182
}
182183

183184
/// Asynchronous disk I/O 2 transaction callback
184-
unsafe extern "efiapi" fn disk_io2_callback(_event: Event, ctx: Option<NonNull<c_void>>) {
185+
unsafe extern "efiapi" fn disk_io2_callback(event: Event, ctx: Option<NonNull<c_void>>) {
185186
let ptr = ctx.unwrap().as_ptr() as *const u8;
186187

187188
// Verify that the disk's MBR signature is correct
188189
assert_eq!(*ptr.offset(510), 0x55);
189190
assert_eq!(*ptr.offset(511), 0xaa);
191+
192+
system_table().as_ref().boot_services().close_event(event).unwrap();
190193
}
191194

192195
/// Tests raw disk I/O through the DiskIo2 protocol.
@@ -233,9 +236,8 @@ fn test_raw_disk_io2(handle: Handle, image: Handle, bt: &BootServices) {
233236
.read_disk_raw(0, 0, &mut token, SIZE, buf)
234237
.expect("Failed to read from disk");
235238
}
236-
239+
237240
info!("Raw disk I/O 2 succeeded");
238-
bt.close_event(event).unwrap();
239241
bt.free_pool(buf).unwrap();
240242
}
241243

0 commit comments

Comments
 (0)