{"id":13671633,"url":"https://github.com/cloud-hypervisor/fuse-backend-rs","last_synced_at":"2025-05-15T05:05:31.357Z","repository":{"id":37097665,"uuid":"267868707","full_name":"cloud-hypervisor/fuse-backend-rs","owner":"cloud-hypervisor","description":"Rust crate for implementing FUSE backends","archived":false,"fork":false,"pushed_at":"2025-02-11T07:37:01.000Z","size":1371,"stargazers_count":142,"open_issues_count":26,"forks_count":69,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-14T08:07:46.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloud-hypervisor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-29T13:46:55.000Z","updated_at":"2025-03-24T01:50:23.000Z","dependencies_parsed_at":"2024-01-04T05:32:08.812Z","dependency_job_id":"d52a1e59-1b38-4ce5-accb-1b95cb001c6b","html_url":"https://github.com/cloud-hypervisor/fuse-backend-rs","commit_stats":{"total_commits":311,"total_committers":28,"mean_commits":"11.107142857142858","dds":0.6720257234726688,"last_synced_commit":"9ad397790633d487671b982ac6708296bf043672"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-hypervisor%2Ffuse-backend-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-hypervisor%2Ffuse-backend-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-hypervisor%2Ffuse-backend-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-hypervisor%2Ffuse-backend-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloud-hypervisor","download_url":"https://codeload.github.com/cloud-hypervisor/fuse-backend-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254276446,"owners_count":22043866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:01:15.074Z","updated_at":"2025-05-15T05:05:31.336Z","avatar_url":"https://github.com/cloud-hypervisor.png","language":"Rust","readme":"# Rust FUSE library for server, virtio-fs and vhost-user-fs\n\n![Crates.io](https://img.shields.io/crates/l/fuse-backend-rs)\n[![Crates.io](https://img.shields.io/crates/v/fuse-backend-rs)](https://crates.io/crates/fuse-backend-rs)\n\n## Design\n\nThe fuse-backend-rs crate is an rust library to implement Fuse daemons based on the\n[Linux FUSE device (/dev/fuse)](https://www.kernel.org/doc/html/latest/filesystems/fuse.html)\nor the [virtiofs](https://stefanha.github.io/virtio/virtio-fs.html#x1-41500011) draft specification.\n\nLinux FUSE is an userspace filesystem framework, and the /dev/fuse device node is the interface for\nuserspace filesystem daemons to communicate with the in-kernel fuse driver.\n\nAnd the virito-fs specification extends the FUSE framework into the virtualization world, which uses\nthe Virtio protocol to transfer FUSE requests and responses between the Fuse client and server.\nWith virtio-fs, the Fuse client runs within the guest kernel and the Fuse server runs on the host\nuserspace or hardware.\n\nSo the fuse-rs crate is a library to communicate with the Linux FUSE clients, which includes:\n- ABI layer, which defines all data structures shared between linux Fuse framework and Fuse daemons.\n- API layer, defines the interfaces for Fuse daemons to implement a userspace file system.\n- Transport layer, which supports both the Linux Fuse device and virtio-fs protocol.\n- VFS/pseudo_fs, an abstraction layer to support multiple file systems by a single virtio-fs device.\n- A sample passthrough file system implementation, which passes through files from daemons to clients. \n\n![arch](docs/images/fuse-backend-architecture.svg)\n\n## Examples\n\n### Filesystem Drivers\n- [Virtual File System](https://github.com/cloud-hypervisor/fuse-backend-rs/tree/master/src/api/vfs)\n  for an example of union file system.\n- [Pseudo File System](https://github.com/cloud-hypervisor/fuse-backend-rs/blob/master/src/api/pseudo_fs.rs)\n  for an example of pseudo file system.\n- [Passthrough File System](https://github.com/cloud-hypervisor/fuse-backend-rs/tree/master/src/passthrough)\n  for an example of passthrough(stacked) file system.\n- [Registry Accelerated File System](https://github.com/dragonflyoss/image-service/tree/master/rafs)\n  for an example of readonly file system for container images.\n\n### Fuse Servers\n- [Dragonfly Image Service fusedev Server](https://github.com/dragonflyoss/image-service/blob/master/src/bin/nydusd/fusedev.rs)\nfor an example of implementing a fuse server based on the\n[fuse-backend-rs](https://crates.io/crates/fuse-backend-rs) crate.\n- [Dragonfly Image Service vhost-user-fs Server](https://github.com/dragonflyoss/image-service/blob/master/src/bin/nydusd/virtiofs.rs)\n  for an example of implementing vhost-user-fs server based on the\n  [fuse-backend-rs](https://crates.io/crates/fuse-backend-rs) crate.\n  \n### Fuse Server and Main Service Loop\nA sample fuse server based on the Linux Fuse device (/dev/fuse):\n\n```rust\nuse fuse_backend_rs::api::{server::Server, Vfs, VfsOptions};\nuse fuse_backend_rs::transport::fusedev::{FuseSession, FuseChannel};\n\nstruct FuseServer {\n    server: Arc\u003cServer\u003cArc\u003cVfs\u003e\u003e\u003e,\n    ch: FuseChannel,\n}\n\nimpl FuseServer {\n    fn svc_loop(\u0026self) -\u003e Result\u003c()\u003e {\n      // Given error EBADF, it means kernel has shut down this session.\n      let _ebadf = std::io::Error::from_raw_os_error(libc::EBADF);\n      loop {\n        if let Some((reader, writer)) = self\n                .ch\n                .get_request()\n                .map_err(|_| std::io::Error::from_raw_os_error(libc::EINVAL))?\n        {\n          if let Err(e) = self.server.handle_message(reader, writer, None, None) {\n            match e {\n              fuse_backend_rs::Error::EncodeMessage(_ebadf) =\u003e {\n                break;\n              }\n              _ =\u003e {\n                error!(\"Handling fuse message failed\");\n                continue;\n              }\n            }\n          }\n        } else {\n          info!(\"fuse server exits\");\n          break;\n        }\n      }\n      Ok(())\n    }\n}\n```\n\n## License\nThis project is licensed under\n- [Apache License](http://www.apache.org/licenses/LICENSE-2.0), Version 2.0\n- [BSD-3-Clause License](https://opensource.org/licenses/BSD-3-Clause)\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud-hypervisor%2Ffuse-backend-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloud-hypervisor%2Ffuse-backend-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud-hypervisor%2Ffuse-backend-rs/lists"}