@@ -339,27 +339,15 @@ impl GuestMemoryRegion for GuestRegionMmap {
339
339
self . mapping . file_offset ( )
340
340
}
341
341
342
- // TODO: This implementation is temporary.
343
- // We need to return None here once we refactor vsock.
344
342
unsafe fn as_slice ( & self ) -> Option < & [ u8 ] > {
345
- // This is safe because we mapped the area at addr ourselves, so this slice will not
346
- // overflow. However, it is possible to alias.
347
- Some ( std:: slice:: from_raw_parts (
348
- self . mapping . as_ptr ( ) ,
349
- self . mapping . size ( ) ,
350
- ) )
343
+ // We don't use this method.
344
+ None
351
345
}
352
346
353
- // TODO: This implementation is temporary.
354
- // We need to return None here once we refactor vsock.
355
347
#[ allow( clippy:: mut_from_ref) ]
356
348
unsafe fn as_mut_slice ( & self ) -> Option < & mut [ u8 ] > {
357
- // This is safe because we mapped the area at addr ourselves, so this slice will not
358
- // overflow. However, it is possible to alias.
359
- Some ( std:: slice:: from_raw_parts_mut (
360
- self . mapping . as_ptr ( ) ,
361
- self . mapping . size ( ) ,
362
- ) )
349
+ // We don't use this method.
350
+ None
363
351
}
364
352
365
353
fn get_host_address ( & self , addr : MemoryRegionAddress ) -> guest_memory:: Result < * mut u8 > {
@@ -370,15 +358,13 @@ impl GuestMemoryRegion for GuestRegionMmap {
370
358
. map ( |addr| self . as_ptr ( ) . wrapping_offset ( addr. raw_value ( ) as isize ) )
371
359
}
372
360
373
- // TODO: This implementation is temporary.
374
- // We need to return None here once we refactor vsock.
375
361
fn get_slice (
376
362
& self ,
377
- offset : MemoryRegionAddress ,
378
- count : usize ,
363
+ _offset : MemoryRegionAddress ,
364
+ _count : usize ,
379
365
) -> guest_memory:: Result < VolatileSlice > {
380
- let slice = self . mapping . get_slice ( offset . raw_value ( ) as usize , count ) ? ;
381
- Ok ( slice )
366
+ // We don't use this method.
367
+ Err ( guest_memory :: Error :: HostAddressNotAvailable )
382
368
}
383
369
384
370
fn as_volatile_slice ( & self ) -> guest_memory:: Result < VolatileSlice > {
0 commit comments