@@ -217,39 +217,28 @@ fn test_raw_disk_io2(handle: Handle, image: Handle, bt: &BootServices) {
217
217
. expect ( "Failed to get block I/O protocol" ) ;
218
218
219
219
unsafe {
220
- // Create the task context structure
221
- let mut task = core:: mem:: MaybeUninit :: uninit ( ) ;
222
-
223
220
// Create the completion event
224
221
let mut event = bt
225
- . create_event (
226
- EventType :: empty ( ) ,
227
- Tpl :: NOTIFY ,
228
- None ,
229
- NonNull :: new ( task. as_mut_ptr ( ) as _ ) ,
230
- )
222
+ . create_event ( EventType :: empty ( ) , Tpl :: NOTIFY , None , None )
231
223
. expect ( "Failed to create disk I/O completion event" ) ;
232
224
233
225
// Initialise the task context
234
- task. write ( DiskIoTask {
226
+ let mut task = DiskIoTask {
235
227
token : DiskIo2Token {
236
228
event : event. unsafe_clone ( ) ,
237
229
transaction_status : uefi:: Status :: NOT_READY ,
238
230
} ,
239
231
buffer : [ 0 ; 512 ] ,
240
- } ) ;
241
-
242
- // Get a mutable reference to the task to not move it
243
- let task_ref = task. assume_init_mut ( ) ;
232
+ } ;
244
233
245
234
// Initiate the asynchronous read operation
246
235
disk_io2
247
236
. read_disk_raw (
248
237
block_io. media ( ) . media_id ( ) ,
249
238
0 ,
250
- NonNull :: new ( & mut task_ref . token as _ ) ,
251
- task_ref . buffer . len ( ) ,
252
- task_ref . buffer . as_mut_ptr ( ) ,
239
+ NonNull :: new ( & mut task . token as _ ) ,
240
+ task . buffer . len ( ) ,
241
+ task . buffer . as_mut_ptr ( ) ,
253
242
)
254
243
. expect ( "Failed to initiate asynchronous disk I/O read" ) ;
255
244
@@ -258,9 +247,9 @@ fn test_raw_disk_io2(handle: Handle, image: Handle, bt: &BootServices) {
258
247
. expect ( "Failed to wait on completion event" ) ;
259
248
260
249
// Verify that the disk's MBR signature is correct
261
- assert_eq ! ( task_ref . token. transaction_status, uefi:: Status :: SUCCESS ) ;
262
- assert_eq ! ( task_ref . buffer[ 510 ] , 0x55 ) ;
263
- assert_eq ! ( task_ref . buffer[ 511 ] , 0xaa ) ;
250
+ assert_eq ! ( task . token. transaction_status, uefi:: Status :: SUCCESS ) ;
251
+ assert_eq ! ( task . buffer[ 510 ] , 0x55 ) ;
252
+ assert_eq ! ( task . buffer[ 511 ] , 0xaa ) ;
264
253
265
254
info ! ( "Raw disk I/O 2 succeeded" ) ;
266
255
}
0 commit comments