summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_lookup.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-10-22 09:32:48 +0000
committerdg <dg@FreeBSD.org>1995-10-22 09:32:48 +0000
commitb5341559e2be008ac6cd1e40a68bdd77a3ec8b63 (patch)
tree67d743dd75dac0605db551f3d4f64632e50167ea /sys/kern/vfs_lookup.c
parent67678134fdc677845e30d947c441374ac61106a6 (diff)
downloadFreeBSD-src-b5341559e2be008ac6cd1e40a68bdd77a3ec8b63.zip
FreeBSD-src-b5341559e2be008ac6cd1e40a68bdd77a3ec8b63.tar.gz
Moved the filesystem read-only check out of the syscalls and into the
filesystem layer, as was done in lite-2. Merged in some other cosmetic changes while I was at it. Rewrote most of msdosfs_access() to be more like ufs_access() and to include the FS read-only check. Obtained from: partially from 4.4BSD-lite2
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r--sys/kern/vfs_lookup.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 35a7a69..0194dd9 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94
- * $Id: vfs_lookup.c,v 1.8 1995/07/31 00:35:46 bde Exp $
+ * $Id: vfs_lookup.c,v 1.9 1995/08/24 10:16:59 dfr Exp $
*/
#include <sys/param.h>
@@ -422,7 +422,7 @@ unionlookup:
* If creating and at end of pathname, then can consider
* allowing file to be created.
*/
- if (rdonly || (ndp->ni_dvp->v_mount->mnt_flag & MNT_RDONLY)) {
+ if (rdonly) {
error = EROFS;
goto bad;
}
@@ -510,19 +510,12 @@ nextname:
goto dirloop;
}
/*
- * Check for read-only file systems.
+ * Disallow directory write attempts on read-only file systems.
*/
- if (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME) {
- /*
- * Disallow directory write attempts on read-only
- * file systems.
- */
- if (rdonly || (dp->v_mount->mnt_flag & MNT_RDONLY) ||
- (wantparent &&
- (ndp->ni_dvp->v_mount->mnt_flag & MNT_RDONLY))) {
- error = EROFS;
- goto bad2;
- }
+ if (rdonly &&
+ (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) {
+ error = EROFS;
+ goto bad2;
}
if (cnp->cn_flags & SAVESTART) {
ndp->ni_startdir = ndp->ni_dvp;
@@ -638,7 +631,7 @@ relookup(dvp, vpp, cnp)
* If creating and at end of pathname, then can consider
* allowing file to be created.
*/
- if (rdonly || (dvp->v_mount->mnt_flag & MNT_RDONLY)) {
+ if (rdonly) {
error = EROFS;
goto bad;
}
@@ -663,19 +656,12 @@ relookup(dvp, vpp, cnp)
#endif
/*
- * Check for read-only file systems.
+ * Disallow directory write attempts on read-only file systems.
*/
- if (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME) {
- /*
- * Disallow directory write attempts on read-only
- * file systems.
- */
- if (rdonly || (dp->v_mount->mnt_flag & MNT_RDONLY) ||
- (wantparent &&
- (dvp->v_mount->mnt_flag & MNT_RDONLY))) {
- error = EROFS;
- goto bad2;
- }
+ if (rdonly &&
+ (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) {
+ error = EROFS;
+ goto bad2;
}
/* ASSERT(dvp == ndp->ni_startdir) */
if (cnp->cn_flags & SAVESTART)
OpenPOWER on IntegriCloud