From 56ceffe24424306582f4c3d7799bf47c0dd8fc0e Mon Sep 17 00:00:00 2001 From: Radu Marias Date: Sun, 21 Apr 2024 02:51:04 +0300 Subject: [PATCH] fix passing mount options fix some docs and examples --- Cargo.lock | 2 +- Cargo.toml | 4 ++-- src/encrypted_fs.rs | 2 +- src/lib.rs | 12 ++++++++---- src/main.rs | 6 +++--- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec5e9de4..3fff54ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -293,7 +293,7 @@ checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "encrypted_fs" -version = "0.1.20" +version = "0.1.21" dependencies = [ "base64", "bincode", diff --git a/Cargo.toml b/Cargo.toml index 8614ca9b..21bdb9b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "encrypted_fs" description = "An encrypted file system that mounts with FUSE on Linux. It can be used to create encrypted directories." -version = "0.1.20" +version = "0.1.21" edition = "2021" license = "Apache-2.0" -authors = ["Radu Marias"] +authors = ["Radu Marias "] repository = "https://github.com/radumarias/encrypted_fs" readme = "README.md" keywords = ["filesystem", "fuse", "encryption", "system", "security"] diff --git a/src/encrypted_fs.rs b/src/encrypted_fs.rs index ca346e07..6668368c 100644 --- a/src/encrypted_fs.rs +++ b/src/encrypted_fs.rs @@ -502,7 +502,7 @@ impl EncryptedFs { Ok(DirectoryEntryIterator(iter.into_iter(), self.cipher.clone(), self.key.clone())) } - /// Like [`read_dir`] but with ['FileAttr'] so we don't need to query again for those. + /// Like [read_dir](EncryptedFs::read_dir) but with [FileAttr] so we don't need to query again for those. pub fn read_dir_plus(&self, ino: u64) -> FsResult { let contents_dir = self.data_dir.join(CONTENTS_DIR).join(ino.to_string()); if !contents_dir.is_dir() { diff --git a/src/lib.rs b/src/lib.rs index dc606db1..0ed63b5a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,7 @@ //! //! It can be used a library to create an encrypted file system or mount it with FUSE.\ //! \ -//! This crate also contains a `main.rs` file that can be used to run the encrypted file system from the command line. +//! This crate also contains [main.rs] file that can be used as an example on how to run the encrypted file system from the command line. //! Documentation for that can be found [here](https://crates.io/crates/encrypted_fs). //! //! In the following example, we will see how we can use the library. @@ -29,8 +29,12 @@ //! let uid = unsafe { libc::getuid() }; //! let gid = unsafe { libc::getgid() }; //! -//! let mut mount_options = MountOptions::default(); -//! mount_options.uid(uid).gid(gid).read_only(false); +//! let mut mount_options = MountOptions::default() +//! .uid(uid).gid(gid) +//! .read_only(false) +//! .allow_root(allow_root) +//! .allow_other(allow_other) +//! .clone(); //! let mount_path = OsStr::new(mountpoint.as_str()); //! //! Session::new(mount_options) @@ -53,7 +57,7 @@ //! //! ## EncryptedFs //! -//! Or directly work with ['EncryptedFs'](encrypted_fs::EncryptedFs). You need to specify several parameters to create an encrypted file system: +//! Or directly work with [EncryptedFs](encrypted_fs::EncryptedFs). You need to specify several parameters to create an encrypted file system: //! - `data_dir`: The directory where the file system will be mounted. //! - `password`: The password to encrypt/decrypt the data. //! - `cipher`: The encryption algorithm to use. Currently, it supports these ciphers [Cipher](encrypted_fs::Cipher). diff --git a/src/main.rs b/src/main.rs index 2d4b4f60..a72ff368 100644 --- a/src/main.rs +++ b/src/main.rs @@ -217,13 +217,13 @@ async fn run_fuse(mountpoint: String, data_dir: &str, password: &str, cipher: Ci let uid = unsafe { libc::getuid() }; let gid = unsafe { libc::getgid() }; - let mut mount_options = MountOptions::default(); - mount_options + let mount_options = MountOptions::default() .uid(uid) .gid(gid) .read_only(false). allow_root(allow_root). - allow_other(allow_other); + allow_other(allow_other) + .clone(); let mount_path = OsStr::new(mountpoint.as_str()); Session::new(mount_options)