README that explain how to build and run your userspace filesystem example.
For our third lab, you will implement a filesystem for Linux using the Filesystem in Userspace (FUSE) interface. Normally, the filesystems Linux support rely on code that runs as part of the operating system kernel. With FUSE, we can create new filesystem implementations and attach them to the Linux file tree without touching kernel code.
Most filesystem implementations are meant to manage persistent storage on a disk, but your filesystem will do something different. Instead of directly managing storage, your filesystem will service as an interface to data stored somewhere else. The exact source of data is up to you (with some requirements outlined below) but the example below describes one reasonable choice of data source that you could choose to implement a filesystem for.
For this example, we will consider a FUSE filesystem that provides filesystem level access to the contents of a .zip archive file.
Consider a scenario where you have a .zip file containing some files and directories, and you would like to access those files and directories without having to unzip the entire archive, similar to how Windows allows you to browse the contents of .zip files without extracting them.
A userspace filesystem implemented in a program called zip-browser could provide this on Linux via the following command:
$ zip-browser --archive=~/somefile.zip ~/mountpoint
The command above is meant to make the contents of the archive file somefile.zip accessible in the mountpoint directory.
The zip-browser program continues running in the background as long as the filesystem is mounted.
In UNIX terminology, we “mount” a filesystem by attaching it to the global filesystem tree.
All mounted filesystems appear somewhere in the tree rooted at the path /.
Using the terminal to examine the contents of ~/mountpoint after running the zip-browser program should make commands like this possible:
$ ls ~/mountpoint/
a.txt b.txt c.txt somedir
Because the .zip file contents are now visible on the filesystem, you can move into the internal directories and access files within them:
$ cd ~/mountpoint
$ cd somedir
$ ls
d.txt e.txt
$ cat d.txt
This is a test file.
If zip-browser has support for modifying files, we could even edit the contents of zip files without fully extracting them:
$ echo "Here is a new file" > ~/mountpoint/f.txt
$ ls ~/mountpoint
a.txt b.txt c.txt f.txt somedir
If file access works in the terminal, it should also work in the Linux file browser, or in most other programs you could use to view or edit files; a few programs may not work well with files stored on a non-standard filesystem, but those should be rare.
When you are finished accessing the userspace filesystem, simply unmount it with the following command:
$ fusermount -u ~/mountpoint
The zip-browser program should exit cleanly at this point.
Now that the userspace filesystem is no longer available, the ~/mountpoint directory should be empty.
Your task is to implement a userspace filesystem that allows you to access some store of data.
This could be .zip files, other archive formats, disk images, or any other data source you choose as long as it can meet the requirements below.
Notice that there are two optional elements;
you must implement at least one of these, although you can choose to implement both if you like.
.zip file example, that would require modifying the underlying .zip file to reflect the written data.
What it means to write to a file will depend on the data source you are presenting as a filesystem, but there should be some reasonable understanding of what writing is if you choose this option.
Ideally, writing should allow for modifying existing files and creating new files within the filesystem, but this is not required if it doesn’t make sense for the data source you choose.README file.
Make sure to include any necessary data files, and give clear instructions on the commands I will need to run to run through your example.
Your example writeup must demonstrate all of the functionality you have implemented to meet the requirements above.This is an incomplete list of various data sources you could present as a filesystem.
.zip file example above, present the file and directory contents of an archive format.find tool to find paths through the game map.You are welcome to find and use code from other sources to access the data source you choose, but the filesystem operations themselves must be your own work. If you do use code or libraries from other sources, be sure to include appropriate citations.
The FUSE library has auto-generated API documentation, but you will likely find the examples more useful for getting started.
You can find the example FUSE filesystems for the version installed on MathLAN at https://github.com/libfuse/libfuse/tree/fuse-3.14.0.
I recommend that you start by testing the hello.c example to get started.
If you find any other useful references for the libfuse library, please share them with me so I can pass them on to the rest of the class.