| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: vfs_syscalls.c,v 1.403.2.2 2010/04/30 14:44:14 uebayasi Exp $ */ | | 1 | /* $NetBSD: vfs_syscalls.c,v 1.403.2.3 2010/05/31 03:29:43 uebayasi Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -56,27 +56,27 @@ | | | @@ -56,27 +56,27 @@ |
56 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 56 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
57 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 57 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
58 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 58 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
59 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 59 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
63 | * SUCH DAMAGE. | | 63 | * SUCH DAMAGE. |
64 | * | | 64 | * |
65 | * @(#)vfs_syscalls.c 8.42 (Berkeley) 7/31/95 | | 65 | * @(#)vfs_syscalls.c 8.42 (Berkeley) 7/31/95 |
66 | */ | | 66 | */ |
67 | | | 67 | |
68 | #include <sys/cdefs.h> | | 68 | #include <sys/cdefs.h> |
69 | __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.403.2.2 2010/04/30 14:44:14 uebayasi Exp $"); | | 69 | __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.403.2.3 2010/05/31 03:29:43 uebayasi Exp $"); |
70 | | | 70 | |
71 | #ifdef _KERNEL_OPT | | 71 | #ifdef _KERNEL_OPT |
72 | #include "opt_fileassoc.h" | | 72 | #include "opt_fileassoc.h" |
73 | #include "veriexec.h" | | 73 | #include "veriexec.h" |
74 | #endif | | 74 | #endif |
75 | | | 75 | |
76 | #include <sys/param.h> | | 76 | #include <sys/param.h> |
77 | #include <sys/systm.h> | | 77 | #include <sys/systm.h> |
78 | #include <sys/namei.h> | | 78 | #include <sys/namei.h> |
79 | #include <sys/filedesc.h> | | 79 | #include <sys/filedesc.h> |
80 | #include <sys/kernel.h> | | 80 | #include <sys/kernel.h> |
81 | #include <sys/file.h> | | 81 | #include <sys/file.h> |
82 | #include <sys/stat.h> | | 82 | #include <sys/stat.h> |
| @@ -190,32 +190,32 @@ mount_update(struct lwp *l, struct vnode | | | @@ -190,32 +190,32 @@ mount_update(struct lwp *l, struct vnode |
190 | mp->mnt_flag |= flags & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE); | | 190 | mp->mnt_flag |= flags & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE); |
191 | | | 191 | |
192 | /* | | 192 | /* |
193 | * Set the mount level flags. | | 193 | * Set the mount level flags. |
194 | */ | | 194 | */ |
195 | if (flags & MNT_RDONLY) | | 195 | if (flags & MNT_RDONLY) |
196 | mp->mnt_flag |= MNT_RDONLY; | | 196 | mp->mnt_flag |= MNT_RDONLY; |
197 | else if (mp->mnt_flag & MNT_RDONLY) | | 197 | else if (mp->mnt_flag & MNT_RDONLY) |
198 | mp->mnt_iflag |= IMNT_WANTRDWR; | | 198 | mp->mnt_iflag |= IMNT_WANTRDWR; |
199 | mp->mnt_flag &= | | 199 | mp->mnt_flag &= |
200 | ~(MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | | | 200 | ~(MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | |
201 | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP | | | 201 | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP | |
202 | MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP | | | 202 | MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP | |
203 | MNT_LOG | MNT_XIP); | | 203 | MNT_LOG); |
204 | mp->mnt_flag |= flags & | | 204 | mp->mnt_flag |= flags & |
205 | (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | | | 205 | (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | |
206 | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP | | | 206 | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP | |
207 | MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP | | | 207 | MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP | |
208 | MNT_LOG | MNT_XIP | MNT_IGNORE); | | 208 | MNT_LOG | MNT_IGNORE); |
209 | | | 209 | |
210 | error = VFS_MOUNT(mp, path, data, data_len); | | 210 | error = VFS_MOUNT(mp, path, data, data_len); |
211 | | | 211 | |
212 | if (error && data != NULL) { | | 212 | if (error && data != NULL) { |
213 | int error2; | | 213 | int error2; |
214 | | | 214 | |
215 | /* | | 215 | /* |
216 | * Update failed; let's try and see if it was an | | 216 | * Update failed; let's try and see if it was an |
217 | * export request. For compat with 3.0 and earlier. | | 217 | * export request. For compat with 3.0 and earlier. |
218 | */ | | 218 | */ |
219 | error2 = vfs_hooks_reexport(mp, path, data); | | 219 | error2 = vfs_hooks_reexport(mp, path, data); |
220 | | | 220 | |
221 | /* | | 221 | /* |
| @@ -347,27 +347,27 @@ mount_domount(struct lwp *l, struct vnod | | | @@ -347,27 +347,27 @@ mount_domount(struct lwp *l, struct vnod |
347 | | | 347 | |
348 | mp->mnt_stat.f_owner = kauth_cred_geteuid(l->l_cred); | | 348 | mp->mnt_stat.f_owner = kauth_cred_geteuid(l->l_cred); |
349 | | | 349 | |
350 | /* | | 350 | /* |
351 | * The underlying file system may refuse the mount for | | 351 | * The underlying file system may refuse the mount for |
352 | * various reasons. Allow the user to force it to happen. | | 352 | * various reasons. Allow the user to force it to happen. |
353 | * | | 353 | * |
354 | * Set the mount level flags. | | 354 | * Set the mount level flags. |
355 | */ | | 355 | */ |
356 | mp->mnt_flag = flags & | | 356 | mp->mnt_flag = flags & |
357 | (MNT_FORCE | MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | | | 357 | (MNT_FORCE | MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | |
358 | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP | | | 358 | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP | |
359 | MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP | | | 359 | MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP | |
360 | MNT_LOG | MNT_XIP | MNT_IGNORE | MNT_RDONLY); | | 360 | MNT_LOG | MNT_IGNORE | MNT_RDONLY); |
361 | | | 361 | |
362 | mutex_enter(&mp->mnt_updating); | | 362 | mutex_enter(&mp->mnt_updating); |
363 | error = VFS_MOUNT(mp, path, data, data_len); | | 363 | error = VFS_MOUNT(mp, path, data, data_len); |
364 | mp->mnt_flag &= ~MNT_OP_FLAGS; | | 364 | mp->mnt_flag &= ~MNT_OP_FLAGS; |
365 | | | 365 | |
366 | /* | | 366 | /* |
367 | * Put the new filesystem on the mount list after root. | | 367 | * Put the new filesystem on the mount list after root. |
368 | */ | | 368 | */ |
369 | cache_purge(vp); | | 369 | cache_purge(vp); |
370 | if (error != 0) { | | 370 | if (error != 0) { |
371 | vp->v_mountedhere = NULL; | | 371 | vp->v_mountedhere = NULL; |
372 | mutex_exit(&mp->mnt_updating); | | 372 | mutex_exit(&mp->mnt_updating); |
373 | vfs_unbusy(mp, false, NULL); | | 373 | vfs_unbusy(mp, false, NULL); |