1313//! This implementation is mmap-ing the memory of the guest into the current process.
1414
1515use std:: borrow:: Borrow ;
16- #[ cfg( unix) ]
16+ #[ cfg( target_family = " unix" ) ]
1717use std:: io:: { Seek , SeekFrom } ;
1818use std:: ops:: Deref ;
1919use std:: result;
@@ -28,24 +28,24 @@ use crate::guest_memory::{
2828use crate :: volatile_memory:: { VolatileMemory , VolatileSlice } ;
2929use crate :: { AtomicAccess , Bytes , ReadVolatile , WriteVolatile } ;
3030
31- #[ cfg( all( not( feature = "xen" ) , unix) ) ]
31+ #[ cfg( all( not( feature = "xen" ) , target_family = " unix" ) ) ]
3232mod unix;
3333
34- #[ cfg( all( feature = "xen" , unix) ) ]
34+ #[ cfg( all( feature = "xen" , target_family = " unix" ) ) ]
3535pub ( crate ) mod xen;
3636
37- #[ cfg( windows) ]
37+ #[ cfg( target_family = " windows" ) ]
3838mod windows;
3939
40- #[ cfg( all( not( feature = "xen" ) , unix) ) ]
40+ #[ cfg( all( not( feature = "xen" ) , target_family = " unix" ) ) ]
4141pub use unix:: { Error as MmapRegionError , MmapRegion , MmapRegionBuilder } ;
4242
43- #[ cfg( all( feature = "xen" , unix) ) ]
43+ #[ cfg( all( feature = "xen" , target_family = " unix" ) ) ]
4444pub use xen:: { Error as MmapRegionError , MmapRange , MmapRegion , MmapXenFlags } ;
4545
46- #[ cfg( windows) ]
46+ #[ cfg( target_family = " windows" ) ]
4747pub use std:: io:: Error as MmapRegionError ;
48- #[ cfg( windows) ]
48+ #[ cfg( target_family = " windows" ) ]
4949pub use windows:: MmapRegion ;
5050
5151/// A `Bitmap` that can be created starting from an initial size.
@@ -80,7 +80,7 @@ pub enum Error {
8080}
8181
8282// TODO: use this for Windows as well after we redefine the Error type there.
83- #[ cfg( unix) ]
83+ #[ cfg( target_family = " unix" ) ]
8484/// Checks if a mapping of `size` bytes fits at the provided `file_offset`.
8585///
8686/// For a borrowed `FileOffset` and size, this function checks whether the mapping does not
@@ -1042,7 +1042,7 @@ mod tests {
10421042 let gm_list = [ gm, gm_backed_by_file] ;
10431043 for gm in gm_list. iter ( ) {
10441044 let addr = GuestAddress ( 0x1010 ) ;
1045- let mut file = if cfg ! ( unix) {
1045+ let mut file = if cfg ! ( target_family = " unix" ) {
10461046 File :: open ( Path :: new ( "/dev/zero" ) ) . unwrap ( )
10471047 } else {
10481048 File :: open ( Path :: new ( "c:\\ Windows\\ system32\\ ntoskrnl.exe" ) ) . unwrap ( )
@@ -1051,7 +1051,7 @@ mod tests {
10511051 gm. read_exact_volatile_from ( addr, & mut file, mem:: size_of :: < u32 > ( ) )
10521052 . unwrap ( ) ;
10531053 let value: u32 = gm. read_obj ( addr) . unwrap ( ) ;
1054- if cfg ! ( unix) {
1054+ if cfg ! ( target_family = " unix" ) {
10551055 assert_eq ! ( value, 0 ) ;
10561056 } else {
10571057 assert_eq ! ( value, 0x0090_5a4d ) ;
@@ -1060,7 +1060,7 @@ mod tests {
10601060 let mut sink = vec ! [ 0 ; mem:: size_of:: <u32 >( ) ] ;
10611061 gm. write_all_volatile_to ( addr, & mut sink. as_mut_slice ( ) , mem:: size_of :: < u32 > ( ) )
10621062 . unwrap ( ) ;
1063- if cfg ! ( unix) {
1063+ if cfg ! ( target_family = " unix" ) {
10641064 assert_eq ! ( sink, vec![ 0 ; mem:: size_of:: <u32 >( ) ] ) ;
10651065 } else {
10661066 assert_eq ! ( sink, vec![ 0x4d , 0x5a , 0x90 , 0x00 ] ) ;
@@ -1179,7 +1179,7 @@ mod tests {
11791179 // used for the backing file. Refer to Microsoft docs here:
11801180 // https://docs.microsoft.com/en-us/windows/desktop/api/memoryapi/nf-memoryapi-mapviewoffile
11811181 #[ test]
1182- #[ cfg( unix) ]
1182+ #[ cfg( target_family = " unix" ) ]
11831183 fn test_retrieve_offset_from_fd_backing_memory_region ( ) {
11841184 let f = TempFile :: new ( ) . unwrap ( ) . into_file ( ) ;
11851185 f. set_len ( 0x1400 ) . unwrap ( ) ;
0 commit comments