Mount point management

A filesystem needs to have a mount point—somewhere that we consider to be the root of the filesystem. For a traditional disk-based filesystem, this often ends up being in several places, with the root directory (i.e. /) being one of the mount points. On your QNX Neutrino system, other filesystems are mounted by default in /fs. The .tar filesystem, just to give another example, may be mounted in the same directory as the .tar file it's managing.

The exact location of the mount point isn't important for our discussion here. What is important is that there exists some mount point, and that the top level directory (the mount point itself) is called the root of the filesystem. In our earlier example, we had a CD-ROM filesystem mounted at /fs/cd0, so we said that the directory /fs/cd0 is both the “mount point” for the CD-ROM filesystem, and is also the “root” of the CD-ROM filesystem.

One of the first things that the filesystem must do, therefore, is to register itself at a given mount point. There are actually three registrations that need to be considered:

All three registrations are performed with the resource manager function resmgr_attach(), with variations given in the arguments. For reference, here's the prototype of the resmgr_attach() function (from <sys/dispatch.h>):

int resmgr_attach (
    dispatch_t *dpp,
    resmgr_attr_t *attr,
    const char *path,
    enum _file_type file_type,
    unsigned flags,
    const resmgr_connect_funcs_t *connect_funcs,
    const resmgr_io_funcs_t *io_funcs,
    RESMGR_HANDLE_T *handle);

Of interest for this discussion are path, file_type, and flags.