Rust-based FUSE filesystem aimed to improved memory-safety and, ideally, adhere to SIM Commutativity principles.
Carlos Anguiano, Lucas Du, Simon Zheng
This filesystem is implemented as a FUSE userspace daemon. When a user application makes a filesystem call, the request travels through the Linux Virtual Filesystem (VFS) layer to the FUSE kernel module, which forwards it to our userspace daemon. The daemon processes the request, reads or writes data to a backing file as needed, and sends a response back through the kernel module to the calling application.
The first filesystem is an extremely minimal implementation in the style of vsfs (from OSTEP). The following design choices are made:
- Simulate contiguous block storage by allocating a single large file (using the OS filesystem) to act as the backing store for the entire FUSE filesystem.
- Everything is stored on disk in that single large file, with the following structure: [superblock|inode-bitmap|data-bitmap|inode-table|data-region].
- The inode table is stored as a flat array, with indices denoting inode number.
- Use a list of extents to track data blocks for specific inodes.
- Use fixed size bitmaps to store free/allocated metadata for both inodes and data blocks.
- Extremely minimal access control: only mode bits and UID/GID.
- No support for xattrs.
create— create a new fileread— read file data using extent-based addressingwrite— write file data with automatic block allocationlookup— look up a file by name in a directoryreaddir— list directory contentsgetattr— get file attributessymlink/readlink— create and read symbolic linkslink/unlink— create and remove hard links
git clone
cd rust-fuse
cargo build# Create a mount point
mkdir /tmp/mnt
cargo run -- /tmp/mnt /tmp/blockfile -vvv
# Create a file
echo "hello world" > /tmp/mnt/hello.txt
# Read a file
cat /tmp/mnt/hello.txt
# List directory contents
ls /tmp/mnt
# Create a symbolic link
ln -s /tmp/mnt/hello.txt /tmp/mnt/hello_link.txt
# Create a hard link
ln /tmp/mnt/hello.txt /tmp/mnt/hello_hard.txt
# Remove a file
rm /tmp/mnt/hello.txtfusermount -u /tmp/mnt