The types of resource managers
There are two types of resource managers:
- device resource managers
- filesystem resource managers
The type you use depends on what you want the resource manager to do, as well as on the amount of work you want to do yourself in order to present a proper POSIX filesystem to the client.
Device resource managers
Device resource managers create only single-file entries in the filesystem, each of which is registered with the process manager. Each name usually represents a single device. These resource managers typically rely on the resource-manager library to do most of the work in presenting a POSIX device to the user.
For example, a serial port driver registers pathnames such as /dev/ser1 and /dev/ser2. When the user does ls -l /dev, the library does the necessary handling to respond to the resulting _IO_STAT messages with the proper information. The person who writes the serial port driver is able to concentrate instead on the details of managing the serial port hardware.
Filesystem resource managers
Filesystem resource managers register a mountpoint with the process manager. A mountpoint is the part of the path that's managed by the process manager, while the remaining part of the path is managed by the filesystem resource manager. For example, when a filesystem resource manager attaches a mountpoint at /mount and the path /mount/home/thomasf is examined:
- /mount/
- Identifies the part of the path that's managed by the process manager.
- home/thomasf
- Identifies the remaining part of the path that's managed by the resource manager.
Examples of using filesystem resource managers are:
- flash filesystem drivers (although the source code for flash drivers takes care of these details)
- a tar filesystem process that presents the contents of a tar file as a filesystem that the user can cd into and ls from
- a mailbox-management process that registers the name /mailboxes and manages individual mailboxes that look like directories, and files that contain the actual messages