ebroder edited this page Sep 13, 2010 · 6 revisions
Clone this wiki locally

URLs were inspired by filesystems. RouteFS is here to return the favor. By describing read-only FUSE filesystems in terms of the directory tree instead of the syscall interface provided by FUSE, developers can write custom filesystems much more efficiently.

RouteFS uses the Routes library developed for the Pylons web development framework.

The canonical location for the RouteFS source code is here at Github. The source tree contains several examples of RouteFS, all corresponding to real use cases of RouteFS. Bugs against RouteFS can be reported here at Github

Here is an example filesystem written in RouteFS. This is a /home automounter that will automatically create symlinks from /home/user to user’s homedir whenever the /home path is accessed.

RouteFS Example: HomeFS

If you work on a system where home directories are on network storage
(i.e. not in /home), mount HomeFS on /home. It's an automounter that
will automatically create symlinks from user -> their homedir whenever
/home/user is accessed in any way.

import pwd
import routefs
from routes import Mapper

class HomeFS(routefs.RouteFS):
    def __init__(self, *args, **kwargs):
        super(HomeFS, self).__init__(*args, **kwargs)
        self.cache = {}

    def make_map(self):
        m = Mapper()
        m.connect('', controller='getList')
        m.connect('{action}', controller='getUser')
        return m

    def getUser(self, action, **kwargs):
            if action not in self.cache:
                self.cache[action] = pwd.getpwnam(action).pw_dir
            return routefs.Symlink(self.cache[action])
        except KeyError:

    def getList(self, **kwargs):
        return self.cache.keys()

if __name__ == '__main__':

RouteFS is dual-licensed under Version 1.1 of the MPL and Version 2 (or later) of the GPL.