@@ -242,20 +242,20 @@ pub struct VfsOptions {
242
242
243
243
/// Disable fuse open request handling. When enabled, fuse open
244
244
/// requests are always replied with ENOSYS.
245
- #[ cfg( not ( target_os = "macos" ) ) ]
245
+ #[ cfg( target_os = "linux" ) ]
246
246
pub no_open : bool ,
247
247
/// Disable fuse opendir request handling. When enabled, fuse opendir
248
248
/// requests are always replied with ENOSYS.
249
- #[ cfg( not ( target_os = "macos" ) ) ]
249
+ #[ cfg( target_os = "linux" ) ]
250
250
pub no_opendir : bool ,
251
251
/// Disable fuse WRITEBACK_CACHE option so that kernel will not cache
252
252
/// buffer writes.
253
- #[ cfg( not ( target_os = "macos" ) ) ]
253
+ #[ cfg( target_os = "linux" ) ]
254
254
pub no_writeback : bool ,
255
255
/// Enable fuse killpriv_v2 support. When enabled, fuse file system makes sure
256
256
/// to remove security.capability xattr and setuid/setgid bits. See details in
257
257
/// comments for HANDLE_KILLPRIV_V2
258
- #[ cfg( not ( target_os = "macos" ) ) ]
258
+ #[ cfg( target_os = "linux" ) ]
259
259
pub killpriv_v2 : bool ,
260
260
}
261
261
@@ -266,7 +266,7 @@ impl VfsOptions {
266
266
}
267
267
268
268
impl Default for VfsOptions {
269
- #[ cfg( not ( target_os = "macos" ) ) ]
269
+ #[ cfg( target_os = "linux" ) ]
270
270
fn default ( ) -> Self {
271
271
let out_opts = FsOptions :: ASYNC_READ
272
272
| FsOptions :: PARALLEL_DIROPS
@@ -723,44 +723,70 @@ pub mod persist {
723
723
724
724
#[ derive( Versionize , Debug , Default ) ]
725
725
struct VfsOptionsState {
726
- no_open : bool ,
727
- no_opendir : bool ,
728
- no_writeback : bool ,
729
726
in_opts : u64 ,
730
727
out_opts : u64 ,
731
- killpriv_v2 : bool ,
732
728
no_readdir : bool ,
733
729
seal_size : bool ,
730
+ id_mapping_internal : u32 ,
731
+ id_mapping_external : u32 ,
732
+ id_mapping_range : u32 ,
733
+
734
+ #[ cfg( target_os = "linux" ) ]
735
+ no_open : bool ,
736
+ #[ cfg( target_os = "linux" ) ]
737
+ no_opendir : bool ,
738
+ #[ cfg( target_os = "linux" ) ]
739
+ no_writeback : bool ,
740
+ #[ cfg( target_os = "linux" ) ]
741
+ killpriv_v2 : bool ,
734
742
}
735
743
736
744
impl VfsOptions {
737
745
fn save ( & self ) -> VfsOptionsState {
738
746
VfsOptionsState {
739
- no_open : self . no_open ,
740
- no_opendir : self . no_opendir ,
741
- no_writeback : self . no_writeback ,
742
747
in_opts : self . in_opts . bits ( ) ,
743
748
out_opts : self . out_opts . bits ( ) ,
744
- killpriv_v2 : self . killpriv_v2 ,
745
749
no_readdir : self . no_readdir ,
746
750
seal_size : self . seal_size ,
751
+ id_mapping_internal : self . id_mapping . 0 ,
752
+ id_mapping_external : self . id_mapping . 1 ,
753
+ id_mapping_range : self . id_mapping . 2 ,
754
+
755
+ #[ cfg( target_os = "linux" ) ]
756
+ no_open : self . no_open ,
757
+ #[ cfg( target_os = "linux" ) ]
758
+ no_opendir : self . no_opendir ,
759
+ #[ cfg( target_os = "linux" ) ]
760
+ no_writeback : self . no_writeback ,
761
+ #[ cfg( target_os = "linux" ) ]
762
+ killpriv_v2 : self . killpriv_v2 ,
747
763
}
748
764
}
749
765
750
766
fn restore ( state : & VfsOptionsState ) -> VfsResult < VfsOptions > {
751
767
Ok ( VfsOptions {
752
- no_open : state. no_open ,
753
- no_opendir : state. no_opendir ,
754
- no_writeback : state. no_writeback ,
755
768
in_opts : FsOptions :: from_bits ( state. in_opts ) . ok_or ( VfsError :: Persist (
756
769
"Failed to restore VfsOptions.in_opts" . to_owned ( ) ,
757
770
) ) ?,
758
771
out_opts : FsOptions :: from_bits ( state. out_opts ) . ok_or ( VfsError :: Persist (
759
772
"Failed to restore VfsOptions.out_opts" . to_owned ( ) ,
760
773
) ) ?,
761
- killpriv_v2 : state. killpriv_v2 ,
762
774
no_readdir : state. no_readdir ,
763
775
seal_size : state. seal_size ,
776
+ id_mapping : (
777
+ state. id_mapping_internal ,
778
+ state. id_mapping_external ,
779
+ state. id_mapping_range ,
780
+ ) ,
781
+
782
+ #[ cfg( target_os = "linux" ) ]
783
+ no_open : state. no_open ,
784
+ #[ cfg( target_os = "linux" ) ]
785
+ no_opendir : state. no_opendir ,
786
+ #[ cfg( target_os = "linux" ) ]
787
+ no_writeback : state. no_writeback ,
788
+ #[ cfg( target_os = "linux" ) ]
789
+ killpriv_v2 : state. killpriv_v2 ,
764
790
} )
765
791
}
766
792
}
@@ -1431,7 +1457,7 @@ mod tests {
1431
1457
let opts = vfs. opts . load ( ) ;
1432
1458
let out_opts = opts. out_opts ;
1433
1459
1434
- #[ cfg( not ( target_os = "macos" ) ) ]
1460
+ #[ cfg( target_os = "linux" ) ]
1435
1461
{
1436
1462
assert_eq ! ( opts. no_open, true ) ;
1437
1463
assert_eq ! ( opts. no_opendir, true ) ;
@@ -1446,7 +1472,7 @@ mod tests {
1446
1472
assert_eq ! ( vfs. initialized( ) , true ) ;
1447
1473
1448
1474
let opts = vfs. opts . load ( ) ;
1449
- #[ cfg( not ( target_os = "macos" ) ) ]
1475
+ #[ cfg( target_os = "linux" ) ]
1450
1476
{
1451
1477
assert_eq ! ( opts. no_open, false ) ;
1452
1478
assert_eq ! ( opts. no_opendir, false ) ;
@@ -1460,14 +1486,14 @@ mod tests {
1460
1486
assert_eq ! ( vfs. initialized( ) , false ) ;
1461
1487
1462
1488
let vfs = Vfs :: default ( ) ;
1463
- #[ cfg( not ( target_os = "macos" ) ) ]
1489
+ #[ cfg( target_os = "linux" ) ]
1464
1490
let in_opts =
1465
1491
FsOptions :: ASYNC_READ | FsOptions :: ZERO_MESSAGE_OPEN | FsOptions :: ZERO_MESSAGE_OPENDIR ;
1466
1492
#[ cfg( target_os = "macos" ) ]
1467
1493
let in_opts = FsOptions :: ASYNC_READ ;
1468
1494
vfs. init ( in_opts) . unwrap ( ) ;
1469
1495
let opts = vfs. opts . load ( ) ;
1470
- #[ cfg( not ( target_os = "macos" ) ) ]
1496
+ #[ cfg( target_os = "linux" ) ]
1471
1497
{
1472
1498
assert_eq ! ( opts. no_open, true ) ;
1473
1499
assert_eq ! ( opts. no_opendir, true ) ;
0 commit comments