Skip to content

jmillikin/rust-fuse

Repository files navigation

rust-fuse

License Apache%202.0 blue docs github.io green

The fuse crate is an implementation of the 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.

Feature Tracking issue

FreeBSD support

5

High-level API

10

Interrupts

5

macOS support

Not planned due to lack of open-source kernel drivers.

Unprivileged mounts

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:

[dependencies]
fuse = { git = "https://github.com/jmillikin/rust-fuse" }

Implement the FuseHandlers trait for your filesystem:

extern crate fuse;
use fuse::server;
use fuse::server::fuse_rpc;

struct HelloFS {}
impl<S: server::io::FuseSocket> fuse_rpc::Handlers<S> 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:

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 the documentation for advanced options.

Feature std

It is possible to run a minimal single-threaded FUSE server in a no_std binary.

[dependencies.fuse]
default-features = false

Note that some functionality is not available in no_std mode. Please see the documentation for details on which parts of the API depend on std.

About

A FUSE server implementation for Rust.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published