File tree 7 files changed +26
-2
lines changed
7 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ async fn main() -> Result<()> {
39
39
false ,
40
40
false ,
41
41
false ,
42
+ false ,
42
43
) ;
43
44
let handle = mount_point. mount ( ) . await ?;
44
45
let mut buffer = String :: new ( ) ;
Original file line number Diff line number Diff line change @@ -185,6 +185,7 @@ pub extern "system" fn Java_RustLibrary_mount(
185
185
false ,
186
186
false ,
187
187
false ,
188
+ false ,
188
189
) ;
189
190
190
191
let handle = match RT . block_on ( async {
Original file line number Diff line number Diff line change 43
43
//! args.next(); // skip program name
44
44
//! let mount_path = args.next().expect("mount_path expected");
45
45
//! let data_path = args.next().expect("data_path expected");
46
- //!
47
46
//! struct PasswordProviderImpl {}
48
47
//! impl PasswordProvider for PasswordProviderImpl {
49
48
//! fn get_password(&self) -> Option<SecretString> {
60
59
//! false,
61
60
//! false,
62
61
//! false,
62
+ //! false,
63
63
//! );
64
64
//! let handle = mount_point.mount().await?;
65
65
//! let mut buffer = String::new();
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ pub trait MountPoint {
36
36
allow_other : bool ,
37
37
direct_io : bool ,
38
38
suid_support : bool ,
39
+ read_only : bool ,
39
40
) -> Self
40
41
where
41
42
Self : Sized ;
@@ -74,6 +75,7 @@ pub(crate) trait MountHandleInner: Future<Output = io::Result<()>> {
74
75
/// **`allow_other`** allow other users to access the file system
75
76
/// **`direct_io`** use direct I/O (bypass page cache for open files)
76
77
/// **`suid_support`** if it should allow setting `SUID` and `SGID` when files are created. On `false` it will unset those flags when creating files
78
+ /// **`read_only`** Set fuse filesystem read-only mount option, default is disabled.
77
79
///
78
80
#[ must_use]
79
81
#[ allow( clippy:: fn_params_excessive_bools) ]
@@ -86,6 +88,7 @@ pub fn create_mount_point(
86
88
allow_other : bool ,
87
89
direct_io : bool ,
88
90
suid_support : bool ,
91
+ read_only : bool ,
89
92
) -> impl MountPoint {
90
93
MountPointImpl :: new (
91
94
mountpoint. to_path_buf ( ) ,
@@ -96,6 +99,7 @@ pub fn create_mount_point(
96
99
allow_other,
97
100
direct_io,
98
101
suid_support,
102
+ read_only,
99
103
)
100
104
}
101
105
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ pub struct MountPointImpl {
22
22
allow_other : bool ,
23
23
direct_io : bool ,
24
24
suid_support : bool ,
25
+ read_only : bool ,
25
26
}
26
27
27
28
#[ async_trait]
@@ -35,6 +36,7 @@ impl MountPoint for MountPointImpl {
35
36
allow_other : bool ,
36
37
direct_io : bool ,
37
38
suid_support : bool ,
39
+ read_only : bool ,
38
40
) -> Self {
39
41
Self {
40
42
mountpoint,
@@ -45,6 +47,7 @@ impl MountPoint for MountPointImpl {
45
47
allow_other,
46
48
direct_io,
47
49
suid_support,
50
+ read_only,
48
51
}
49
52
}
50
53
Original file line number Diff line number Diff line change @@ -1386,6 +1386,7 @@ pub struct MountPointImpl {
1386
1386
allow_other : bool ,
1387
1387
direct_io : bool ,
1388
1388
suid_support : bool ,
1389
+ read_only : bool ,
1389
1390
}
1390
1391
1391
1392
#[ async_trait]
@@ -1399,6 +1400,7 @@ impl MountPoint for MountPointImpl {
1399
1400
allow_other : bool ,
1400
1401
direct_io : bool ,
1401
1402
suid_support : bool ,
1403
+ read_only : bool ,
1402
1404
) -> Self {
1403
1405
Self {
1404
1406
mountpoint,
@@ -1409,6 +1411,7 @@ impl MountPoint for MountPointImpl {
1409
1411
allow_other,
1410
1412
direct_io,
1411
1413
suid_support,
1414
+ read_only,
1412
1415
}
1413
1416
}
1414
1417
@@ -1422,6 +1425,7 @@ impl MountPoint for MountPointImpl {
1422
1425
self . allow_other ,
1423
1426
self . direct_io ,
1424
1427
self . suid_support ,
1428
+ self . read_only ,
1425
1429
)
1426
1430
. await ?;
1427
1431
Ok ( mount:: MountHandle {
@@ -1459,6 +1463,7 @@ async fn mount_fuse(
1459
1463
allow_other : bool ,
1460
1464
direct_io : bool ,
1461
1465
suid_support : bool ,
1466
+ read_only : bool ,
1462
1467
) -> FsResult < MountHandle > {
1463
1468
// create mount point if it doesn't exist
1464
1469
if !mountpoint. exists ( ) {
@@ -1471,7 +1476,7 @@ async fn mount_fuse(
1471
1476
}
1472
1477
}
1473
1478
let mount_options = mount_options
1474
- . read_only ( false )
1479
+ . read_only ( read_only )
1475
1480
. allow_root ( allow_root)
1476
1481
. allow_other ( allow_other)
1477
1482
. clone ( ) ;
Original file line number Diff line number Diff line change @@ -188,6 +188,15 @@ fn get_cli_args() -> ArgMatches {
188
188
. requires ( "data-dir" )
189
189
. help ( "If it should allow setting SUID and SGID when files are created. Default is false and it will unset those flags when creating files" ) ,
190
190
)
191
+ . arg (
192
+ Arg :: new ( "read-only" )
193
+ . long ( "read-only" )
194
+ . short ( 'e' )
195
+ . action ( ArgAction :: SetTrue )
196
+ . requires ( "mount-point" )
197
+ . requires ( "data-dir" )
198
+ . help ( "Set fuse filesystem read-only mount option, default is disabled." )
199
+ )
191
200
) . subcommand (
192
201
Command :: new ( "passwd" )
193
202
. about ( "Change password for the master key used to encrypt the data" )
@@ -355,6 +364,7 @@ async fn run_mount(cipher: Cipher, matches: &ArgMatches) -> Result<()> {
355
364
matches. get_flag ( "allow-other" ) ,
356
365
matches. get_flag ( "direct-io" ) ,
357
366
matches. get_flag ( "suid" ) ,
367
+ matches. get_flag ( "read-only" ) ,
358
368
) ;
359
369
let mount_handle = mount_point. mount ( ) . await . map_err ( |err| {
360
370
error ! ( err = %err) ;
You can’t perform that action at this time.
0 commit comments