2006-01-29 06:09:19 +03:00
|
|
|
.\" $NetBSD: vfssubr.9,v 1.13 2006/01/29 03:09:19 rpaulo Exp $
|
2003-04-06 11:09:47 +04:00
|
|
|
.\"
|
2006-01-29 06:09:19 +03:00
|
|
|
.\" Copyright (c) 2003, 2005, 2006 The NetBSD Foundation, Inc.
|
2003-04-06 11:09:47 +04:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Gregory McGarry.
|
|
|
|
.\"
|
|
|
|
.\" 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, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the NetBSD
|
|
|
|
.\" Foundation, Inc. and its contributors.
|
|
|
|
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
.\" contributors may be used to endorse or promote products derived
|
|
|
|
.\" from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``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 FOUNDATION OR CONTRIBUTORS
|
|
|
|
.\" 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.
|
|
|
|
.\"
|
2006-01-29 06:09:19 +03:00
|
|
|
.Dd January 29, 2006
|
2003-04-06 11:09:47 +04:00
|
|
|
.Dt VFSSUBR 9
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm vfssubr ,
|
|
|
|
.Nm vfs_getnewfsid ,
|
|
|
|
.Nm vfs_getvfs ,
|
|
|
|
.Nm vfs_export ,
|
|
|
|
.Nm vfs_showexport ,
|
|
|
|
.Nm vfs_export_lookup ,
|
|
|
|
.Nm vfs_setpublicfs ,
|
|
|
|
.Nm vfs_mountedon ,
|
|
|
|
.Nm vfs_mountroot ,
|
|
|
|
.Nm vfs_unmountall ,
|
|
|
|
.Nm vfs_busy ,
|
|
|
|
.Nm vfs_unbusy ,
|
|
|
|
.Nm vfs_rootmountalloc ,
|
|
|
|
.Nm vfs_shutdown ,
|
|
|
|
.Nm vfs_attach ,
|
|
|
|
.Nm vfs_detach ,
|
|
|
|
.Nm vfs_reinit ,
|
|
|
|
.Nm vfs_getopsbyname ,
|
2003-10-22 02:01:24 +04:00
|
|
|
.Nm vfs_write_suspend ,
|
|
|
|
.Nm vfs_write_resume
|
2003-04-06 11:09:47 +04:00
|
|
|
.Nd high-level interface to kernel file system interface
|
|
|
|
.Sh SYNOPSIS
|
2003-04-16 17:34:34 +04:00
|
|
|
.In sys/param.h
|
|
|
|
.In sys/mount.h
|
|
|
|
.In sys/vnode.h
|
2003-04-06 11:09:47 +04:00
|
|
|
.Ft void
|
|
|
|
.Fn vfs_getnewfsid "struct mount *mp"
|
|
|
|
.Ft struct mount *
|
|
|
|
.Fn vfs_getvfs "fsid_t *fsid"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfs_export_lookup "struct mount *mp" "struct netexport *nep" \
|
|
|
|
"struct export_args *argp"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfs_setpublicfs "struct mount *mp" "struct netexport *nep" \
|
|
|
|
"struct export_args *argp"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfs_mountedon "struct vnode *vp"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfs_mountroot "void"
|
|
|
|
.Ft void
|
2005-12-20 22:53:14 +03:00
|
|
|
.Fn vfs_unmountall "struct lwp *l"
|
2003-04-06 11:09:47 +04:00
|
|
|
.Ft int
|
|
|
|
.Fn vfs_busy "struct mount *mp" "int flags" "struct simplelock *interlkp"
|
|
|
|
.Ft void
|
|
|
|
.Fn vfs_unbusy "struct mount *mp"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfs_rootmountalloc "char *fstypename" "char *devname" \
|
|
|
|
"struct mount **mpp"
|
|
|
|
.Ft void
|
|
|
|
.Fn vfs_shutdown "void"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfs_attach "struct vfsops *vfs"
|
|
|
|
.Ft int
|
|
|
|
.Fn vfs_detach "struct vfsops *vfs"
|
|
|
|
.Ft void
|
|
|
|
.Fn vfs_reinit "void"
|
|
|
|
.Ft struct vfsops *
|
|
|
|
.Fn vfs_getopsbyname "const char *name"
|
|
|
|
.Ft int
|
2004-01-10 20:16:38 +03:00
|
|
|
.Fn vfs_write_suspend "struct mount *mp" "int slpflag" "int slptimeo"
|
2003-10-22 02:01:24 +04:00
|
|
|
.Ft void
|
|
|
|
.Fn vfs_write_resume "struct mount *mp"
|
2003-04-06 11:09:47 +04:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The high-level functions described in this page are the interface to
|
|
|
|
the kernel file system interface (VFS).
|
|
|
|
.Sh FUNCTIONS
|
|
|
|
.Bl -tag -width compact
|
|
|
|
.It Fn vfs_getnewfsid "mp"
|
|
|
|
Get a new unique file system id type for the file system specified by
|
|
|
|
the mount structure
|
|
|
|
.Fa mp .
|
|
|
|
The file system id type is stored in
|
2004-04-21 05:05:31 +04:00
|
|
|
.Em mp-\*[Gt]mnt_stat.f_fsidx .
|
2003-04-06 11:09:47 +04:00
|
|
|
.It Fn vfs_getvfs "fsid"
|
|
|
|
Lookup a mount point with the file system identifier
|
|
|
|
.Fa fsid .
|
|
|
|
.It Fn vfs_export_lookup "mp" "nep" "argp"
|
|
|
|
Check client permission on the exportable file system specified by the
|
|
|
|
mount structure
|
|
|
|
.Fa mp .
|
|
|
|
The argument
|
|
|
|
.Fa nam
|
|
|
|
is the address of the networked client.
|
|
|
|
This function is used by file system type specific functions to verify
|
|
|
|
that the client can access the file system.
|
|
|
|
.It Fn vfs_setpublicfs "mp" "nep" "argp"
|
|
|
|
Set the publicly exported file system specified by the mount structure
|
|
|
|
.Fa mp .
|
|
|
|
.It Fn vfs_mountedon "vp"
|
|
|
|
Check to see if a file system is mounted on a block device specified
|
|
|
|
by the vnode
|
|
|
|
.Fa vp .
|
|
|
|
.It Fn vfs_mountroot "void"
|
|
|
|
Mount the root file system.
|
2006-01-29 06:09:19 +03:00
|
|
|
.It Fn vfs_unmountall "l"
|
2003-04-06 11:09:47 +04:00
|
|
|
Unmount all file systems.
|
|
|
|
.It Fn vfs_busy "mp" "flags" "interlkp"
|
|
|
|
Mark the mount point specified by
|
|
|
|
.Fa mp
|
2003-04-06 14:00:46 +04:00
|
|
|
as busy.
|
|
|
|
This function is used to synchronize access and to delay unmounting.
|
|
|
|
The interlock specified by argument
|
2003-04-06 11:09:47 +04:00
|
|
|
.Fa interlkp
|
|
|
|
is not released on failure.
|
|
|
|
.It Fn vfs_unbusy "mp"
|
|
|
|
Free the busy file system specified by the mount structure
|
|
|
|
.Fa mp .
|
|
|
|
.It Fn vfs_rootmountalloc "fstypename" "devname" "mpp"
|
|
|
|
Lookup a file system type specified by the name
|
|
|
|
.Fa fstypename
|
|
|
|
and if found allocate and initialise a mount structure for it.
|
|
|
|
The allocated mount structure is returned in the address specified by
|
|
|
|
.Fa mpp .
|
|
|
|
The device the root file system was mounted from is specified by the
|
|
|
|
argument
|
|
|
|
.Fa devname
|
|
|
|
and is recorded in the new mount structure.
|
2003-04-06 14:00:46 +04:00
|
|
|
.It Fn vfs_shutdown
|
|
|
|
Sync and unmount all file systems before shutting down.
|
|
|
|
Invoked by
|
2003-04-06 11:09:47 +04:00
|
|
|
.Xr cpu_reboot 9 .
|
|
|
|
.It Fn vfs_attach "vfs"
|
|
|
|
Establish file system
|
|
|
|
.Fa vfs
|
|
|
|
and initialise it.
|
|
|
|
.It Fn vfs_detach "vfs"
|
|
|
|
Remove file system
|
|
|
|
.Fa vfs
|
|
|
|
from the kernel.
|
|
|
|
.It Fn vfs_reinit "void"
|
|
|
|
Reinitialises all file systems within the kernel through file
|
|
|
|
system-specific vfs operation (see
|
|
|
|
.Xr vfsops 9 ) .
|
|
|
|
.It Fn vfs_getopsbyname "name"
|
|
|
|
Given a file system name specified by
|
|
|
|
.Fa name ,
|
|
|
|
look up the vfs operations for that file system (see
|
|
|
|
.Xr vfsops 9 ) ,
|
2003-04-06 14:00:46 +04:00
|
|
|
or return
|
|
|
|
.Dv NULL
|
|
|
|
if file system isn't present in the kernel.
|
2004-01-10 20:16:38 +03:00
|
|
|
.It Fn vfs_write_suspend "mp" "slpflag" "slptimeo"
|
2003-10-22 02:01:24 +04:00
|
|
|
Request a mounted file system to suspend write operations.
|
|
|
|
All new write operations to the file system are stopped.
|
|
|
|
After all write operations in progress have completed, the
|
|
|
|
file system is synced to disk and the function returns.
|
2004-01-10 20:16:38 +03:00
|
|
|
If the file system is currently suspended the
|
|
|
|
.Xr sleep 9
|
|
|
|
flag and timeout are specified by the arguments
|
|
|
|
.Fa slpflag
|
|
|
|
and
|
|
|
|
.Fa slptimeo
|
|
|
|
respectively.
|
|
|
|
If
|
|
|
|
.Fa slptimeo
|
|
|
|
is less than zero
|
|
|
|
.Er EWOULDBLOCK
|
|
|
|
is returned.
|
2004-01-10 20:41:52 +03:00
|
|
|
If the operation is successful, zero is returned, otherwise an
|
2004-01-10 20:16:38 +03:00
|
|
|
appropriate error code is returned.
|
2003-10-22 02:01:24 +04:00
|
|
|
.It Fn vfs_write_resume "mp"
|
|
|
|
Request a mounted file system to resume write operations.
|
2003-04-06 11:09:47 +04:00
|
|
|
.El
|
|
|
|
.Sh CODE REFERENCES
|
|
|
|
This section describes places within the
|
|
|
|
.Nx
|
|
|
|
source tree where actual code implementing or using the vfs
|
|
|
|
operations can be found.
|
|
|
|
All pathnames are relative to
|
|
|
|
.Pa /usr/src .
|
|
|
|
.Pp
|
|
|
|
The vfs interface functions are implemented within the files
|
|
|
|
.Pa sys/kern/vfs_subr.c
|
|
|
|
and
|
|
|
|
.Pa sys/kern/vfs_init.c .
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr intro 9 ,
|
|
|
|
.Xr namei 9 ,
|
|
|
|
.Xr vfs 9 ,
|
|
|
|
.Xr vfsops 9 ,
|
|
|
|
.Xr vnode 9 ,
|
|
|
|
.Xr vnodeops 9
|