NAME hello SYNOPSIS hello _mount_directory_ DESCRIPTION Implements a File System in UsEr space that contains one file, called hello, with fixed contents, Hello World. OPTIONS To be or not to be, those are the options. HISTORY A FUSE test program. BUGS
Unix has mountable file systems. This means that the overall file tree can be comprised of different file systems. The passage from one file system to another is at an object that looks to the user like a directory, but it is a mount point. A mount point node is marked with the root of the filesystem which should begin at that directory.
FUSE allows user programs to be the destination of a mount point. By registering on a directory, FUSE intercepts all file requests on a path passing through that directory and packages up the request as a call into the user program. The user program provides a response by call-by-reference parameters, and the return value.
The hello world file system is an example. It mounts on a particular mount location, and answers all queries from the program. There is no disk or other memory system involved, other than the memory of the program implementing the hello world file system. When asked, it responds with a completely fixed directory contents; and when the hello file is read, it responds with the contents of a string defined in the program.
This still seems like a file system, just a file system that has exactly one file with an unchangeable contents. FUSE can be used to build other file systems, including those that have more customary semantics. Or to build file systems with very different semantics than is customary.
FUSE requires a continuously running program to service the filesystem calls that get routed to the Fuse File System. This is a sort of server, for the service of the filesystem, that the operating system contacts when there is work to do in the FUSE file system.
The calls into the FUSE server are done by a main program providing the kernel with a menu of functions. When there is work to do, the kernel calls the function associated with the sort of work required. There is a call back for read a file, or write a file, as well as to list a directory, remove a file from a directory. Every operation that can be done on a filesystem is represented by a function in the callback table.
To get started with FUSE, explore class/examples/fuse-hw. The Makefile has an install target that you run to install the FUSE development package. The test target will compile and run the hello-world file system. This is a file system that contains only single file in the root directory with a fixed content.
The documentation on FUSE is scarce. Here are some resources:
author: burton rosenberg
created: 19 oct 2020
update: 19 oct 2020