DESCRIPTION

The kernel_mount() family of functions are provided as an API for
building a list of mount arguments which will be used to mount file
systems from inside the kernel. By accumulating a list of arguments, the
API takes shape and provides the information necessary for the kernel to
control the mount(8) utility. When an error occurs, the process will
stop. This will not cause a panic(9).
The header of the structure is stored in src/sys/kern/vfs_mount.c which
permits automatic structure creation to ease the mount process. Memory
allocation must always be freed when the entire process is complete, it
is an error otherwise.
The free_mntarg() function is used to free or clear the mntarg structure.
The kernel_mount() function pulls information from the structure to
perform the mount request on a given file system. Additionally, the
kernel_mount() function always calls the free_mntarg() function. If ma
contains any error code generated during the construction, that code will
be called and the file system mount will not be attempted.
The kernel_vmount() is a function similar to printf(9) which is used to
mount a file system.
The mount_arg() function takes a plain argument and crafts parts of the
structure with regards to various mount options. If the length is a
value less than 0, strlen(3) is used. This argument will be referenced
until either free_mntarg() or kernel_mount() is called.
The mount_argb() function is used to add boolean arguments to the
structure. The flag is the boolean value and name must start with "no",
otherwise a panic will occur.
The mount_argf() function adds printf(9) style arguments to the current
structure.
The mount_argsu() function will add arguments to the structure from a
userland string.