Crate fuse_backend_rs

source ·
Expand description

A rust library for Fuse(filesystem in userspace) servers and virtio-fs devices.

Filesystem in Userspace FUSE is a software interface for Unix and Unix-like computer operating systems that lets non-privileged users create their own file systems without editing kernel code. This is achieved by running file system code in user space while the FUSE module provides only a “bridge” to the actual kernel interfaces.

On Linux, the FUSE device driver is a general purpose filesystem abstraction layer, which loads as a kernel module and presents a virtual device (/dev/fuse) to communicate with a user (non-kernel) program via a well defined API. The user code need not run with root priviledge if it does not need to access protected data or devices, and can implement a virtual filesystem much more simply than a traditional device driver.

In addition to traditional Fuse filesystems, the virtiofs file system for Linux implements a driver for the paravirtualized VIRTIO “virtio-fs” device for guest<->host file system sharing. It allows a guest to mount a directory that has been exported on the host.

Virtio-fs uses FUSE as the foundation. Unlike traditional FUSE where the file system daemon runs in userspace, the virtio-fs daemon runs on the host. A VIRTIO device carries FUSE messages and provides extensions for advanced features not available in traditional FUSE. Since the virtio-fs device uses the FUSE protocol for file system requests, the virtiofs file system for Linux is integrated closely with the FUSE file system client. The guest acts as the FUSE client while the host acts as the FUSE server. The /dev/fuse interface between the kernel and userspace is replaced with the virtio-fs device interface.

The fuse-backend-rs crate includes several subsystems:

  • Fuse API. The Fuse API is the connection between transport layers and file system drivers. It receives Fuse requests from transport layers, parses the request according to Fuse ABI, invokes filesystem drivers to server the requests, and eventually send back the result to the transport layer.
  • Fuse ABI. Currently only Linux Fuse ABIs since v7.27 are supported.
  • Transport Layer. The transport layer receives Fuse requests from the clients and sends back replies. Currently there are two transport layers are supported: Linux Fuse device(/dev/fuse) and virtiofs.
  • Filesystem Drivers. Filesystem drivers implement the concrete Fuse filesystem logic, at what ever is suitable. A default “passthrough” filesystem driver is implemented as a sample.

Re-exports§

Modules§

  • Fuse Application Binary Interfaces(ABI).
  • Fuse Application Programming Interfaces(API).
  • Some utilities to support fuse-backend-rs.
  • Fuse passthrough file system, mirroring an existing FS hierarchy.
  • FUSE/Virtiofs transport drivers to receive requests from/send reply to Fuse/Virtiofs clients.

Enums§

  • Error codes for Fuse related operations.

Functions§

Type Aliases§

  • Result for Fuse related operations.