1 .\" $NetBSD: vfssubr.9,v 1.18 2009/05/08 22:37:32 dyoung Exp $
3 .\" Copyright (c) 2003, 2005, 2006 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Gregory McGarry.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
39 .Nm vfs_export_lookup ,
47 .Nm vfs_rootmountalloc ,
52 .Nm vfs_getopsbyname ,
55 .Nd high-level interface to kernel file system interface
61 .Fn vfs_getnewfsid "struct mount *mp"
63 .Fn vfs_getvfs "fsid_t *fsid"
65 .Fn vfs_export_lookup "struct mount *mp" "struct netexport *nep" \
66 "struct export_args *argp"
68 .Fn vfs_setpublicfs "struct mount *mp" "struct netexport *nep" \
69 "struct export_args *argp"
71 .Fn vfs_mountedon "struct vnode *vp"
73 .Fn vfs_mountroot "void"
75 .Fn vfs_unmountall "struct lwp *l"
77 .Fn vfs_busy "struct mount *mp" "int flags" "struct simplelock *interlkp"
79 .Fn vfs_unbusy "struct mount *mp"
81 .Fn vfs_mountalloc "struct vfsops *vfs" "struct vnode *vp"
83 .Fn vfs_rootmountalloc "char *fstypename" "char *devname" \
86 .Fn vfs_shutdown "void"
88 .Fn vfs_attach "struct vfsops *vfs"
90 .Fn vfs_detach "struct vfsops *vfs"
94 .Fn vfs_getopsbyname "const char *name"
96 .Fn vfs_suspend "struct mount *mp" "int nowait"
98 .Fn vfs_resume "struct mount *mp"
100 The high-level functions described in this page are the interface to
101 the kernel file system interface (VFS).
103 .Bl -tag -width compact
104 .It Fn vfs_getnewfsid "mp"
105 Get a new unique file system id type for the file system specified by
108 The file system id type is stored in
109 .Em mp-\*[Gt]mnt_stat.f_fsidx .
110 .It Fn vfs_getvfs "fsid"
111 Lookup a mount point with the file system identifier
113 .It Fn vfs_export_lookup "mp" "nep" "argp"
114 Check client permission on the exportable file system specified by the
119 is the address of the networked client.
120 This function is used by file system type specific functions to verify
121 that the client can access the file system.
122 .It Fn vfs_setpublicfs "mp" "nep" "argp"
123 Set the publicly exported file system specified by the mount structure
125 .It Fn vfs_mountedon "vp"
126 Check to see if a file system is mounted on a block device specified
129 .It Fn vfs_mountroot "void"
130 Mount the root file system.
131 .It Fn vfs_unmountall "l"
132 Unmount all file systems.
133 .It Fn vfs_busy "mp" "flags" "interlkp"
134 Mark the mount point specified by
137 This function is used to synchronize access and to delay unmounting.
138 The interlock specified by argument
140 is not released on failure.
141 .It Fn vfs_unbusy "mp"
142 Free the busy file system specified by the mount structure
144 .It Fn vfs_mountalloc "vfsops" "vp"
145 Allocate and initialise a mount structure, setting
153 On success, mark the mount structure as busy and return its address.
156 .It Fn vfs_rootmountalloc "fstypename" "devname" "mpp"
157 Lookup a file system type specified by the name
159 and if found allocate and initialise a mount structure for it.
160 The allocated mount structure is returned in the address specified by
162 The device the root file system was mounted from is specified by the
165 and is recorded in the new mount structure.
167 Sync and unmount all file systems before shutting down.
170 .It Fn vfs_attach "vfs"
171 Establish file system
174 .It Fn vfs_detach "vfs"
178 .It Fn vfs_reinit "void"
179 Reinitialises all file systems within the kernel through file
180 system-specific vfs operation (see
182 .It Fn vfs_getopsbyname "name"
183 Given a file system name specified by
185 look up the vfs operations for that file system (see
189 if file system isn't present in the kernel.
190 .It Fn vfs_suspend "mp" "nowait"
191 Request a mounted file system to suspend all operations.
192 All new operations to the file system are stopped.
193 After all operations in progress have completed, the
194 file system is synced to disk and the function returns.
195 If a file system suspension is currently in progress and
200 If the operation is successful, zero is returned, otherwise an
201 appropriate error code is returned.
202 .It Fn vfs_resume "mp"
203 Request a mounted file system to resume operations.
206 This section describes places within the
208 source tree where actual code implementing or using the vfs
209 operations can be found.
210 All pathnames are relative to
213 The vfs interface functions are implemented within the files
214 .Pa sys/kern/vfs_subr.c
216 .Pa sys/kern/vfs_init.c .