diff --git a/Cargo.lock b/Cargo.lock index 3242989..8bf5a97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -868,6 +868,7 @@ version = "0.1.0" dependencies = [ "anyhow", "env_logger", + "fuser", "log", "quinn", "serde", diff --git a/olivefs/Cargo.toml b/olivefs/Cargo.toml index 6131380..e88bd76 100644 --- a/olivefs/Cargo.toml +++ b/olivefs/Cargo.toml @@ -27,7 +27,7 @@ clap = { version = "3.0.7", features = ["derive"] } quinn = { version = "0.8.0", features = [] } # Compression and Encryption -zstd = "0.9.2+zstd.1.5.1" +zstd = "0.9.2" sodiumoxide = "0.2.7" rustls = "0.20.2" diff --git a/olivefs_common/Cargo.toml b/olivefs_common/Cargo.toml index 6420eac..958b81c 100644 --- a/olivefs_common/Cargo.toml +++ b/olivefs_common/Cargo.toml @@ -23,4 +23,6 @@ toml = "0.5.8" quinn = { version = "0.8.0", features = [] } # Compression and Encryption -zstd = "0.9.2+zstd.1.5.1" +zstd = "0.9.2" + +fuser = { version = "0.10.0", optional = true } diff --git a/olivefs_common/src/messages.rs b/olivefs_common/src/messages.rs index a41af7c..f93fd3e 100644 --- a/olivefs_common/src/messages.rs +++ b/olivefs_common/src/messages.rs @@ -67,6 +67,9 @@ pub enum FileKind { Socket, } +#[cfg(feature = "fuser")] +mod messages_fuser; + /// Copy of fuser's FileAttr. Used to describe a file. #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct FileMetadata { diff --git a/olivefs_common/src/messages/messages_fuser.rs b/olivefs_common/src/messages/messages_fuser.rs new file mode 100644 index 0000000..6a0a73e --- /dev/null +++ b/olivefs_common/src/messages/messages_fuser.rs @@ -0,0 +1,31 @@ +use crate::messages::FileKind; +use fuser::FileType; +use std::fs::FileType; + +impl From for FileKind { + fn from(filetype: FileType) -> Self { + match filetype { + FileType::NamedPipe => FileKind::NamedPipe, + FileType::CharDevice => FileKind::CharDevice, + FileType::BlockDevice => FileKind::BlockDevice, + FileType::Directory => FileKind::Directory, + FileType::RegularFile => FileKind::RegularFile, + FileType::Symlink => FileKind::Symlink, + FileType::Socket => FileKind::Socket, + } + } +} + +impl Into for FileKind { + fn into(self) -> FileType { + match self { + FileKind::NamedPipe => FileType::NamedPipe, + FileKind::CharDevice => FileType::CharDevice, + FileKind::BlockDevice => FileType::BlockDevice, + FileKind::Directory => FileType::Directory, + FileKind::RegularFile => FileType::RegularFile, + FileKind::Symlink => FileType::Symlink, + FileKind::Socket => FileType::Socket, + } + } +} diff --git a/olivefsd/Cargo.toml b/olivefsd/Cargo.toml index 8eb0907..0627579 100644 --- a/olivefsd/Cargo.toml +++ b/olivefsd/Cargo.toml @@ -29,7 +29,7 @@ clap = { version = "3.0.7", features = ["derive"] } quinn = { version = "0.8.0", features = [] } # Compression and Encryption -zstd = "0.9.2+zstd.1.5.1" +zstd = "0.9.2" rustls = "0.20.2" rcgen = { version = "0.8.14", features = ["x509-parser"] }