Skip to content

Commit 1e5b2ac

Browse files
killagubergwolf
authored andcommitted
feat: implement fuse-t feature
Use fuse-t to replace MacFUSE as the implementation of FUSE. fuse-t is based on NFS and does not require the use of kernel extensions. Installation can be done with lower privileges and it does not impact system stability. Signed-off-by: killagu <[email protected]>
1 parent 8c89657 commit 1e5b2ac

File tree

11 files changed

+689
-16
lines changed

11 files changed

+689
-16
lines changed

.github/workflows/rust.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ jobs:
3434
runs-on: macos-latest
3535
steps:
3636
- name: Install macfuse
37-
run: brew install --cask macfuse
37+
run: |
38+
brew install --cask macfuse
39+
wget https://github.com/macos-fuse-t/fuse-t/releases/download/1.0.24/fuse-t-macos-installer-1.0.24.pkg
40+
sudo installer -pkg fuse-t-macos-installer-1.0.24.pkg -target /
3841
- uses: actions/checkout@v3
3942
- name: build and check
40-
run: make check-macos
43+
run: make smoke-macos
4144

4245
deny:
4346
name: Cargo Deny

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ async-io = ["async-trait", "tokio-uring", "tokio/fs", "tokio/net", "tokio/sync",
5151
fusedev = ["vmm-sys-util", "caps", "core-foundation-sys"]
5252
virtiofs = ["virtio-queue", "caps", "vmm-sys-util"]
5353
vhost-user-fs = ["virtiofs", "vhost", "caps"]
54+
fuse-t=[]
5455

5556
[package.metadata.docs.rs]
5657
all-features = true

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ build:
1010

1111
build-macos:
1212
cargo build --features="fusedev"
13+
cargo build --features="fusedev,fuse-t"
1314

1415
check-macos: build-macos
1516
cargo fmt -- --check
1617
cargo clippy --features="fusedev" -- -Dwarnings
1718
cargo test --features="fusedev" -- --nocapture --skip integration
19+
cargo clippy --features="fusedev,fuse-t" -- -Dwarnings
20+
cargo test --features="fusedev,fuse-t" -- --nocapture --skip integration
1821

1922
check: build
2023
cargo fmt -- --check
@@ -38,7 +41,7 @@ smoke-all: smoke
3841
cargo test --features="fusedev" -- --nocapture --ignored
3942

4043
smoke-macos: check-macos
41-
cargo test --features="fusedev" -- --nocapture
44+
cargo test --features="fusedev,fuse-t" -- --nocapture
4245

4346
docker-smoke:
4447
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"

src/api/server/sync_io.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,23 @@ impl<F: FileSystem + Sync> Server<F> {
135135
e
136136
})?;
137137

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

141142
match result {
142143
// before ABI 7.4 inode == 0 was invalid, only ENOENT means negative dentry
144+
#[cfg(not(feature = "fuse-t"))]
143145
Ok(entry)
144146
if version.minor < KERNEL_MINOR_VERSION_LOOKUP_NEGATIVE_ENTRY_ZERO
145147
&& entry.inode == 0 =>
146148
{
147149
ctx.reply_error(io::Error::from_raw_os_error(libc::ENOENT))
148150
}
151+
#[cfg(feature = "fuse-t")]
152+
Ok(entry) if entry.inode == 0 => {
153+
ctx.reply_error(io::Error::from_raw_os_error(libc::ENOENT))
154+
}
149155
Ok(entry) => {
150156
let out = EntryOut::from(entry);
151157

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

658+
#[cfg(not(feature = "fuse-t"))]
652659
let mut flags_u64 = flags as u64;
660+
#[cfg(feature = "fuse-t")]
661+
let flags_u64 = flags as u64;
662+
#[cfg(not(feature = "fuse-t"))]
653663
if flags_u64 & FsOptions::INIT_EXT.bits() != 0 {
654664
let InitIn2 { flags2, unused: _ } = ctx.r.read_obj().map_err(Error::DecodeMessage)?;
655665
flags_u64 |= (flags2 as u64) << 32;

0 commit comments

Comments
 (0)