Skip to content

Commit

Permalink
Oxidation fuse
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeEngineer committed Sep 5, 2023
1 parent c38a0fd commit 54fa7e0
Show file tree
Hide file tree
Showing 14 changed files with 884 additions and 8 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/master' }}
timeout-minutes: 5

# Install fio
- name: Install fio
shell: bash
run: apt install fio

# Install cargo nextest command
- uses: taiki-e/install-action@6801bd56b9711500292d943350f0b1f3559d7acb # pin v2.17.8
with:
Expand Down Expand Up @@ -171,6 +176,12 @@ jobs:
unzip D:/a/_temp/winfsp-tests.zip -d D:/a/_temp/
mv 'D:/a/_temp/winfsp-tests-x64.exe' 'C:/Program Files (x86)/WinFsp/bin/'
# Install fio
- name: Install fio
if: startsWith(matrix.os, 'macos')
shell: bash
run: apt install fio

# Install cargo nextest command
- uses: taiki-e/install-action@6801bd56b9711500292d943350f0b1f3559d7acb # pin v2.17.8
with:
Expand Down
50 changes: 50 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ event-listener = { version = "2.5.3", default-features = false }
flate2 = { version = "1.0.27", default-features = false }
flume = { version = "0.10.14", default-features = false }
fnmatch-regex = { version = "0.2.0", default-features = false }
fuser = { version = "0.13.0", default-features = false }
futures-core = { version = "0.3.28", default-features = false }
futures-lite = { version = "1.13.0", default-features = false }
futures = { version = "0.3.28", default-features = false }
Expand All @@ -120,6 +121,7 @@ itertools = { version = "0.11.0", default-features = false }
jni = { version = "0.21.1", default-features = false }
js-sys = { version = "0.3.64", default-features = false }
lazy_static = { version = "1.4.0", default-features = false }
libc = { version = "0.2.147", default-features = false }
libsodium-sys = { version = "0.2.7", default-features = false }
libsqlite3-sys = { version = "0.26.0", default-features = false }
log = { version = "0.4.20", default-features = false }
Expand Down
15 changes: 12 additions & 3 deletions libparsec/crates/platform_mountpoint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,25 @@ repository.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[target.'cfg(target_os = "windows")'.dependencies]
[target.'cfg(target_family = "windows")'.dependencies]
winfsp_wrs = { workspace = true }
once_cell = { workspace = true }
regex = { workspace = true }

[target.'cfg(target_family = "unix")'.dependencies]
fuser = { workspace = true }
libc = { workspace = true }

[dependencies]
libparsec_types = { workspace = true }
anyhow = { workspace = true }
chrono = { workspace = true }
env_logger = { workspace = true }
once_cell = { workspace = true }
thiserror = { workspace = true }

[target.'cfg(target_os = "windows")'.build-dependencies]
[dev-dependencies]
libparsec_tests_fixtures = { workspace = true }
libparsec_tests_macros = { workspace = true }

[target.'cfg(target_family = "windows")'.build-dependencies]
winfsp_build = { workspace = true }
2 changes: 2 additions & 0 deletions libparsec/crates/platform_mountpoint/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ pub(crate) enum MountpointError {
EndOfFile,
#[error("Name collision")]
NameCollision,
#[error("Name too long")]
NameTooLong,
#[error("Not found")]
NotFound,
}
Expand Down
8 changes: 6 additions & 2 deletions libparsec/crates/platform_mountpoint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

mod error;
mod memfs;
#[cfg(target_os = "windows")]
#[cfg(target_family = "unix")]
mod unix;
#[cfg(target_family = "windows")]
mod windows;

use chrono::{DateTime, Utc};
use std::{collections::HashMap, path::Path};
#[cfg(target_os = "windows")]
#[cfg(target_family = "unix")]
pub use unix::mount;
#[cfg(target_family = "windows")]
pub use windows::mount;

use libparsec_types::{EntryID, EntryName, FileDescriptor};
Expand Down
7 changes: 4 additions & 3 deletions libparsec/crates/platform_mountpoint/src/memfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ impl Default for MountpointManager {
PathBuf::from("/"),
(
EntryInfo {
id: EntryID::default(),
// Because fuse root ino is 1
id: EntryID::from(1u128.to_le_bytes()),
ty: EntryInfoType::Dir,
created: now,
updated: now,
Expand Down Expand Up @@ -199,7 +200,7 @@ impl MountpointInterface for MountpointManager {
.to_str()
.expect("Non utf8 name");
parent.children.insert(
EntryName::try_from(file_name).expect("Should be a valid EntryName"),
EntryName::try_from(file_name).map_err(|_| MountpointError::NameTooLong)?,
id,
);

Expand Down Expand Up @@ -387,7 +388,7 @@ impl MountpointInterface for MountpointManager {
.to_str()
.expect("Non utf8 name"),
)
.expect("Should be a valid EntryName"),
.map_err(|_| MountpointError::NameTooLong)?,
id,
);

Expand Down
Loading

0 comments on commit 54fa7e0

Please sign in to comment.