-
Notifications
You must be signed in to change notification settings - Fork 7
Filesystem Hierarchies
Filesystem instances are organized in a tree. Every process has a root directory that is provided by a root filesystem. Additional filesystems can be attached to a root filesystem by mounting those additional filesystems at the directory of the root filesystem.
One significant difference between Serena OS and a typical OS is that there isn't just a single filesystem hierarchy in Serena OS. Instead every process may host its own, completely independent filesystem hierarchy. Processes may also share individual filesystems.
Another significant difference is that Serena OS supports disk-less filesystems which store their data some place that isn't a block-structured disk. The most prominent example of disk-less filesystems are kernel catalogs. A kernel catalog is a filesystem that names kernel objects like processes, filesystem instances or device drivers. Those catalogs manage live objects - not blocks on a RAM disk.
There are at least two filesystem hierarchies present in every Serena OS installation: one that is exclusively set up for the kernel process kerneld and one that is set up for systemd and all its child processes. The kerneld filesystem hierarchy is non-persistent and contains just the kernel catalogs. The filesystem hierarchy that is set up for systemd on the other hand is based on the boot filesystem and it does not include any other filesystems by default. It is one of the tasks of systemd to mount other filesystems and the various kernel catalogs on the boot filesystem.
A process inherits its file hierarchy from its parent process by default. There is currently no user space API available to specify a difference file hierarchy when spawning a child process. This feature will be added in a future release
A filesystem hierarchy can be extended with a new filesystem by mounting a filesystem that exists on a disk or by mounting a disk-less filesystem. The mounting is done by executing the mount call. This call expects a path to a disk driver or the name of a kernel catalog that should be mounted and a path to a directory in the existing filesystem hierarchy that specifies where the root directory of the new filesystem should be mounted.
A filesystem is unmounted with the help of the unmount call.
Serena OS internally makes a distinction between mounting and attaching: mounting is the process of identifying a filesystem stored on a medium, creating and initializing a filesystem instance that is going to manage the data on the medium. Attaching on the other hand is the process of linking a filesystem instance into a filesystem hierarchy. This distinction enables Serena OS to make one and the same filesystem instance available in multiple filesystem hierarchies. For example, the kernel catalogs are mounted once and attached multiple times: once to the kerneld filesystem hierarchy and a second time to the filesystem hierarchy set up by systemd.