2001-12-03 00:25:04 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice(s), this list of conditions and the following disclaimer as
|
|
|
|
.\" the first lines of this file unmodified other than the possible
|
|
|
|
.\" addition of one or more copyright notices.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice(s), this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
|
|
|
|
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
|
|
|
|
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
|
|
.\" DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2013-06-17 03:32:27 +00:00
|
|
|
.Dd June 16, 2013
|
2001-12-03 00:25:04 +00:00
|
|
|
.Dt VFSCONF 9
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm vfsconf
|
|
|
|
.Nd "vfs configuration information"
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In sys/param.h
|
|
|
|
.In sys/mount.h
|
|
|
|
.Ft int
|
|
|
|
.Fn vfs_register "struct vfsconf *vfc"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfs_unregister "struct vfsconf *vfc"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfs_modevent "module_t mod" "int type" "void *data"
|
|
|
|
.Sh DESCRIPTION
|
2002-12-12 17:26:04 +00:00
|
|
|
Each file system type known to the kernel has a
|
2001-12-14 09:11:13 +00:00
|
|
|
.Vt vfsconf
|
|
|
|
structure that contains the
|
2002-12-12 17:26:04 +00:00
|
|
|
information required to create a new mount of that file systems type.
|
2001-12-03 00:25:04 +00:00
|
|
|
.Bd -literal
|
2001-12-14 09:11:13 +00:00
|
|
|
struct vfsconf {
|
2002-12-12 17:26:04 +00:00
|
|
|
struct vfsops *vfc_vfsops; /* file system operations vector */
|
|
|
|
char vfc_name[MFSNAMELEN]; /* file system type name */
|
|
|
|
int vfc_typenum; /* historic file system type number */
|
2001-12-14 09:11:13 +00:00
|
|
|
int vfc_refcount; /* number mounted of this type */
|
|
|
|
int vfc_flags; /* permanent flags */
|
|
|
|
struct vfsconf *vfc_next; /* next in list */
|
|
|
|
};
|
2001-12-03 00:25:04 +00:00
|
|
|
.Ed
|
2001-12-14 09:11:13 +00:00
|
|
|
.Pp
|
2002-12-12 17:26:04 +00:00
|
|
|
When a new file system is mounted,
|
2013-06-17 03:32:27 +00:00
|
|
|
.Xr mount 2
|
2001-12-14 09:11:13 +00:00
|
|
|
does a lookup of the
|
|
|
|
.Vt vfsconf
|
|
|
|
structure by its name, and if it is not already registered,
|
2001-12-03 00:25:04 +00:00
|
|
|
attempts to load a kernel module for it.
|
2002-12-12 17:26:04 +00:00
|
|
|
The file system operations for the new mount point are taken from
|
2001-12-14 09:11:13 +00:00
|
|
|
.Va vfc_vfsops ,
|
|
|
|
and
|
|
|
|
.Va mnt_vfc
|
|
|
|
in the
|
|
|
|
.Vt mount
|
|
|
|
structure is made to point directly at the
|
|
|
|
.Vt vfsconf
|
|
|
|
structure for the
|
2002-12-12 17:26:04 +00:00
|
|
|
file system type.
|
|
|
|
The file system type number is taken from
|
2001-12-14 09:11:13 +00:00
|
|
|
.Va vfc_typenum
|
|
|
|
which was assigned in
|
2001-12-03 00:25:04 +00:00
|
|
|
.Fn vfs_register ,
|
2001-12-14 09:11:13 +00:00
|
|
|
and the mount flags are taken from a mask of
|
|
|
|
.Va vfc_flags .
|
2002-12-12 17:26:04 +00:00
|
|
|
Each time a file system of a given type is mounted,
|
2001-12-14 09:11:13 +00:00
|
|
|
.Va vfc_refcount
|
|
|
|
is incremented.
|
2001-12-03 00:25:04 +00:00
|
|
|
.Pp
|
|
|
|
.Fn vfs_register
|
2001-12-14 09:11:13 +00:00
|
|
|
takes a new
|
|
|
|
.Vt vfsconf
|
2002-12-12 17:26:04 +00:00
|
|
|
structure and adds it to the list of existing file systems.
|
2001-12-14 09:11:13 +00:00
|
|
|
If the type has not already been registered, it is initialized by calling the
|
2001-12-03 00:25:04 +00:00
|
|
|
.Fn vfs_init
|
2002-12-12 17:26:04 +00:00
|
|
|
function in the file system operations vector.
|
2001-12-03 00:25:04 +00:00
|
|
|
.Fn vfs_register
|
2002-12-12 17:26:04 +00:00
|
|
|
also updates the oid's of any sysctl nodes for this file system type
|
2001-12-03 00:25:04 +00:00
|
|
|
to be the same as the newly assigned type number.
|
|
|
|
.Pp
|
|
|
|
.Fn vfs_unregister
|
|
|
|
unlinks
|
|
|
|
.Fa vfc
|
2002-12-12 17:26:04 +00:00
|
|
|
from the list of registered file system types if there are currently no mounted instances.
|
2001-12-03 00:25:04 +00:00
|
|
|
If the
|
|
|
|
.Fn vfs_uninit
|
2002-12-12 17:26:04 +00:00
|
|
|
function in the file systems initialization vector is defined, it is called.
|
2001-12-03 00:25:04 +00:00
|
|
|
.Pp
|
|
|
|
.Fn vfs_modevent
|
|
|
|
is registered by
|
|
|
|
.Fn VFS_SET
|
2002-12-12 17:26:04 +00:00
|
|
|
to handle the loading and unloading of file system kernel modules.
|
2001-12-03 00:25:04 +00:00
|
|
|
In the case of
|
2001-12-14 09:11:13 +00:00
|
|
|
.Dv MOD_LOAD ,
|
2001-12-03 00:25:04 +00:00
|
|
|
.Fn vfs_register
|
|
|
|
is called.
|
|
|
|
In the case of
|
2001-12-14 09:11:13 +00:00
|
|
|
.Dv MOD_UNLOAD ,
|
2001-12-03 00:25:04 +00:00
|
|
|
.Fn vfs_unregister
|
|
|
|
is called.
|
|
|
|
.Sh RETURN VALUES
|
|
|
|
.Fn vfs_register
|
|
|
|
returns 0 if successful; otherwise,
|
2001-12-14 09:11:13 +00:00
|
|
|
.Er EEXIST
|
2002-12-12 17:26:04 +00:00
|
|
|
is returned indicating that the file system type has already been registered.
|
2001-12-03 00:25:04 +00:00
|
|
|
.Pp
|
|
|
|
.Fn vfs_unregister
|
|
|
|
returns 0 if successful.
|
2001-12-14 09:11:13 +00:00
|
|
|
If no
|
|
|
|
.Vt vfsconf
|
|
|
|
entry can be found matching the name in
|
2001-12-03 00:25:04 +00:00
|
|
|
.Fa vfc ,
|
2001-12-14 09:11:13 +00:00
|
|
|
.Er EINVAL
|
2001-12-03 00:25:04 +00:00
|
|
|
is returned.
|
2002-12-12 17:26:04 +00:00
|
|
|
If the reference count of mounted instances of the file system type is not zero,
|
2001-12-14 09:11:13 +00:00
|
|
|
.Er EBUSY
|
2001-12-03 00:25:04 +00:00
|
|
|
is returned.
|
|
|
|
If
|
|
|
|
.Fn vfs_uninit
|
2001-12-14 09:11:13 +00:00
|
|
|
is called, any errors it returns will be returned by
|
2001-12-03 00:25:04 +00:00
|
|
|
.Fn vfs_unregister .
|
|
|
|
.Pp
|
|
|
|
.Fn vfs_modevent
|
|
|
|
returns the result of the call to
|
|
|
|
.Fn vfs_register
|
|
|
|
or
|
2001-12-14 09:11:13 +00:00
|
|
|
.Fn vfs_unregister ,
|
2001-12-03 00:25:04 +00:00
|
|
|
whatever the case.
|
|
|
|
.Sh SEE ALSO
|
2013-06-17 03:32:27 +00:00
|
|
|
.Xr mount 2 ,
|
2001-12-03 00:25:04 +00:00
|
|
|
.Xr vfs_rootmountalloc 9 ,
|
|
|
|
.Xr VFS_SET 9
|
|
|
|
.Sh AUTHORS
|
2005-06-28 20:15:19 +00:00
|
|
|
This manual page was written by
|
2014-06-26 21:44:30 +00:00
|
|
|
.An Chad David Aq Mt davidc@acns.ab.ca .
|