Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement fuse-t feature #144

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ jobs:
runs-on: macos-latest
steps:
- name: Install macfuse
run: brew install --cask macfuse
run: |
brew install --cask macfuse
wget https://github.com/macos-fuse-t/fuse-t/releases/download/1.0.24/fuse-t-macos-installer-1.0.24.pkg
sudo installer -pkg fuse-t-macos-installer-1.0.24.pkg -target /
- uses: actions/checkout@v3
- name: build and check
run: make check-macos
run: make smoke-macos

deny:
name: Cargo Deny
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async-io = ["async-trait", "tokio-uring", "tokio/fs", "tokio/net", "tokio/sync",
fusedev = ["vmm-sys-util", "caps", "core-foundation-sys"]
virtiofs = ["virtio-queue", "caps", "vmm-sys-util"]
vhost-user-fs = ["virtiofs", "vhost", "caps"]
fuse-t=[]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be a feature only available on macos?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but features not support [target.'cfg(target_os = "macos")'.features]?


[package.metadata.docs.rs]
all-features = true
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ build:

build-macos:
cargo build --features="fusedev"
cargo build --features="fusedev,fuse-t"

check-macos: build-macos
cargo fmt -- --check
cargo clippy --features="fusedev" -- -Dwarnings
cargo test --features="fusedev" -- --nocapture --skip integration
cargo clippy --features="fusedev,fuse-t" -- -Dwarnings
cargo test --features="fusedev,fuse-t" -- --nocapture --skip integration

check: build
cargo fmt -- --check
Expand All @@ -38,7 +41,7 @@ smoke-all: smoke
cargo test --features="fusedev" -- --nocapture --ignored

smoke-macos: check-macos
cargo test --features="fusedev" -- --nocapture
cargo test --features="fusedev,fuse-t" -- --nocapture

docker-smoke:
docker run --env RUST_BACKTRACE=1 --rm --privileged --volume ${current_dir}:/fuse-rs rust:1.68 sh -c "rustup component add clippy rustfmt; cd /fuse-rs; make smoke-all"
10 changes: 10 additions & 0 deletions src/api/server/sync_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,23 @@ impl<F: FileSystem + Sync> Server<F> {
e
})?;

#[cfg(not(feature = "fuse-t"))]
let version = self.vers.load();
let result = self.fs.lookup(ctx.context(), ctx.nodeid(), name);

match result {
// before ABI 7.4 inode == 0 was invalid, only ENOENT means negative dentry
#[cfg(not(feature = "fuse-t"))]
Ok(entry)
if version.minor < KERNEL_MINOR_VERSION_LOOKUP_NEGATIVE_ENTRY_ZERO
&& entry.inode == 0 =>
{
ctx.reply_error(io::Error::from_raw_os_error(libc::ENOENT))
}
#[cfg(feature = "fuse-t")]
Ok(entry) if entry.inode == 0 => {
ctx.reply_error(io::Error::from_raw_os_error(libc::ENOENT))
}
Ok(entry) => {
let out = EntryOut::from(entry);

Expand Down Expand Up @@ -649,7 +655,11 @@ impl<F: FileSystem + Sync> Server<F> {
return ctx.reply_ok(Some(out), None);
}

#[cfg(not(feature = "fuse-t"))]
let mut flags_u64 = flags as u64;
#[cfg(feature = "fuse-t")]
let flags_u64 = flags as u64;
#[cfg(not(feature = "fuse-t"))]
if flags_u64 & FsOptions::INIT_EXT.bits() != 0 {
let InitIn2 { flags2, unused: _ } = ctx.r.read_obj().map_err(Error::DecodeMessage)?;
flags_u64 |= (flags2 as u64) << 32;
Expand Down
Loading
Loading