Most Unix-related operating systems, such as FreeBSD, Linux, and Solaris, use function pointers to isolate the implementation of a filesystem from the code that accesses its contents. Interestingly, FreeBSD also employs indirection to abstract the read function's arguments.
When I first encountered the call
vop->vop_read(a), shown in the previous
section, I asked myself what that a argument was and what happened to
the original four arguments of the hypothetical implementation of the
VOP_READ function we saw earlier.
After some digging, I found that the kernel uses another level of
indirection to layer filesystems on top of each other to an arbitrary
depth. This layering allows a filesystem to offer some services (such as
translucent views, compression, and encryption) based on the services of
another underlying filesystem. Two mechanisms work cleverly together to
support this feature: one allows a single bypass function to modify the
arguments of any
while another allows all undefined
vop_vector functions to be redirected to the
underlying filesystem layer.
You can see both mechanisms in action in Figure 17-2. The figure illustrates three file-systems layered on top of one another. On top lies the umapfs filesystem, which the system administrator mounted in order to map user credentials. This is valuable if the system where this particular disk was created used different user IDs. For instance, the administrator might ...