@@ -242,20 +242,20 @@ pub struct VfsOptions {
242242
243243 /// Disable fuse open request handling. When enabled, fuse open
244244 /// requests are always replied with ENOSYS.
245- #[ cfg( not ( target_os = "macos" ) ) ]
245+ #[ cfg( target_os = "linux" ) ]
246246 pub no_open : bool ,
247247 /// Disable fuse opendir request handling. When enabled, fuse opendir
248248 /// requests are always replied with ENOSYS.
249- #[ cfg( not ( target_os = "macos" ) ) ]
249+ #[ cfg( target_os = "linux" ) ]
250250 pub no_opendir : bool ,
251251 /// Disable fuse WRITEBACK_CACHE option so that kernel will not cache
252252 /// buffer writes.
253- #[ cfg( not ( target_os = "macos" ) ) ]
253+ #[ cfg( target_os = "linux" ) ]
254254 pub no_writeback : bool ,
255255 /// Enable fuse killpriv_v2 support. When enabled, fuse file system makes sure
256256 /// to remove security.capability xattr and setuid/setgid bits. See details in
257257 /// comments for HANDLE_KILLPRIV_V2
258- #[ cfg( not ( target_os = "macos" ) ) ]
258+ #[ cfg( target_os = "linux" ) ]
259259 pub killpriv_v2 : bool ,
260260}
261261
@@ -266,7 +266,7 @@ impl VfsOptions {
266266}
267267
268268impl Default for VfsOptions {
269- #[ cfg( not ( target_os = "macos" ) ) ]
269+ #[ cfg( target_os = "linux" ) ]
270270 fn default ( ) -> Self {
271271 let out_opts = FsOptions :: ASYNC_READ
272272 | FsOptions :: PARALLEL_DIROPS
@@ -723,44 +723,70 @@ pub mod persist {
723723
724724 #[ derive( Versionize , Debug , Default ) ]
725725 struct VfsOptionsState {
726- no_open : bool ,
727- no_opendir : bool ,
728- no_writeback : bool ,
729726 in_opts : u64 ,
730727 out_opts : u64 ,
731- killpriv_v2 : bool ,
732728 no_readdir : bool ,
733729 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 ,
734742 }
735743
736744 impl VfsOptions {
737745 fn save ( & self ) -> VfsOptionsState {
738746 VfsOptionsState {
739- no_open : self . no_open ,
740- no_opendir : self . no_opendir ,
741- no_writeback : self . no_writeback ,
742747 in_opts : self . in_opts . bits ( ) ,
743748 out_opts : self . out_opts . bits ( ) ,
744- killpriv_v2 : self . killpriv_v2 ,
745749 no_readdir : self . no_readdir ,
746750 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 ,
747763 }
748764 }
749765
750766 fn restore ( state : & VfsOptionsState ) -> VfsResult < VfsOptions > {
751767 Ok ( VfsOptions {
752- no_open : state. no_open ,
753- no_opendir : state. no_opendir ,
754- no_writeback : state. no_writeback ,
755768 in_opts : FsOptions :: from_bits ( state. in_opts ) . ok_or ( VfsError :: Persist (
756769 "Failed to restore VfsOptions.in_opts" . to_owned ( ) ,
757770 ) ) ?,
758771 out_opts : FsOptions :: from_bits ( state. out_opts ) . ok_or ( VfsError :: Persist (
759772 "Failed to restore VfsOptions.out_opts" . to_owned ( ) ,
760773 ) ) ?,
761- killpriv_v2 : state. killpriv_v2 ,
762774 no_readdir : state. no_readdir ,
763775 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 ,
764790 } )
765791 }
766792 }
@@ -1431,7 +1457,7 @@ mod tests {
14311457 let opts = vfs. opts . load ( ) ;
14321458 let out_opts = opts. out_opts ;
14331459
1434- #[ cfg( not ( target_os = "macos" ) ) ]
1460+ #[ cfg( target_os = "linux" ) ]
14351461 {
14361462 assert_eq ! ( opts. no_open, true ) ;
14371463 assert_eq ! ( opts. no_opendir, true ) ;
@@ -1446,7 +1472,7 @@ mod tests {
14461472 assert_eq ! ( vfs. initialized( ) , true ) ;
14471473
14481474 let opts = vfs. opts . load ( ) ;
1449- #[ cfg( not ( target_os = "macos" ) ) ]
1475+ #[ cfg( target_os = "linux" ) ]
14501476 {
14511477 assert_eq ! ( opts. no_open, false ) ;
14521478 assert_eq ! ( opts. no_opendir, false ) ;
@@ -1460,14 +1486,14 @@ mod tests {
14601486 assert_eq ! ( vfs. initialized( ) , false ) ;
14611487
14621488 let vfs = Vfs :: default ( ) ;
1463- #[ cfg( not ( target_os = "macos" ) ) ]
1489+ #[ cfg( target_os = "linux" ) ]
14641490 let in_opts =
14651491 FsOptions :: ASYNC_READ | FsOptions :: ZERO_MESSAGE_OPEN | FsOptions :: ZERO_MESSAGE_OPENDIR ;
14661492 #[ cfg( target_os = "macos" ) ]
14671493 let in_opts = FsOptions :: ASYNC_READ ;
14681494 vfs. init ( in_opts) . unwrap ( ) ;
14691495 let opts = vfs. opts . load ( ) ;
1470- #[ cfg( not ( target_os = "macos" ) ) ]
1496+ #[ cfg( target_os = "linux" ) ]
14711497 {
14721498 assert_eq ! ( opts. no_open, true ) ;
14731499 assert_eq ! ( opts. no_opendir, true ) ;
0 commit comments