Sat Feb 22 11:08:05 2014 UTC ()
Mark up NULL with Dv.


(wiz)
diff -r1.21 -r1.22 src/share/man/man9/vfssubr.9

cvs diff -r1.21 -r1.22 src/share/man/man9/vfssubr.9 (switch to unified diff)

--- src/share/man/man9/vfssubr.9 2014/02/22 10:05:54 1.21
+++ src/share/man/man9/vfssubr.9 2014/02/22 11:08:05 1.22
@@ -1,237 +1,241 @@ @@ -1,237 +1,241 @@
1.\" $NetBSD: vfssubr.9,v 1.21 2014/02/22 10:05:54 hannken Exp $ 1.\" $NetBSD: vfssubr.9,v 1.22 2014/02/22 11:08:05 wiz 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
15.\" notice, this list of conditions and the following disclaimer in the 15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution. 16.\" documentation and/or other materials provided with the distribution.
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 February 22, 2014 30.Dd February 22, 2014
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 ,
44.Nm vfs_busy , 44.Nm vfs_busy ,
45.Nm vfs_unbusy , 45.Nm vfs_unbusy ,
46.Nm vfs_mountalloc , 46.Nm vfs_mountalloc ,
47.Nm vfs_rootmountalloc , 47.Nm vfs_rootmountalloc ,
48.Nm vfs_shutdown , 48.Nm vfs_shutdown ,
49.Nm vfs_attach , 49.Nm vfs_attach ,
50.Nm vfs_detach , 50.Nm vfs_detach ,
51.Nm vfs_reinit , 51.Nm vfs_reinit ,
52.Nm vfs_getopsbyname , 52.Nm vfs_getopsbyname ,
53.Nm vfs_suspend , 53.Nm vfs_suspend ,
54.Nm vfs_resume 54.Nm vfs_resume
55.Nd high-level interface to kernel file system interface 55.Nd high-level interface to kernel file system interface
56.Sh SYNOPSIS 56.Sh SYNOPSIS
57.In sys/param.h 57.In sys/param.h
58.In sys/mount.h 58.In sys/mount.h
59.In sys/vnode.h 59.In sys/vnode.h
60.Ft void 60.Ft void
61.Fn vfs_getnewfsid "struct mount *mp" 61.Fn vfs_getnewfsid "struct mount *mp"
62.Ft struct mount * 62.Ft struct mount *
63.Fn vfs_getvfs "fsid_t *fsid" 63.Fn vfs_getvfs "fsid_t *fsid"
64.Ft int 64.Ft int
65.Fn vfs_export_lookup "struct mount *mp" "struct netexport *nep" \ 65.Fn vfs_export_lookup "struct mount *mp" "struct netexport *nep" \
66"struct export_args *argp" 66"struct export_args *argp"
67.Ft int 67.Ft int
68.Fn vfs_setpublicfs "struct mount *mp" "struct netexport *nep" \ 68.Fn vfs_setpublicfs "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_mountedon "struct vnode *vp" 71.Fn vfs_mountedon "struct vnode *vp"
72.Ft int 72.Ft int
73.Fn vfs_mountroot "void" 73.Fn vfs_mountroot "void"
74.Ft void 74.Ft void
75.Fn vfs_unmountall "struct lwp *l" 75.Fn vfs_unmountall "struct lwp *l"
76.Ft int 76.Ft int
77.Fn vfs_busy "struct mount *mp" "struct mount **nextp" 77.Fn vfs_busy "struct mount *mp" "struct mount **nextp"
78.Ft void 78.Ft void
79.Fn vfs_unbusy "struct mount *mp" "bool keepref" "struct mount **nextp" 79.Fn vfs_unbusy "struct mount *mp" "bool keepref" "struct mount **nextp"
80.Ft struct mount * 80.Ft struct mount *
81.Fn vfs_mountalloc "struct vfsops *vfs" "struct vnode *vp" 81.Fn vfs_mountalloc "struct vfsops *vfs" "struct vnode *vp"
82.Ft int 82.Ft int
83.Fn vfs_rootmountalloc "char *fstypename" "char *devname" \ 83.Fn vfs_rootmountalloc "char *fstypename" "char *devname" \
84"struct mount **mpp" 84"struct mount **mpp"
85.Ft void 85.Ft void
86.Fn vfs_shutdown "void" 86.Fn vfs_shutdown "void"
87.Ft int 87.Ft int
88.Fn vfs_attach "struct vfsops *vfs" 88.Fn vfs_attach "struct vfsops *vfs"
89.Ft int 89.Ft int
90.Fn vfs_detach "struct vfsops *vfs" 90.Fn vfs_detach "struct vfsops *vfs"
91.Ft void 91.Ft void
92.Fn vfs_reinit "void" 92.Fn vfs_reinit "void"
93.Ft struct vfsops * 93.Ft struct vfsops *
94.Fn vfs_getopsbyname "const char *name" 94.Fn vfs_getopsbyname "const char *name"
95.Ft int 95.Ft int
96.Fn vfs_suspend "struct mount *mp" "int nowait" 96.Fn vfs_suspend "struct mount *mp" "int nowait"
97.Ft void 97.Ft void
98.Fn vfs_resume "struct mount *mp" 98.Fn vfs_resume "struct mount *mp"
99.Sh DESCRIPTION 99.Sh DESCRIPTION
100The high-level functions described in this page are the interface to 100The high-level functions described in this page are the interface to
101the kernel file system interface (VFS). 101the kernel file system interface (VFS).
102.Sh FUNCTIONS 102.Sh FUNCTIONS
103.Bl -tag -width compact 103.Bl -tag -width compact
104.It Fn vfs_getnewfsid "mp" 104.It Fn vfs_getnewfsid "mp"
105Get a new unique file system id type for the file system specified by 105Get a new unique file system id type for the file system specified by
106the mount structure 106the mount structure
107.Fa mp . 107.Fa mp .
108The file system id type is stored in 108The file system id type is stored in
109.Em mp-\*[Gt]mnt_stat.f_fsidx . 109.Em mp-\*[Gt]mnt_stat.f_fsidx .
110.It Fn vfs_getvfs "fsid" 110.It Fn vfs_getvfs "fsid"
111Lookup a mount point with the file system identifier 111Lookup a mount point with the file system identifier
112.Fa fsid . 112.Fa fsid .
113.It Fn vfs_export_lookup "mp" "nep" "argp" 113.It Fn vfs_export_lookup "mp" "nep" "argp"
114Check client permission on the exportable file system specified by the 114Check client permission on the exportable file system specified by the
115mount structure 115mount structure
116.Fa mp . 116.Fa mp .
117The argument 117The argument
118.Fa nam 118.Fa nam
119is the address of the networked client. 119is the address of the networked client.
120This function is used by file system type specific functions to verify 120This function is used by file system type specific functions to verify
121that the client can access the file system. 121that the client can access the file system.
122.It Fn vfs_setpublicfs "mp" "nep" "argp" 122.It Fn vfs_setpublicfs "mp" "nep" "argp"
123Set the publicly exported file system specified by the mount structure 123Set the publicly exported file system specified by the mount structure
124.Fa mp . 124.Fa mp .
125.It Fn vfs_mountedon "vp" 125.It Fn vfs_mountedon "vp"
126Check to see if a file system is mounted on a block device specified 126Check to see if a file system is mounted on a block device specified
127by the vnode 127by the vnode
128.Fa vp . 128.Fa vp .
129.It Fn vfs_mountroot "void" 129.It Fn vfs_mountroot "void"
130Mount the root file system. 130Mount the root file system.
131.It Fn vfs_unmountall "l" 131.It Fn vfs_unmountall "l"
132Unmount all file systems. 132Unmount all file systems.
133.It Fn vfs_busy "mp" "nextp" 133.It Fn vfs_busy "mp" "nextp"
134Mark the mount point specified by 134Mark the mount point specified by
135.Fa mp 135.Fa mp
136as busy and get a reference to it. 136as busy and get a reference to it.
137This function is used to synchronize access and to delay unmounting. 137This function is used to synchronize access and to delay unmounting.
138The caller must hold a pre-existing reference to the mount. 138The caller must hold a pre-existing reference to the mount.
139If 139If
140.Fa nextp 140.Fa nextp
141is not NULL, the caller must hold the 141is not
 142.Dv NULL ,
 143the caller must hold the
