28.08.2015 Views

The Design and Implementation of the Anykernel and Rump Kernels

1F3KDce

1F3KDce

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

70<br />

for loadable kernel modules (discussed fur<strong>the</strong>r in Section 3.8.1). Originally, <strong>the</strong> file<br />

contained routines both for loading kernel modules from <strong>the</strong> file system <strong>and</strong> for<br />

keeping track <strong>of</strong> <strong>the</strong>m. Having both in one module was a valid possibility before <strong>the</strong><br />

anykernel faction model. In <strong>the</strong> anykernel model, loading modules from a file system<br />

is VFS functionality, while keeping track <strong>of</strong> <strong>the</strong> modules is base functionality.<br />

To make <strong>the</strong> code comply with <strong>the</strong> anykernel model, we used <strong>the</strong> code moving<br />

technique to move all code related to file system access to its own source file in<br />

kern_module_vfs.c. Since loading from a file system must still be initiated by <strong>the</strong><br />

kernel module management routines, we introduced a function pointer interface. By<br />

default, it is initialized to a stub:<br />

int (*module_load_vfs_vec)(const char *, int, bool, module_t *,<br />

prop_dictionary_t *) = (void *)eopnotsupp;<br />

If VFS is present, <strong>the</strong> routine module_load_vfs_init() is called during VFS subsystem<br />

init after <strong>the</strong> vfs_mountroot() routine has successfully completed to set<br />

<strong>the</strong> value <strong>of</strong> <strong>the</strong> function pointer to module_load_vfs(). In addition to avoiding a<br />

direct reference from <strong>the</strong> base to a faction in rump kernels, this pointer has ano<strong>the</strong>r<br />

benefit: during bootstrap it protects <strong>the</strong> kernel from accidentally trying to load<br />

kernel modules from <strong>the</strong> file system before a file system has been mounted 3 .<br />

3.1.1 Extracting <strong>and</strong> Implementing<br />

We have two methods for providing functionality in <strong>the</strong> rump kernel: we can extract<br />

it out <strong>of</strong> <strong>the</strong> kernel sources, meaning we use <strong>the</strong> source file as such, or we can<br />

implement it, meaning that we do an implementation suitable for use in a rump<br />

3 sys/kern/vfs_subr.c rev 1.401

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!