The UserlandFS is a file system wrapper for the kernel (similar to FUSE on Linux) which loads file system add-ons in userspace. In this way, it is a great tool for developing file system add-ons without unwanted trips to the Kernel Debugging Land. On top of that, several interesting test add-ons already exist for it in the Haiku source tree, including a network file system with full support for extended file attributes (meta data). The API which a file system add-on for UserlandFS has to implement is almost identical to the "real" kernel file system API, so that it is easy to migrate the add-on to the kernel once it is ready.
Building UserlandFS and it's "test" file system add-ons
The easiest way is to ask the Haiku build system to collect all the components for you. Adding the following section to your build/jam/UserBuildConfig will do that:
# UserlandFS installation local userlandFSDir = [ FDirName $(HAIKU_OUTPUT_DIR) userlandfs ] ; HaikuInstall install-userlandfs : $(userlandFSDir) : # userlandfs <test>userlandfs <test>UserlandFSServer <test>ufs_mount # netfs <test>AuthenticationServer <test>netfs <test>netfs_config <test>NetFSServerPrefs <test>NetFSServer # ramfs <test>ramfs # reiserfs <test>reiserfs : installed!userlandfs!tests ;
Then you can build with...
TARGET_PLATFORM=r5 jam -q install-userlandfs
...and everything (the userland FS itself and the netfs, ramfs, and reiserfs components) ends up in "generated/userlandfs/".
Installing the UserlandFS components
Some of the files are expected to live in special directories. You can simply symlink them there, but copying/moving works just the same. Here is a list of what goes where:
userlandfs -> ~/config/add-ons/kernel/file_systems/ netfs, ramfs, reiserfs -> ~/config/add-ons/userlandfs/
The other files are executables that don't care where they are located.
Some file systems' tools require special ioctls to be passed to the file system, which the userland FS add-on cannot know without explicitely being told. This is done via the settings file ~/config/settings/kernel/drivers/userlandfs. There's a sample in the repository with entries for (Haiku's) BFS and netfs src/tests/add-ons/kernel/file_systems/userlandfs/r5/userlandfs.sample.
userlandfs_server does not need to be run by the user anymore, the kernel will run it automatically when mounting UserlandFS file systems. To mount, one uses the regular mount command like this:
mount -t userlandfs -p "<client FS> <client FS params>" <device> <mount point>
where <client FS> is the add-on name of the file system (e.g. "reiserfs" or "netfs"), <device> the path of the device/image file to be mounted (usually some "/dev/disk/...", or "" if no device is needed (ramfs, netfs)), <mount point> the directory where to mount the file system, and <client FS params> is a file system specific parameter string, usually omitted.