142.Em mountlist_lock 144.Em mountlist_lock
143and 145and
144.Fa nextp 146.Fa nextp
145will receive the next mount from mount list on error. 147will receive the next mount from mount list on error.
146The 148The
147.Em mountlist_lock 149.Em mountlist_lock
148is released on return. 150is released on return.
149.It Fn vfs_unbusy "mp" "keepref" "nextp" 151.It Fn vfs_unbusy "mp" "keepref" "nextp"
150Undo a 152Undo a
151.Fn vfs_busy 153.Fn vfs_busy
152on the mount point specified by 154on the mount point specified by
153.Fa mp . 155.Fa mp .
154If 156If
155.Fa keepref 157.Fa keepref
156is true, preserve the reference added by 158is true, preserve the reference added by
157.Fn vfs_busy . 159.Fn vfs_busy .
158If 160If
159.Fa nextp 161.Fa nextp
160is not NULL, the 162is not
 163.Dv NULL ,
 164the
161.Em mountlist_lock 165.Em mountlist_lock
162will be aquired and 166will be aquired and
163.Fa nextp 167.Fa nextp
164will receive the next mount from mount list. 168will receive the next mount from mount list.
165.It Fn vfs_mountalloc "vfsops" "vp" 169.It Fn vfs_mountalloc "vfsops" "vp"
166Allocate and initialise a mount structure, setting 170Allocate and initialise a mount structure, setting
167.Em mnt_vnodecovered 171.Em mnt_vnodecovered
168to 172to
169.Fa vp 173.Fa vp
170and 174and
171.Em mnt_op 175.Em mnt_op
172to 176to
173.Fa vfsops . 177.Fa vfsops .
174On success, mark the mount structure as busy and return its address. 178On success, mark the mount structure as busy and return its address.
175Otherwise, return 179Otherwise, return
176.Dv NULL . 180.Dv NULL .
177.It Fn vfs_rootmountalloc "fstypename" "devname" "mpp" 181.It Fn vfs_rootmountalloc "fstypename" "devname" "mpp"
178Lookup a file system type specified by the name 182Lookup a file system type specified by the name
179.Fa fstypename 183.Fa fstypename
180and if found allocate and initialise a mount structure for it. 184and if found allocate and initialise a mount structure for it.
181The allocated mount structure is returned in the address specified by 185The allocated mount structure is returned in the address specified by
182.Fa mpp . 186.Fa mpp .
183The device the root file system was mounted from is specified by the 187The device the root file system was mounted from is specified by the
184argument 188argument
185.Fa devname 189.Fa devname
186and is recorded in the new mount structure. 190and is recorded in the new mount structure.
187.It Fn vfs_shutdown 191.It Fn vfs_shutdown
188Sync and unmount all file systems before shutting down. 192Sync and unmount all file systems before shutting down.
189Invoked by 193Invoked by
190.Xr cpu_reboot 9 . 194.Xr cpu_reboot 9 .
191.It Fn vfs_attach "vfs" 195.It Fn vfs_attach "vfs"
192Establish file system 196Establish file system
193.Fa vfs 197.Fa vfs
194and initialise it. 198and initialise it.
195.It Fn vfs_detach "vfs" 199.It Fn vfs_detach "vfs"
196Remove file system 200Remove file system
197.Fa vfs 201.Fa vfs
198from the kernel. 202from the kernel.
199.It Fn vfs_reinit "void" 203.It Fn vfs_reinit "void"
200Reinitialises all file systems within the kernel through file 204Reinitialises all file systems within the kernel through file
201system-specific vfs operation (see 205system-specific vfs operation (see
202.Xr vfsops 9 ) . 206.Xr vfsops 9 ) .
203.It Fn vfs_getopsbyname "name" 207.It Fn vfs_getopsbyname "name"
204Given a file system name specified by 208Given a file system name specified by
205.Fa name , 209.Fa name ,
206look up the vfs operations for that file system (see 210look up the vfs operations for that file system (see
207.Xr vfsops 9 ) , 211.Xr vfsops 9 ) ,
208or return 212or return
209.Dv NULL 213.Dv NULL
210if file system isn't present in the kernel. 214if file system isn't present in the kernel.
211.It Fn vfs_suspend "mp" "nowait" 215.It Fn vfs_suspend "mp" "nowait"
212Request a mounted file system to suspend all operations. 216Request a mounted file system to suspend all operations.
213All new operations to the file system are stopped. 217All new operations to the file system are stopped.
214After all operations in progress have completed, the 218After all operations in progress have completed, the
215file system is synced to disk and the function returns. 219file system is synced to disk and the function returns.
216If a file system suspension is currently in progress and 220If a file system suspension is currently in progress and
217.Fa nowait 221.Fa nowait
218is set 222is set
219.Er EWOULDBLOCK 223.Er EWOULDBLOCK
220is returned. 224is returned.
221If the operation is successful, zero is returned, otherwise an 225If the operation is successful, zero is returned, otherwise an
222appropriate error code is returned. 226appropriate error code is returned.
223.It Fn vfs_resume "mp" 227.It Fn vfs_resume "mp"
224Request a mounted file system to resume operations. 228Request a mounted file system to resume operations.
225.El 229.El
226.Sh CODE REFERENCES 230.Sh CODE REFERENCES
227The vfs interface functions are implemented within the files 231The vfs interface functions are implemented within the files
228.Pa sys/kern/vfs_subr.c 232.Pa sys/kern/vfs_subr.c
229and 233and
230.Pa sys/kern/vfs_init.c . 234.Pa sys/kern/vfs_init.c .
231.Sh SEE ALSO 235.Sh SEE ALSO
232.Xr intro 9 , 236.Xr intro 9 ,
233.Xr namei 9 , 237.Xr namei 9 ,
234.Xr vfs 9 , 238.Xr vfs 9 ,
235.Xr vfsops 9 , 239.Xr vfsops 9 ,
236.Xr vnode 9 , 240.Xr vnode 9 ,
237.Xr vnodeops 9 241.Xr vnodeops 9