https://github.com/jmillikin/rust-fuse
A FUSE server implementation for Rust.
https://github.com/jmillikin/rust-fuse
fuse rust
Last synced: 2 months ago
JSON representation
A FUSE server implementation for Rust.
- Host: GitHub
- URL: https://github.com/jmillikin/rust-fuse
- Owner: jmillikin
- License: apache-2.0
- Created: 2018-10-06T16:56:36.000Z (over 7 years ago)
- Default Branch: trunk
- Last Pushed: 2025-03-20T06:45:56.000Z (over 1 year ago)
- Last Synced: 2026-05-04T02:43:21.327Z (2 months ago)
- Topics: fuse, rust
- Language: Rust
- Homepage:
- Size: 3.43 MB
- Stars: 44
- Watchers: 6
- Forks: 8
- Open Issues: 6
-
Metadata Files:
- Readme: README.asciidoc
- License: LICENSE
Awesome Lists containing this project
README
= rust-fuse
:url-fuse: https://en.wikipedia.org/wiki/Filesystem_in_Userspace
:url-docs: https://jmillikin.github.io/rust-fuse/
image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[link="http://www.apache.org/licenses/LICENSE-2.0"]
image:https://img.shields.io/badge/docs-github.io-green.svg[link={url-docs}]
The `fuse` crate is an implementation of the {url-fuse}[FUSE] protocol, which
allows filesystems and character devices to be backed by a userspace process.
It currently provides enough coverage to implement basic FUSE and CUSE servers.
== Stability
This is a pre-v0.1 library. Many of FUSE's more advanced capabilities do not
work yet, and test coverage is incomplete. Please file issues if there is
functionality you'd like to see implemented.
[%header, cols="2,5"]
|===
|Feature
|Tracking issue
|FreeBSD support
|image:https://img.shields.io/github/issues/detail/state/jmillikin/rust-fuse/5[link="https://github.com/jmillikin/rust-fuse/issues/5"]
|High-level API
|image:https://img.shields.io/github/issues/detail/state/jmillikin/rust-fuse/10[link="https://github.com/jmillikin/rust-fuse/issues/10"]
|Interrupts
|image:https://img.shields.io/github/issues/detail/state/jmillikin/rust-fuse/5[link="https://github.com/jmillikin/rust-fuse/issues/5"]
|macOS support
|Not planned due to lack of open-source kernel drivers.
|Unprivileged mounts
|image:https://img.shields.io/github/issues/detail/state/jmillikin/rust-fuse/6[link="https://github.com/jmillikin/rust-fuse/issues/6"]
|===
## Contributing
I am happy to accept contributions in the form of bug reports, pull requests,
or emailed patches.
== Usage
Add a dependency in `Cargo.toml`:
[source,toml]
----
[dependencies]
fuse = { git = "https://github.com/jmillikin/rust-fuse" }
----
Implement the `FuseHandlers` trait for your filesystem:
[source,rust]
----
extern crate fuse;
use fuse::server;
use fuse::server::fuse_rpc;
struct HelloFS {}
impl fuse_rpc::Handlers for HelloFS {
// your filesystem handlers here
}
----
Use `fuse-libc` (requires `libc`) or `fuse-linux` (requires a supported
target architecture) to build and run your filesystem server:
[source,rust]
----
fn mount(target: &OsStr) -> fuse_libc::FuseServerSocket {
let mount_options = fuse::os::linux::MountOptions::new();
fuse_libc::os::linux::mount(&target_cstr, mount_options).unwrap()
}
fn main() {
let handlers = HelloWorldFS {};
let mount_target = std::env::args_os().nth(1).unwrap();
let dev_fuse = mount(&mount_target);
let conn = server::FuseServer::new().connect(dev_fuse).unwrap();
fuse_rpc::serve(&conn, &handlers);
}
----
Please see {url-docs}[the documentation] for advanced options.
=== Feature `std`
It is possible to run a minimal single-threaded FUSE server in a `no_std`
binary.
[source,toml]
----
[dependencies.fuse]
default-features = false
----
Note that some functionality is not available in `no_std` mode. Please see
{url-docs}[the documentation] for details on which parts of the API depend
on `std`.