@@ -217,39 +217,28 @@ fn test_raw_disk_io2(handle: Handle, image: Handle, bt: &BootServices) {
217217 . expect ( "Failed to get block I/O protocol" ) ;
218218
219219 unsafe {
220- // Create the task context structure
221- let mut task = core:: mem:: MaybeUninit :: uninit ( ) ;
222-
223220 // Create the completion event
224221 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 )
231223 . expect ( "Failed to create disk I/O completion event" ) ;
232224
233225 // Initialise the task context
234- task. write ( DiskIoTask {
226+ let mut task = DiskIoTask {
235227 token : DiskIo2Token {
236228 event : event. unsafe_clone ( ) ,
237229 transaction_status : uefi:: Status :: NOT_READY ,
238230 } ,
239231 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+ } ;
244233
245234 // Initiate the asynchronous read operation
246235 disk_io2
247236 . read_disk_raw (
248237 block_io. media ( ) . media_id ( ) ,
249238 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 ( ) ,
253242 )
254243 . expect ( "Failed to initiate asynchronous disk I/O read" ) ;
255244
@@ -258,9 +247,9 @@ fn test_raw_disk_io2(handle: Handle, image: Handle, bt: &BootServices) {
258247 . expect ( "Failed to wait on completion event" ) ;
259248
260249 // 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 ) ;
264253
265254 info ! ( "Raw disk I/O 2 succeeded" ) ;
266255 }
0 commit comments