Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src convert "magiclinks" from a per-fs mount option to a system-...
details: https://anonhg.NetBSD.org/src/rev/81343605d1f1
branches: trunk
changeset: 588218:81343605d1f1
user: chs <chs%NetBSD.org@localhost>
date: Sun Feb 12 01:32:06 2006 +0000
description:
convert "magiclinks" from a per-fs mount option to a system-wide sysctl.
as discussed on tech-kern quite some time ago.
diffstat:
include/mntopts.h | 6 ++----
lib/libc/sys/mount.2 | 14 ++------------
sbin/mount/mount.8 | 14 ++------------
share/man/man4/options.4 | 12 ++++++------
sys/conf/files | 4 ++--
sys/kern/init_main.c | 8 ++------
sys/kern/vfs_lookup.c | 13 ++++++++++---
sys/kern/vfs_subr.c | 11 +++++++++--
sys/kern/vfs_syscalls.c | 9 ++++-----
sys/sys/fstypes.h | 24 +++++++++++-------------
sys/sys/statvfs.h | 3 +--
11 files changed, 51 insertions(+), 67 deletions(-)
diffs (truncated from 390 to 300 lines):
diff -r 035de620f805 -r 81343605d1f1 include/mntopts.h
--- a/include/mntopts.h Sun Feb 12 01:18:05 2006 +0000
+++ b/include/mntopts.h Sun Feb 12 01:32:06 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mntopts.h,v 1.6 2005/06/23 00:30:29 thorpej Exp $ */
+/* $NetBSD: mntopts.h,v 1.7 2006/02/12 01:32:06 chs Exp $ */
/*-
* Copyright (c) 1994
@@ -56,7 +56,6 @@
#define MOPT_SYMPERM { "symperm", 0, MNT_SYMPERM, 0 }
#define MOPT_SOFTDEP { "softdep", 0, MNT_SOFTDEP, 0 }
#define MOPT_IGNORE { "hidden", 0, MNT_IGNORE, 0 }
-#define MOPT_MAGICLINKS { "magiclinks", 0, MNT_MAGICLINKS, 0 }
/* Control flags. */
#define MOPT_FORCE { "force", 0, MNT_FORCE, 0 }
@@ -88,8 +87,7 @@
MOPT_RDONLY, \
MOPT_UNION, \
MOPT_IGNORE, \
- MOPT_SYMPERM, \
- MOPT_MAGICLINKS
+ MOPT_SYMPERM
__BEGIN_DECLS
typedef struct mntoptparse *mntoptparse_t;
diff -r 035de620f805 -r 81343605d1f1 lib/libc/sys/mount.2
--- a/lib/libc/sys/mount.2 Sun Feb 12 01:18:05 2006 +0000
+++ b/lib/libc/sys/mount.2 Sun Feb 12 01:32:06 2006 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: mount.2,v 1.34 2005/08/05 13:21:13 jmmv Exp $
+.\" $NetBSD: mount.2,v 1.35 2006/02/12 01:32:06 chs Exp $
.\"
.\" Copyright (c) 1980, 1989, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)mount.2 8.3 (Berkeley) 5/24/95
.\"
-.Dd June 22, 2005
+.Dd February 11, 2006
.Dt MOUNT 2
.Os
.Sh NAME
@@ -76,16 +76,6 @@
may be specified to
suppress default semantics which affect file system access.
.Bl -tag -width MNT_SYNCHRONOUS
-.It Dv MNT_MAGICLINKS
-Expand special strings
-.Po
-beginning with
-.Dq @
-.Pc
-when traversing symbolic links.
-See
-.Xr symlink 7
-for a list of supported strings.
.It Dv MNT_RDONLY
The file system should be treated as read-only;
even the super-user may not write on it.
diff -r 035de620f805 -r 81343605d1f1 sbin/mount/mount.8
--- a/sbin/mount/mount.8 Sun Feb 12 01:18:05 2006 +0000
+++ b/sbin/mount/mount.8 Sun Feb 12 01:32:06 2006 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: mount.8,v 1.51 2006/02/03 22:50:21 riz Exp $
+.\" $NetBSD: mount.8,v 1.52 2006/02/12 01:32:06 chs Exp $
.\"
.\" Copyright (c) 1980, 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)mount.8 8.8 (Berkeley) 6/16/94
.\"
-.Dd February 3, 2006
+.Dd February 11, 2006
.Dt MOUNT 8
.Os
.Sh NAME
@@ -171,16 +171,6 @@
causes the mount point to be excluded from the
list of file systems shown by default with
.Xr df 1 .
-.It Cm magiclinks
-Expand special strings
-.Po
-beginning with
-.Dq @
-.Pc
-when traversing symbolic links.
-See
-.Xr symlink 7
-for a list of supported strings.
.It Cm noatime
Never update the access time field for files.
This option is useful for optimizing read performance on file systems
diff -r 035de620f805 -r 81343605d1f1 share/man/man4/options.4
--- a/share/man/man4/options.4 Sun Feb 12 01:18:05 2006 +0000
+++ b/share/man/man4/options.4 Sun Feb 12 01:32:06 2006 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: options.4,v 1.315 2006/02/11 18:45:01 ross Exp $
+.\" $NetBSD: options.4,v 1.316 2006/02/12 01:32:06 chs Exp $
.\"
.\" Copyright (c) 1996
.\" Perry E. Metzger. All rights reserved.
@@ -916,20 +916,20 @@
.El
.Ss File System Options
.Bl -ohang
-.It Cd options ROOTFS_MAGICLINKS
+.It Cd options MAGICLINKS
Enables the expansion of special strings
.Po
beginning with
.Dq @
.Pc
-when traversing symbolic links on the root file system.
+when traversing symbolic links.
See
.Xr symlink 7
for a list of supported strings.
-Note that this option only controls the enabling of this feature when
-the root file system is first mounted by the kernel at boot-up.
+Note that this option only controls the enabling of this feature
+by the kernel at boot-up.
This feature can still be manipulated with the
-.Xr mount 8
+.Xr sysctl 8
command regardless of the setting of this option.
.It Cd options NFSSERVER
Include the server side of the
diff -r 035de620f805 -r 81343605d1f1 sys/conf/files
--- a/sys/conf/files Sun Feb 12 01:18:05 2006 +0000
+++ b/sys/conf/files Sun Feb 12 01:32:06 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.758 2006/02/09 19:18:57 manu Exp $
+# $NetBSD: files,v 1.759 2006/02/12 01:32:06 chs Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -168,7 +168,7 @@
defflag SOFTDEP # XXX files.ufs?
defflag QUOTA # XXX files.ufs?
defflag VNODE_LOCKDEBUG
-defflag ROOTFS_MAGICLINKS
+defflag MAGICLINKS
# buffer cache size options
#
diff -r 035de620f805 -r 81343605d1f1 sys/kern/init_main.c
--- a/sys/kern/init_main.c Sun Feb 12 01:18:05 2006 +0000
+++ b/sys/kern/init_main.c Sun Feb 12 01:32:06 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init_main.c,v 1.261 2005/12/24 19:12:23 perry Exp $ */
+/* $NetBSD: init_main.c,v 1.262 2006/02/12 01:32:06 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.261 2005/12/24 19:12:23 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.262 2006/02/12 01:32:06 chs Exp $");
#include "opt_ipsec.h"
#include "opt_sysv.h"
@@ -82,7 +82,6 @@
#include "opt_systrace.h"
#include "opt_posix.h"
#include "opt_kcont.h"
-#include "opt_rootfs_magiclinks.h"
#include "opt_verified_exec.h"
#include "rnd.h"
@@ -416,9 +415,6 @@
inittodr(rootfstime);
CIRCLEQ_FIRST(&mountlist)->mnt_flag |= MNT_ROOTFS;
-#ifdef ROOTFS_MAGICLINKS
- CIRCLEQ_FIRST(&mountlist)->mnt_flag |= MNT_MAGICLINKS;
-#endif
CIRCLEQ_FIRST(&mountlist)->mnt_op->vfs_refcount++;
/*
diff -r 035de620f805 -r 81343605d1f1 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c Sun Feb 12 01:18:05 2006 +0000
+++ b/sys/kern/vfs_lookup.c Sun Feb 12 01:32:06 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_lookup.c,v 1.66 2006/02/04 12:09:50 yamt Exp $ */
+/* $NetBSD: vfs_lookup.c,v 1.67 2006/02/12 01:32:06 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -37,10 +37,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.66 2006/02/04 12:09:50 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.67 2006/02/12 01:32:06 chs Exp $");
#include "opt_ktrace.h"
#include "opt_systrace.h"
+#include "opt_magiclinks.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -64,6 +65,12 @@
#include <sys/systrace.h>
#endif
+#ifndef MAGICLINKS
+#define MAGICLINKS 0
+#endif
+
+int vfs_magiclinks = MAGICLINKS;
+
struct pool pnbuf_pool; /* pathname buffer pool */
struct pool_cache pnbuf_cache; /* pathname buffer cache */
@@ -332,7 +339,7 @@
* Do symlink substitution, if appropriate, and
* check length for potential overflow.
*/
- if (((ndp->ni_vp->v_mount->mnt_flag & MNT_MAGICLINKS) &&
+ if ((vfs_magiclinks &&
symlink_magic(cnp->cn_lwp->l_proc, cp, &linklen)) ||
(linklen + ndp->ni_pathlen >= MAXPATHLEN)) {
error = ENAMETOOLONG;
diff -r 035de620f805 -r 81343605d1f1 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c Sun Feb 12 01:18:05 2006 +0000
+++ b/sys/kern/vfs_subr.c Sun Feb 12 01:32:06 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_subr.c,v 1.262 2006/02/04 12:01:26 yamt Exp $ */
+/* $NetBSD: vfs_subr.c,v 1.263 2006/02/12 01:32:06 chs Exp $ */
/*-
* Copyright (c) 1997, 1998, 2004, 2005 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.262 2006/02/04 12:01:26 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.263 2006/02/12 01:32:06 chs Exp $");
#include "opt_inet.h"
#include "opt_ddb.h"
@@ -130,6 +130,7 @@
int prtactive = 0; /* 1 => print out reclaim of active vnodes */
extern int dovfsusermount; /* 1 => permit any user to mount filesystems */
+extern int vfs_magiclinks; /* 1 => expand "magic" symlinks */
/*
* Insq/Remq for the vnode usage lists.
@@ -1970,6 +1971,12 @@
SYSCTL_DESCR("List of file systems present"),
sysctl_vfs_generic_fstypes, 0, NULL, 0,
CTL_VFS, VFS_GENERIC, CTL_CREATE, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "magiclinks",
+ SYSCTL_DESCR("Whether \"magic\" symlinks are expanded"),
+ NULL, 0, &vfs_magiclinks, 0,
+ CTL_VFS, VFS_GENERIC, VFS_MAGICLINKS, CTL_EOL);
}
diff -r 035de620f805 -r 81343605d1f1 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c Sun Feb 12 01:18:05 2006 +0000
+++ b/sys/kern/vfs_syscalls.c Sun Feb 12 01:32:06 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls.c,v 1.236 2006/02/04 12:09:50 yamt Exp $ */
+/* $NetBSD: vfs_syscalls.c,v 1.237 2006/02/12 01:32:06 chs Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.236 2006/02/04 12:09:50 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.237 2006/02/12 01:32:06 chs Exp $");
#include "opt_compat_netbsd.h"
#include "opt_compat_43.h"
@@ -340,13 +340,12 @@
mp->mnt_flag &=
~(MNT_NOSUID | MNT_NOEXEC | MNT_NODEV |
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP |
- MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP |
- MNT_MAGICLINKS);
+ MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP);
mp->mnt_flag |= SCARG(uap, flags) &
(MNT_NOSUID | MNT_NOEXEC | MNT_NODEV |
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP |
MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP |
- MNT_IGNORE | MNT_MAGICLINKS);
+ MNT_IGNORE);
Home |
Main Index |
Thread Index |
Old Index