MOUNT_NULL(8) | System Manager's Manual | MOUNT_NULL(8) |
mount_null | [-o options] target mount-point |
The primary differences between a virtual copy of the filesystem and a symbolic link are that getcwd(3) functions correctly in the virtual copy, and that other filesystems may be mounted on the virtual copy without affecting the original. A different device number for the virtual copy is returned by stat(2), but in other respects it is indistinguishable from the original.
The mount_null filesystem differs from a traditional loopback file system in two respects: it is implemented using a stackable layers technique, and its “null-nodes” stack above all lower-layer vnodes (not just above directory vnodes).
Both target and mount-point are converted to absolute paths before use.
The options are as follows:
The null layer has two purposes. First, it serves as a demonstration of layering by providing a layer which does nothing. Second, the null layer can serve as a prototype layer. Since it provides all necessary layer framework, new file system layers can be created very easily by starting with a null layer.
The remainder of this man page examines the null layer as a basis for constructing new layers.
The bypass routine accepts arbitrary vnode operations for handling by the lower layer. It begins by examining vnode operation arguments and replacing any null-nodes by their lower-layer equivalents. It then invokes the operation on the lower layer. Finally, it replaces the null-nodes in the arguments and, if a vnode is returned by the operation, stacks a null-node on top of the returned vnode.
Although bypass handles most operations, vop_getattr, vop_inactive, vop_reclaim, and vop_print are not bypassed. vop_getattr must change the fsid being returned. vop_inactive and vop_reclaim are not bypassed so that they can handle freeing null-layer specific data. vop_print is not bypassed to avoid excessive debugging information.
The initial mount creates a single vnode stack for the root of the new null layer. All other vnode stacks are created as a result of vnode operations on this or other null vnode stacks.
New vnode stacks come into existence as a result of an operation which returns a vnode. The bypass routine stacks a null-node above the new vnode before returning it to the caller.
For example, imagine mounting a null layer with
mount_null /usr/include /dev/layer/nullChanging directory to /dev/layer/null will assign the root null-node (which was created when the null layer was mounted). Now consider opening sys. A vop_lookup would be done on the root null-node. This operation would bypass through to the lower layer which would return a vnode representing the UFS sys. null_bypass then builds a null-node aliasing the UFS sys and returns this to the caller. Later operations on the null-node sys will repeat this process when constructing other vnode stacks.
The umap layer is an example of a layer descended from the null layer.
The first approach is to call the aliasing layer's bypass routine. This method is most suitable when you wish to invoke the operation currently being handled on the lower layer. It has the advantage that the bypass routine already must do argument mapping. An example of this is null_getattrs in the null layer.
A second approach is to directly invoke vnode operations on the lower layer with the VOP_OPERATIONNAME interface. The advantage of this method is that it is easy to invoke arbitrary operations on the lower layer. The disadvantage is that vnode arguments must be manually mapped.
UCLA Technical Report CSD-910056, Stackable Layers: an Architecture for File System Development.
May 1, 1995 | NetBSD 6.1 |