Skip to content

Commit

Permalink
fix compile warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
radumarias committed Apr 19, 2024
1 parent 8f87958 commit 61890fc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/encrypted_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use rand::{OsRng, Rng};
use serde::{Deserialize, Serialize};
use strum_macros::{Display, EnumIter, EnumString};
use thiserror::Error;
use tracing::{debug, error};
use tracing::error;

#[cfg(test)]
mod encrypted_fs_tests;
Expand Down Expand Up @@ -137,6 +137,7 @@ struct TimeAndSizeFileAttr {
}

impl TimeAndSizeFileAttr {
#[allow(dead_code)]
fn new(ino: u64, atime: SystemTime, mtime: SystemTime, ctime: SystemTime, crtime: SystemTime, size: u64) -> Self {
Self {
ino,
Expand Down Expand Up @@ -696,7 +697,7 @@ impl EncryptedFs {
// when we release the handle we will move this tmp file to the actual file

// remove handle data because we will replace it with the tmp one
let (attr, path, mut position, encryptor) =
let (attr, path, _, encryptor) =
self.write_handles.remove(&handle).unwrap();

// finish the current writer so we flush all data to the file
Expand All @@ -719,7 +720,7 @@ impl EncryptedFs {

let mut buffer: [u8; 4096] = [0; 4096];
let mut pos_read = 0;
position = 0;
let mut position = 0;
if offset > 0 {
loop {
let offset_in_bounds = min(offset, attr.size); // keep offset in bounds of file
Expand Down
4 changes: 2 additions & 2 deletions src/encrypted_fs_fuse3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ pub struct EncryptedFsFuse3 {

impl EncryptedFsFuse3 {
pub fn new(data_dir: &str, password: &str, cipher: Cipher, derive_key_hash_rounds: u32,
direct_io: bool, suid_support: bool) -> FsResult<Self> {
direct_io: bool, _suid_support: bool) -> FsResult<Self> {
#[cfg(feature = "abi-7-26")] {
Ok(Self {
fs: const_reentrant_mutex(RefCell::new(EncryptedFs::new(data_dir, password, cipher, derive_key_hash_rounds).unwrap())),
direct_io,
suid_support,
suid_support: _suid_support,
})
}
#[cfg(not(feature = "abi-7-26"))] {
Expand Down
15 changes: 9 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ use std::backtrace::Backtrace;
use std::ffi::OsStr;
use std::io::Write;
use std::str::FromStr;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};

use clap::{Arg, ArgAction, ArgMatches, Command, crate_version};
use clap::{Arg, ArgAction, Command, crate_version};
use ctrlc::set_handler;
use fuse3::MountOptions;
use fuse3::raw::prelude::*;
use rpassword::read_password;
use strum::IntoEnumIterator;
use tokio::task;
use tracing::{error, info, Level, warn};
use tracing::{error, info, Level};

use encrypted_fs::encrypted_fs::{EncryptedFs, Cipher};
use encrypted_fs::encrypted_fs::{Cipher, EncryptedFs};
use encrypted_fs::encrypted_fs_fuse3::EncryptedFsFuse3;

#[tokio::main]
Expand Down Expand Up @@ -220,7 +218,12 @@ async fn run_fuse(mountpoint: String, data_dir: &str, password: &str, cipher: Ci
let gid = unsafe { libc::getgid() };

let mut mount_options = MountOptions::default();
mount_options.uid(uid).gid(gid).read_only(false);
mount_options
.uid(uid)
.gid(gid)
.read_only(false).
allow_root(allow_root).
allow_other(allow_other);
let mount_path = OsStr::new(mountpoint.as_str());

Session::new(mount_options)
Expand Down

0 comments on commit 61890fc

Please sign in to comment.