Running UserlandFS

Article contributed by czeidler on Tue, 2007-11-06 16:26

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
	  # netfs
	  # ramfs
	  # 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/sett