Mon Apr 17 08:33:40 2017 UTC ()
Update vfs_busy(), vfs_unbusy(), vfs_mountalloc() and vfs_rootmountalloc().


(hannken)
diff -r1.25 -r1.26 src/share/man/man9/vfssubr.9

cvs diff -r1.25 -r1.26 src/share/man/man9/vfssubr.9 (expand / switch to unified diff)

--- src/share/man/man9/vfssubr.9 2014/05/24 17:14:02 1.25
+++ src/share/man/man9/vfssubr.9 2017/04/17 08:33:40 1.26
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: vfssubr.9,v 1.25 2014/05/24 17:14:02 wiz Exp $ 1.\" $NetBSD: vfssubr.9,v 1.26 2017/04/17 08:33:40 hannken Exp $
2.\" 2.\"
3.\" Copyright (c) 2003, 2005, 2006 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2003, 2005, 2006 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Gregory McGarry. 7.\" by Gregory McGarry.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17.\" 17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 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 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 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 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 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 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 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE. 28.\" POSSIBILITY OF SUCH DAMAGE.
29.\" 29.\"
30.Dd May 24, 2014 30.Dd Apr 17, 2017
31.Dt VFSSUBR 9 31.Dt VFSSUBR 9
32.Os 32.Os
33.Sh NAME 33.Sh NAME
34.Nm vfssubr , 34.Nm vfssubr ,
35.Nm vfs_getnewfsid , 35.Nm vfs_getnewfsid ,
36.Nm vfs_getvfs , 36.Nm vfs_getvfs ,
37.Nm vfs_export , 37.Nm vfs_export ,
38.Nm vfs_showexport , 38.Nm vfs_showexport ,
39.Nm vfs_export_lookup , 39.Nm vfs_export_lookup ,
40.Nm vfs_setpublicfs , 40.Nm vfs_setpublicfs ,
41.Nm vfs_mountedon , 41.Nm vfs_mountedon ,
42.Nm vfs_mountroot , 42.Nm vfs_mountroot ,
43.Nm vfs_unmountall , 43.Nm vfs_unmountall ,
@@ -67,29 +67,29 @@ @@ -67,29 +67,29 @@
67.Ft int 67.Ft int
68.Fn vfs_export_lookup "struct mount *mp" "struct netexport *nep" \ 68.Fn vfs_export_lookup "struct mount *mp" "struct netexport *nep" \
69"struct export_args *argp" 69"struct export_args *argp"
70.Ft int 70.Ft int
71.Fn vfs_setpublicfs "struct mount *mp" "struct netexport *nep" \ 71.Fn vfs_setpublicfs "struct mount *mp" "struct netexport *nep" \
72"struct export_args *argp" 72"struct export_args *argp"
73.Ft int 73.Ft int
74.Fn vfs_mountedon "struct vnode *vp" 74.Fn vfs_mountedon "struct vnode *vp"
75.Ft int 75.Ft int
76.Fn vfs_mountroot "void" 76.Fn vfs_mountroot "void"
77.Ft void 77.Ft void
78.Fn vfs_unmountall "struct lwp *l" 78.Fn vfs_unmountall "struct lwp *l"
79.Ft int 79.Ft int
80.Fn vfs_busy "struct mount *mp" "struct mount **nextp" 80.Fn vfs_busy "struct mount *mp"
81.Ft void 81.Ft void
82.Fn vfs_unbusy "struct mount *mp" "bool keepref" "struct mount **nextp" 82.Fn vfs_unbusy "struct mount *mp"
83.Ft struct mount * 83.Ft struct mount *
84.Fn vfs_mountalloc "struct vfsops *vfs" "struct vnode *vp" 84.Fn vfs_mountalloc "struct vfsops *vfs" "struct vnode *vp"
85.Ft int 85.Ft int
86.Fn vfs_rootmountalloc "char *fstypename" "char *devname" \ 86.Fn vfs_rootmountalloc "char *fstypename" "char *devname" \
87"struct mount **mpp" 87"struct mount **mpp"
88.Ft void 88.Ft void
89.Fn vfs_shutdown "void" 89.Fn vfs_shutdown "void"
90.Ft int 90.Ft int
91.Fn vfs_attach "struct vfsops *vfs" 91.Fn vfs_attach "struct vfsops *vfs"
92.Ft int 92.Ft int
93.Fn vfs_detach "struct vfsops *vfs" 93.Fn vfs_detach "struct vfsops *vfs"
94.Ft void 94.Ft void
95.Fn vfs_reinit "void" 95.Fn vfs_reinit "void"
@@ -129,79 +129,55 @@ is the address of the networked client. @@ -129,79 +129,55 @@ is the address of the networked client.
129This function is used by file system type specific functions to verify 129This function is used by file system type specific functions to verify
130that the client can access the file system. 130that the client can access the file system.
131.It Fn vfs_setpublicfs "mp" "nep" "argp" 131.It Fn vfs_setpublicfs "mp" "nep" "argp"
132Set the publicly exported file system specified by the mount structure 132Set the publicly exported file system specified by the mount structure
133.Fa mp . 133.Fa mp .
134.It Fn vfs_mountedon "vp" 134.It Fn vfs_mountedon "vp"
135Check to see if a file system is mounted on a block device specified 135Check to see if a file system is mounted on a block device specified
136by the vnode 136by the vnode
137.Fa vp . 137.Fa vp .
138.It Fn vfs_mountroot "void" 138.It Fn vfs_mountroot "void"
139Mount the root file system. 139Mount the root file system.
140.It Fn vfs_unmountall "l" 140.It Fn vfs_unmountall "l"
141Unmount all file systems. 141Unmount all file systems.
142.It Fn vfs_busy "mp" "nextp" 142.It Fn vfs_busy "mp"
143Mark the mount point specified by 143Mark the mount point specified by
144.Fa mp 144.Fa mp
145as busy and get a reference to it. 145as busy and get a reference to it.
146This function is used to synchronize access and to delay unmounting. 146This function is used to synchronize access and to delay unmounting.
147The caller must hold a pre-existing reference to the mount. 147The caller must hold a pre-existing reference to the mount.
148If 148.It Fn vfs_unbusy "mp"
149.Fa nextp 
150is not 
151.Dv NULL , 
152the caller must hold the 
153.Em mountlist_lock 
154and 
155.Fa nextp 
156will receive the next mount from mount list on error. 
157The 
158.Em mountlist_lock 
159is released on return. 
160.It Fn vfs_unbusy "mp" "keepref" "nextp" 
161Undo a 149Undo a
162.Fn vfs_busy 150.Fn vfs_busy
163on the mount point specified by 151on the mount point specified by
164.Fa mp . 152.Fa mp .
165If 
166.Fa keepref 
167is true, preserve the reference added by 
168.Fn vfs_busy . 
169If 
170.Fa nextp 
171is not 
172.Dv NULL , 
173the 
174.Em mountlist_lock 
175will be aquired and 
176.Fa nextp 
177will receive the next mount from mount list. 
178.It Fn vfs_mountalloc "vfsops" "vp" 153.It Fn vfs_mountalloc "vfsops" "vp"
179Allocate and initialise a mount structure, setting 154Allocate and initialise a mount structure, setting
180.Em mnt_vnodecovered 155.Em mnt_vnodecovered
181to 156to
182.Fa vp 157.Fa vp
183and 158and
184.Em mnt_op 159.Em mnt_op
185to 160to
186.Fa vfsops . 161.Fa vfsops .
187On success, mark the mount structure as busy and return its address. 162On success return the address of the mount structure.
188Otherwise, return 163Otherwise, return
189.Dv NULL . 164.Dv NULL .
190.It Fn vfs_rootmountalloc "fstypename" "devname" "mpp" 165.It Fn vfs_rootmountalloc "fstypename" "devname" "mpp"
191Lookup a file system type specified by the name 166Lookup a file system type specified by the name
192.Fa fstypename 167.Fa fstypename
193and if found allocate and initialise a mount structure for it. 168and if found allocate and initialise a mount structure for it.
194The allocated mount structure is returned in the address specified by 169The allocated mount structure is marked as busy and returned in the
 170address specified by
195.Fa mpp . 171.Fa mpp .
196The device the root file system was mounted from is specified by the 172The device the root file system was mounted from is specified by the
197argument 173argument
198.Fa devname 174.Fa devname
199and is recorded in the new mount structure. 175and is recorded in the new mount structure.
200.It Fn vfs_shutdown 176.It Fn vfs_shutdown
201Sync and unmount all file systems before shutting down. 177Sync and unmount all file systems before shutting down.
202Invoked by 178Invoked by
203.Xr cpu_reboot 9 . 179.Xr cpu_reboot 9 .
204.It Fn vfs_attach "vfs" 180.It Fn vfs_attach "vfs"
205Establish file system 181Establish file system
206.Fa vfs 182.Fa vfs
207and initialise it. 183and initialise it.