@@ -12,27 +12,16 @@ use std::mem;
12
12
use bitflags:: bitflags;
13
13
use vm_memory:: ByteValued ;
14
14
15
- #[ cfg( target_os = "linux" ) ]
16
15
pub use libc:: {
17
16
blksize_t, dev_t, ino64_t, mode_t, nlink_t, off64_t, pread64, preadv64, pwrite64, pwritev64,
18
17
stat64, statvfs64,
19
18
} ;
20
19
21
- #[ cfg( target_os = "macos" ) ]
22
- pub use libc:: {
23
- blksize_t, dev_t, ino_t as ino64_t, mode_t, nlink_t, off_t as off64_t, pread as pread64,
24
- preadv as preadv64, pwrite as pwrite64, pwritev as pwritev64, stat as stat64,
25
- statvfs as statvfs64,
26
- } ;
27
-
28
20
/// Version number of this interface.
29
21
pub const KERNEL_VERSION : u32 = 7 ;
30
22
31
23
/// Minor version number of this interface.
32
- #[ cfg( target_os = "linux" ) ]
33
24
pub const KERNEL_MINOR_VERSION : u32 = 33 ;
34
- #[ cfg( target_os = "macos" ) ]
35
- pub const KERNEL_MINOR_VERSION : u32 = 19 ;
36
25
37
26
/// Init reply size is FUSE_COMPAT_INIT_OUT_SIZE
38
27
pub const KERNEL_MINOR_VERSION_INIT_OUT_SIZE : u32 = 5 ;
@@ -571,25 +560,16 @@ pub struct Attr {
571
560
pub atime : u64 ,
572
561
pub mtime : u64 ,
573
562
pub ctime : u64 ,
574
- #[ cfg( target_os = "macos" ) ]
575
- pub crtime : u64 ,
576
563
pub atimensec : u32 ,
577
564
pub mtimensec : u32 ,
578
565
pub ctimensec : u32 ,
579
- #[ cfg( target_os = "macos" ) ]
580
- pub crtimensec : u32 ,
581
566
pub mode : u32 ,
582
567
pub nlink : u32 ,
583
568
pub uid : u32 ,
584
569
pub gid : u32 ,
585
570
pub rdev : u32 ,
586
- #[ cfg( target_os = "macos" ) ]
587
- pub flags : u32 ,
588
571
pub blksize : u32 ,
589
- #[ cfg( target_os = "linux" ) ]
590
572
pub flags : u32 ,
591
- #[ cfg( target_os = "macos" ) ]
592
- pub padding : u32 ,
593
573
}
594
574
unsafe impl ByteValued for Attr { }
595
575
@@ -611,39 +591,19 @@ impl Attr {
611
591
atimensec : st. st_atime_nsec as u32 ,
612
592
mtimensec : st. st_mtime_nsec as u32 ,
613
593
ctimensec : st. st_ctime_nsec as u32 ,
614
- #[ cfg( target_os = "linux" ) ]
615
594
mode : st. st_mode ,
616
- #[ cfg( target_os = "macos" ) ]
617
- mode : st. st_mode as u32 ,
618
595
// In Linux st.st_nlink is u64 on x86_64 and powerpc64, and u32 on other architectures
619
- // In macos, st_nlink is always u16
620
596
// ref:
621
597
// linux: https://github.com/rust-lang/rust/blob/1.69.0/library/std/src/os/linux/raw.rs#L333
622
- // macos: https://github.com/rust-lang/rust/blob/1.69.0/library/std/src/os/macos/raw.rs#L44
623
- #[ cfg( any(
624
- target_os = "macos" ,
625
- all(
626
- target_os = "linux" ,
627
- any( target_arch = "x86_64" , target_arch = "powerpc64" )
628
- )
629
- ) ) ]
598
+ #[ cfg( any( target_arch = "x86_64" , target_arch = "powerpc64" ) ) ]
630
599
nlink : st. st_nlink as u32 ,
631
- #[ cfg( all(
632
- target_os = "linux" ,
633
- not( any( target_arch = "x86_64" , target_arch = "powerpc64" ) )
634
- ) ) ]
600
+ #[ cfg( not( any( target_arch = "x86_64" , target_arch = "powerpc64" ) ) ) ]
635
601
nlink : st. st_nlink ,
636
602
uid : st. st_uid ,
637
603
gid : st. st_gid ,
638
604
rdev : st. st_rdev as u32 ,
639
605
blksize : st. st_blksize as u32 ,
640
606
flags,
641
- #[ cfg( target_os = "macos" ) ]
642
- crtime : 0 ,
643
- #[ cfg( target_os = "macos" ) ]
644
- crtimensec : 0 ,
645
- #[ cfg( target_os = "macos" ) ]
646
- padding : 0 ,
647
607
}
648
608
}
649
609
}
@@ -689,7 +649,6 @@ pub struct Kstatfs {
689
649
unsafe impl ByteValued for Kstatfs { }
690
650
691
651
impl From < statvfs64 > for Kstatfs {
692
- #[ cfg( target_os = "linux" ) ]
693
652
fn from ( st : statvfs64 ) -> Self {
694
653
Kstatfs {
695
654
blocks : st. f_blocks ,
@@ -703,21 +662,6 @@ impl From<statvfs64> for Kstatfs {
703
662
..Default :: default ( )
704
663
}
705
664
}
706
-
707
- #[ cfg( target_os = "macos" ) ]
708
- fn from ( st : statvfs64 ) -> Self {
709
- Kstatfs {
710
- blocks : st. f_blocks as u64 ,
711
- bfree : st. f_bfree as u64 ,
712
- bavail : st. f_bavail as u64 ,
713
- files : st. f_files as u64 ,
714
- ffree : st. f_ffree as u64 ,
715
- bsize : st. f_bsize as u32 ,
716
- namelen : st. f_namemax as u32 ,
717
- frsize : st. f_frsize as u32 ,
718
- ..Default :: default ( )
719
- }
720
- }
721
665
}
722
666
723
667
#[ repr( C ) ]
@@ -885,10 +829,6 @@ unsafe impl ByteValued for MkdirIn {}
885
829
#[ derive( Debug , Default , Copy , Clone ) ]
886
830
pub struct RenameIn {
887
831
pub newdir : u64 ,
888
- #[ cfg( target_os = "macos" ) ]
889
- pub flags : u32 ,
890
- #[ cfg( target_os = "macos" ) ]
891
- pub padding : u32 ,
892
832
}
893
833
unsafe impl ByteValued for RenameIn { }
894
834
@@ -1059,10 +999,6 @@ unsafe impl ByteValued for SetxattrIn {}
1059
999
pub struct GetxattrIn {
1060
1000
pub size : u32 ,
1061
1001
pub padding : u32 ,
1062
- #[ cfg( target_os = "macos" ) ]
1063
- pub position : u32 ,
1064
- #[ cfg( target_os = "macos" ) ]
1065
- pub padding2 : u32 ,
1066
1002
}
1067
1003
unsafe impl ByteValued for GetxattrIn { }
1068
1004
@@ -1377,24 +1313,15 @@ mod tests {
1377
1313
1378
1314
#[ test]
1379
1315
fn test_struct_size ( ) {
1380
- #[ cfg( target_os = "linux" ) ]
1381
1316
assert_eq ! ( std:: mem:: size_of:: <Attr >( ) , 88 ) ;
1382
- #[ cfg( target_os = "macos" ) ]
1383
- assert_eq ! ( std:: mem:: size_of:: <Attr >( ) , 104 ) ;
1384
1317
assert_eq ! ( std:: mem:: size_of:: <Kstatfs >( ) , 80 ) ;
1385
1318
assert_eq ! ( std:: mem:: size_of:: <FileLock >( ) , 24 ) ;
1386
- #[ cfg( target_os = "linux" ) ]
1387
1319
assert_eq ! ( std:: mem:: size_of:: <EntryOut >( ) , 128 ) ;
1388
- #[ cfg( target_os = "macos" ) ]
1389
- assert_eq ! ( std:: mem:: size_of:: <EntryOut >( ) , 144 ) ;
1390
1320
assert_eq ! ( std:: mem:: size_of:: <ForgetIn >( ) , 8 ) ;
1391
1321
assert_eq ! ( std:: mem:: size_of:: <ForgetOne >( ) , 16 ) ;
1392
1322
assert_eq ! ( std:: mem:: size_of:: <BatchForgetIn >( ) , 8 ) ;
1393
1323
assert_eq ! ( std:: mem:: size_of:: <GetattrIn >( ) , 16 ) ;
1394
- #[ cfg( target_os = "linux" ) ]
1395
1324
assert_eq ! ( std:: mem:: size_of:: <AttrOut >( ) , 104 ) ;
1396
- #[ cfg( target_os = "macos" ) ]
1397
- assert_eq ! ( std:: mem:: size_of:: <AttrOut >( ) , 120 ) ;
1398
1325
assert_eq ! ( std:: mem:: size_of:: <MknodIn >( ) , 16 ) ;
1399
1326
assert_eq ! ( std:: mem:: size_of:: <MkdirIn >( ) , 8 ) ;
1400
1327
assert_eq ! ( std:: mem:: size_of:: <InHeader >( ) , 40 ) ;
0 commit comments