4.4BSD/usr/share/man/cat8/mount_null.0

Compare this file to the similar file:
Show the results in this format:

MOUNT_NULL(8)             BSD System Manager's Manual            MOUNT_NULL(8)

NNAAMMEE
     mmoouunntt__nnuullll - demonstrate the use of a null file system layer

SSYYNNOOPPSSIISS
     mmoouunntt__nnuullll [--FF _f_s_o_p_t_i_o_n_s] _t_a_r_g_e_t _m_o_u_n_t_-_p_o_i_n_t

DDEESSCCRRIIPPTTIIOONN
     The mmoouunntt__nnuullll command creates a null layer, duplicating a sub-tree of
     the file system name space under another part of the global file system
     namespace.  In this respect, it is similar to the loopback file system
     (see mount_lofs(8)).  It differs from the loopback file system in two re-
     spects:  it is implemented using a stackable layers techniques, and it's
     ``null-node'' s stack above all lower-layer vnodes, not just over direc-
     tory vnodes.

     The null layer has two purposes.  First, it serves as a demonstration of
     layering by proving a layer which does nothing.  (It actually does every-
     thing the loopback file system does, which is slightly more than noth-
     ing.)  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 be starting with a null layer.

     The remainder of this man page examines the null layer as a basis for
     constructing new layers.

IINNSSTTAANNTTIIAATTIINNGG NNEEWW NNUULLLL LLAAYYEERRSS
     New null layers are created with mount_null(8).  Mount_null(8) takes two
     arguments, the pathname of the lower vfs (target-pn) and the pathname
     where the null layer will appear in the namespace (mount-point-pn).  Af-
     ter the null layer is put into place, the contents of target-pn subtree
     will be aliased under mount-point-pn.

OOPPEERRAATTIIOONN OOFF AA NNUULLLL LLAAYYEERR
     The null layer is the minimum file system layer, simply bypassing all
     possible operations to the lower layer for processing there.  The majori-
     ty of its activity centers on the bypass routine, though which nearly all
     vnode operations pass.

     The bypass routine accepts arbitrary vnode operations for handling by the
     lower layer.  It begins by examing vnode operation arguments and replac-
     ing any null-nodes by their lower-layer equivlants.  It then invokes the
     operation on the lower layer.  Finally, it replaces the null-nodes in the
     arguments and, if a vnode is return by the operation, stacks a null-node
     on top of the returned vnode.

     Although bypass handles most operations, _v_o_p___g_e_t_a_t_t_r, _v_o_p___i_n_a_c_t_i_v_e,
     _v_o_p___r_e_c_l_a_i_m, and _v_o_p___p_r_i_n_t are not bypassed.  _V_o_p___g_e_t_a_t_t_r must change the
     fsid being returned.  _V_o_p___i_n_a_c_t_i_v_e and vop_reclaim are not bypassed so
     that they can handle freeing null-layer specific data.  _V_o_p___p_r_i_n_t is not
     bypassed to avoid excessive debugging information.

IINNSSTTAANNTTIIAATTIINNGG VVNNOODDEE SSTTAACCKKSS
     Mounting associates the null layer with a lower layer, in effect stacking
     two VFSes.  Vnode stacks are instead created on demand as files are ac-
     cessed.

     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 op-
     erations on this or other null vnode stacks.

     New vnode stacks come into existance as a result of an operation which
     returns a vnode.  The bypass routine stacks a null-node above the new vn-
     ode before returning it to the caller.

     For example, imagine mounting a null layer with

           mount_null /usr/include /dev/layer/null
     Chainging directory to _/_d_e_v_/_l_a_y_e_r_/_n_u_l_l will assign the root null-node
     (which was created when the null layer was mounted).  Now consider open-
     ing _s_y_s. A vop_lookup would be done on the root null-node.  This opera-
     tion would bypass through to the lower layer which would return a vnode
     representing the UFS _s_y_s. Null_bypass then builds a null-node aliasing
     the UFS _s_y_s and returns this to the caller.  Later operations on the
     null-node _s_y_s will repeat this process when constructing other vnode
     stacks.

CCRREEAATTIINNGG OOTTHHEERR FFIILLEE SSYYSSTTEEMM LLAAYYEERRSS
     One of the easiest ways to construct new file system layers is to make a
     copy of the null layer, rename all files and variables, and then begin
     modifing the copy.  Sed can be used to easily rename all variables.

     The umap layer is an example of a layer descended from the null layer.

IINNVVOOKKIINNGG OOPPEERRAATTIIOONNSS OONN LLOOWWEERR LLAAYYEERRSS
     There are two techniques to invoke operations on a lower layer when the
     operation cannot be completely bypassed.  Each method is appropriate in
     different situations.  In both cases, it is the responsibility of the
     aliasing layer to make the operation arguments "correct" for the lower
     layer by mapping an vnode arguments to the lower 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 hanldled on the lower layer.  It has the advantage the the bypass
     routine already must do argument mapping.  An example of this is
     _n_u_l_l___g_e_t_a_t_t_r_s in the null layer.

     A second approach is to directly invoked vnode operations on the lower
     layer with the _V_O_P___O_P_E_R_A_T_I_O_N_N_A_M_E interface.  The advantage of this method
     is that it is easy to invoke arbitrary operations on the lower layer.
     The disadvantage is that vnodes arguments must be manualy mapped.

SSEEEE AALLSSOO
     UCLA Technical Report CSD-910056, _S_t_a_c_k_a_b_l_e _L_a_y_e_r_s_: _a_n _A_r_c_h_i_t_e_c_t_u_r_e _f_o_r
     _F_i_l_e _S_y_s_t_e_m _D_e_v_e_l_o_p_m_e_n_t.

HHIISSTTOORRYY
     The mmoouunntt__nnuullll utility first appeared in 4.4BSD.

4.4BSD                           June 9, 1993                                2