More kernel vfs docco.
Xref vfs_mount(9) from vfs_mount(9) Submitted by: Chad David <davidc@acns.ab.ca> PR: docs/32431
This commit is contained in:
+10
-3
@@ -10,7 +10,7 @@ MAN= BUF_LOCK.9 BUF_LOCKFREE.9 BUF_LOCKINIT.9 BUF_REFCNT.9 \
|
||||
MD5.9 MODULE_DEPEND.9 MODULE_VERSION.9 \
|
||||
SYSCALL_MODULE.9 \
|
||||
VFS.9 VFS_CHECKEXP.9 VFS_FHTOVP.9 VFS_INIT.9 VFS_MOUNT.9 \
|
||||
VFS_QUOTACTL.9 VFS_ROOT.9 VFS_START.9 VFS_STATFS.9 \
|
||||
VFS_QUOTACTL.9 VFS_ROOT.9 VFS_SET.9 VFS_START.9 VFS_STATFS.9 \
|
||||
VFS_SYNC.9 VFS_UNMOUNT.9 VFS_VGET.9 VFS_VPTOFH.9 VOP_ACCESS.9 \
|
||||
VOP_ACLCHECK.9 VOP_ADVLOCK.9 VOP_ATTRIB.9 VOP_BWRITE.9 \
|
||||
VOP_CREATE.9 VOP_FSYNC.9 VOP_GETACL.9 VOP_GETEXTATTR.9 \
|
||||
@@ -59,8 +59,12 @@ MAN= BUF_LOCK.9 BUF_LOCKFREE.9 BUF_LOCKINIT.9 BUF_REFCNT.9 \
|
||||
taskqueue.9 time.9 timeout.9 tvtohz.9 \
|
||||
ucred.9 uidinfo.9 uio.9 \
|
||||
vaccess.9 vaccess_acl_posix1e.9 \
|
||||
vcount.9 vfs_busy.9 vfs_mount.9 vfs_timestamp.9 vfs_unbusy.9 \
|
||||
vfs_unmountall.9 vget.9 vgone.9 vhold.9 vinvalbuf.9 \
|
||||
vcount.9 \
|
||||
vfs_busy.9 vfs_getnewfsid.9 vfs_getvfs.9 \
|
||||
vfs_mount.9 vfs_mountedon.9 vfs_rootmountalloc.9 \
|
||||
vfs_timestamp.9 vfs_unbusy.9 vfs_unmountall.9 \
|
||||
vfsconf.9 \
|
||||
vget.9 vgone.9 vhold.9 vinvalbuf.9 \
|
||||
vflush.9 \
|
||||
vm_page_alloc.9 vm_page_bits.9 vm_page_cache.9 \
|
||||
vm_page_copy.9 vm_page_deactivate.9 vm_page_dontneed.9 \
|
||||
@@ -189,6 +193,9 @@ MLINKS+=timeout.9 callout_stop.9 timeout.9 callout_reset.9
|
||||
MLINKS+=uidinfo.9 uihashinit.9 uidinfo.9 uifind.9
|
||||
MLINKS+=uidinfo.9 uihold.9 uidinfo.9 uifree.9
|
||||
MLINKS+=uio.9 uiomove.9
|
||||
MLINKS+=vfsconf.9 vfs_modevent.9
|
||||
MLINKS+=vfsconf.9 vfs_register.9
|
||||
MLINKS+=vfsconf.9 vfs_unregister.9
|
||||
MLINKS+=vgone.9 vgonel.9
|
||||
MLINKS+=vhold.9 vdrop.9
|
||||
MLINKS+=vm_page_bits.9 vm_page_set_validclean.9
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
.\"
|
||||
.\" 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$
|
||||
.\"
|
||||
.Dd December 2, 2001
|
||||
.Dt VFS_SET 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm VFS_SET
|
||||
.Nd "setup loadable filesystem vfsconf"
|
||||
.Sh SYNOPSIS
|
||||
.In sys/param.h
|
||||
.In sys/mount.h
|
||||
.Ft void
|
||||
.Fn VFS_SET "struct vfsops *vfsops" "char *fsname" "int flags"
|
||||
.Sh DESCRIPTION
|
||||
.Fn VFS_SET
|
||||
creates a vfsconf structure for the loadable module with the given vfsops, name and
|
||||
flags, and declares it by calling
|
||||
.Fn DECLARE_MODULE
|
||||
using
|
||||
.Fn vfs_modevent
|
||||
as the event handler.
|
||||
.Sh PSEUDO CODE
|
||||
.Bd -literal
|
||||
/*
|
||||
* fill in the ones we use, and use the vfs_std for the rest.
|
||||
*/
|
||||
static struct vfsops myfs_vfsops = {
|
||||
myfs_mount,
|
||||
vfs_stdstart,
|
||||
myfs_unmount,
|
||||
myfs_root,
|
||||
vfs_stdquotactl,
|
||||
myfs_statfs,
|
||||
vfs_stdsync,
|
||||
vfs_stdvget,
|
||||
vfs_stdfhtovp,
|
||||
vfs_stdcheckexp,
|
||||
vfs_stdvptofh,
|
||||
vfs_stdinit,
|
||||
vfs_stduninit,
|
||||
vfs_stdextattrctl,
|
||||
};
|
||||
|
||||
VFS_SET(myfs_vfsops, skelfs, 0);
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr vfsconf 9 ,
|
||||
.Xr vfs_modevent 9 ,
|
||||
.Xr DECLARE_MODULE 9
|
||||
.Sh AUTHORS
|
||||
This man page was written by
|
||||
.An Chad David Aq davidc@acns.ab.ca .
|
||||
@@ -0,0 +1,73 @@
|
||||
.\"
|
||||
.\" 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$
|
||||
.\"
|
||||
.Dd November 21, 2001
|
||||
.Dt VFS_GETNEWFSID 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm vfs_getnewfsid
|
||||
.Nd "allocate a new fsid"
|
||||
.Sh SYNOPSIS
|
||||
.In sys/param.h
|
||||
.In sys/mount.h
|
||||
.Ft void
|
||||
.Fn vfs_getnewfsid "struct mount *mp"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn vfs_getnewfsid
|
||||
function allocates a new filesystem identifier for the mount point given.
|
||||
Filesystems typically call
|
||||
.Fn vfs_getnewfsid
|
||||
in their mount routine in order to acquire a unique id within the system
|
||||
which can later be used to uniquely identify the filesystem via calls such as
|
||||
.Fn vfs_getvfs .
|
||||
.Pp
|
||||
The actual fsid is made up of two 32 bit integers, that are stored in the statfs
|
||||
structure of
|
||||
.Fa mp .
|
||||
The first integer is unique in the set of mounted filesystems, while the second holds
|
||||
the filesystem type.
|
||||
.Bd -literal
|
||||
typedef struct fsid {
|
||||
int32_t val[2];
|
||||
} fsid_t;
|
||||
.Ed
|
||||
.Sh PSEUDOCODE
|
||||
.Bd -literal
|
||||
xxx_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct thread *td)
|
||||
{
|
||||
...
|
||||
vfs_getnewfsid(mp);
|
||||
...
|
||||
}
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr vfs_getvfs 9
|
||||
.Sh AUTHORS
|
||||
This man page was written by
|
||||
.An Chad David Aq davidc@acns.ab.ca .
|
||||
@@ -0,0 +1,72 @@
|
||||
.\"
|
||||
.\" 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$
|
||||
.\"
|
||||
.Dd November 21, 2001
|
||||
.Dt VFS_GETVFS 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm vfs_getvfs
|
||||
.Nd "returns a mount point given its fsid"
|
||||
.Sh SYNOPSIS
|
||||
.In sys/param.h
|
||||
.In sys/mount.h
|
||||
.Ft struct mount *
|
||||
.Fn vfs_getvfs "fsid_t *fsid"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn vfs_getvfs
|
||||
function returns the mount point structure for a filesystem given its filesystem
|
||||
identifier. The filesystem id should have been allocated by calling
|
||||
.Fn vfs_getnewfsid ;
|
||||
otherwise, it will not be found.
|
||||
.Pp
|
||||
A major user of
|
||||
.Fn vfs_getvfs
|
||||
is NFS, which uses the fsid as part of file handles in order to determine the
|
||||
filesystem a given RPC is for.
|
||||
If
|
||||
.Fn vfs_getvfs
|
||||
fails to find the mount point related to
|
||||
.Fa fsid
|
||||
the filesystem is considered stale.
|
||||
.Sh RETURN VALUES
|
||||
If
|
||||
.Fa fsid
|
||||
is found the mount point for the id is returned; otherwise,
|
||||
.Dv NULL
|
||||
is returned.
|
||||
.Sh PSEUDOCODE
|
||||
.Bd -literal
|
||||
if ((mp = vfs_getvfs(&fhp->fh_fsid)) == NULL) {
|
||||
error = ESTALE;
|
||||
goto out;
|
||||
}
|
||||
.Ed
|
||||
.Sh AUTHORS
|
||||
This man page was written by
|
||||
.An Chad David Aq davidc@acns.ab.ca .
|
||||
@@ -121,7 +121,8 @@ this call relies on a large number of other kernel services
|
||||
whose errors it returns so this list may not be exhaustive.
|
||||
.Sh SEE ALSO
|
||||
.Xr mount 2 ,
|
||||
.Xr mount 8
|
||||
.Xr mount 8 ,
|
||||
.Xr vfs_mount 9
|
||||
.Pp
|
||||
.Va vfs.usermount
|
||||
.Sh AUTHORS
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
.\"
|
||||
.\" 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$
|
||||
.\"
|
||||
.Dd November 21, 2001
|
||||
.Dt VFS_MOUNTEDON 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm vfs_mountedon
|
||||
.Nd "check if the vnode belongs to a mounted filesystem"
|
||||
.Sh SYNOPSIS
|
||||
.In sys/param.h
|
||||
.In sys/vnode.h
|
||||
.Ft int
|
||||
.Fn vfs_mountedon "struct vnode *vp"
|
||||
.Sh DESCRIPTION
|
||||
.Fn vfs_mountedon
|
||||
inspects the mount structure in
|
||||
.Fa vp
|
||||
to determine if it points to a valid mount point.
|
||||
If the mount is valid the vnode is considered to be busy.
|
||||
.Pp
|
||||
A common use of
|
||||
.Fn vfs_mountedon
|
||||
it to call it on device vnodes to determine if they are already associated with
|
||||
a filesystem.
|
||||
This is done to prevent multiple mounts on the same device.
|
||||
.Sh RETURN VALUES
|
||||
.Dv EBUSY
|
||||
is returned if the vnode has a valid mount point; otherwise, 0 is returned.
|
||||
.Sh PSEUDOCODE
|
||||
.Bd -literal
|
||||
int
|
||||
ffs_mountfs(devvp, mp, td, malloctype)
|
||||
register struct vnode *devvp;
|
||||
struct mount *mp;
|
||||
struct thread *td;
|
||||
struct malloc_type *malloctype;
|
||||
{
|
||||
...
|
||||
|
||||
error = vfs_mountedon(devvp);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
...
|
||||
}
|
||||
.Ed
|
||||
.Sh AUTHORS
|
||||
This man page was written by
|
||||
.An Chad David Aq davidc@acns.ab.ca .
|
||||
@@ -0,0 +1,57 @@
|
||||
.\"
|
||||
.\" 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$
|
||||
.\"
|
||||
.Dd November 21, 2001
|
||||
.Dt VFS_ROOTMOUNTALLOC 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm vfs_rootmountalloc
|
||||
.Nd "allocate a root mount structure"
|
||||
.Sh SYNOPSIS
|
||||
.In sys/param.h
|
||||
.In sys/vnode.h
|
||||
.Ft int
|
||||
.Fn vfs_rootmountalloc "char *fstypename" "char *devname" "struct mount **mpp"
|
||||
.Sh DESCRIPTION
|
||||
.Fn vfs_rootmountalloc
|
||||
allocates a mount structure initialized from the vfsconf type
|
||||
that matches
|
||||
.Fa fstypename .
|
||||
.Sh RETURN VALUES
|
||||
If successful 0 is returned and
|
||||
.Fa mpp
|
||||
points to the newly allocated mount structure.
|
||||
.Dv ENODEV
|
||||
is returned if
|
||||
.Fa fstypename
|
||||
is NULL or invalid.
|
||||
.Sh SEE ALSO
|
||||
.Xr vfsconf 9
|
||||
.Sh AUTHORS
|
||||
This man page was written by
|
||||
.An Chad David Aq davidc@acns.ab.ca .
|
||||
@@ -0,0 +1,131 @@
|
||||
.\"
|
||||
.\" 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$
|
||||
.\"
|
||||
.Dd November 21, 2001
|
||||
.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
|
||||
Each filesystem type known to the kernel has a vfsconf structure that contains the
|
||||
information required to create a new mount of that filesystems type.
|
||||
.Bd -literal
|
||||
struct vfsconf {
|
||||
struct vfsops *vfc_vfsops; /* filesystem operations vector */
|
||||
char vfc_name[MFSNAMELEN]; /* filesystem type name */
|
||||
int vfc_typenum; /* historic filesystem type number */
|
||||
int vfc_refcount; /* number mounted of this type */
|
||||
int vfc_flags; /* permanent flags */
|
||||
struct vfsconf *vfc_next; /* next in list */
|
||||
};
|
||||
|
||||
.Ed
|
||||
When a new filesystem is mounted
|
||||
.Fn vfs_mount
|
||||
does a lookup of the vfcconf structure by its name, and if it is not already registered,
|
||||
attempts to load a kernel module for it.
|
||||
The filesystem operations for the new mount point are taken from vfc_vfsops, and mnt_vfc
|
||||
in the mount structure is made to point directly at the vfcconf structure for the
|
||||
filesystem type.
|
||||
The filesystem type number is taken from vfs_typenum which was assigned in
|
||||
.Fn vfs_register ,
|
||||
and the mount flags are taken from a mask of vfc_flags.
|
||||
Each time a filesystem of a given type is mounted vfc_refcount is incremented.
|
||||
.Pp
|
||||
.Fn vfs_register
|
||||
takes a new vfsconf structure and adds it to the list of existing filesystems.
|
||||
If the type has not already been registered it is initialize by calling the
|
||||
.Fn vfs_init
|
||||
function in the filesystem operations vector.
|
||||
.Fn vfs_register
|
||||
also updates the oid's of any sysctl nodes for this filesystem type
|
||||
to be the same as the newly assigned type number.
|
||||
.Pp
|
||||
.Fn vfs_unregister
|
||||
unlinks
|
||||
.Fa vfc
|
||||
from the list of registered filesystem types if there are currently no mounted instances.
|
||||
If the
|
||||
.Fn vfs_uninit
|
||||
function in the filesystems initialization vector is defined it is called.
|
||||
.Pp
|
||||
.Fn vfs_modevent
|
||||
is registered by
|
||||
.Fn VFS_SET
|
||||
to handle the loading and unloading of filesystem kernel modules.
|
||||
In the case of
|
||||
.Dv MOD_LOAD
|
||||
.Fn vfs_register
|
||||
is called.
|
||||
In the case of
|
||||
.Dv MOD_UNLOAD
|
||||
.Fn vfs_unregister
|
||||
is called.
|
||||
.Sh RETURN VALUES
|
||||
.Fn vfs_register
|
||||
returns 0 if successful; otherwise,
|
||||
.Dv EEXIST
|
||||
is returned indicating that the filesystem type has already been registered.
|
||||
.Pp
|
||||
.Fn vfs_unregister
|
||||
returns 0 if successful.
|
||||
If no vfsconf entry can be found matching the name in
|
||||
.Fa vfc ,
|
||||
.Dv EINVAL
|
||||
is returned.
|
||||
If the reference count of mounted instances of the filesystem type is not zero
|
||||
.Dv EBUSY
|
||||
is returned.
|
||||
If
|
||||
.Fn vfs_uninit
|
||||
is called any errors it returns will be returned by
|
||||
.Fn vfs_unregister .
|
||||
.Pp
|
||||
.Fn vfs_modevent
|
||||
returns the result of the call to
|
||||
.Fn vfs_register
|
||||
or
|
||||
.Fn vfs_unregister
|
||||
whatever the case.
|
||||
.Sh SEE ALSO
|
||||
.Xr vfs_rootmountalloc 9 ,
|
||||
.Xr vfs_mount ,
|
||||
.Xr VFS_SET 9
|
||||
.Sh AUTHORS
|
||||
This man page was written by
|
||||
.An Chad David Aq davidc@acns.ab.ca .
|
||||
Reference in New Issue
Block a user