summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_init.c
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1999-03-07 16:06:41 +0000
committerdfr <dfr@FreeBSD.org>1999-03-07 16:06:41 +0000
commite2549f2539bc2e4543d92ba29f33e4313595b4d4 (patch)
tree6eded32892e2612bae0b1aa330d0d04bb3897997 /sys/kern/vfs_init.c
parent958883fc9634e7d17939c744cd0ad4d0c67e80a7 (diff)
downloadFreeBSD-src-e2549f2539bc2e4543d92ba29f33e4313595b4d4.zip
FreeBSD-src-e2549f2539bc2e4543d92ba29f33e4313595b4d4.tar.gz
* Register sysctl nodes before running sysinits when loading files and
unregister them after sysuninits when unloading. * Add code to vfs_register() to set the oid number of vfs sysctls to the type number of the filesystem. Reviewed by: bde
Diffstat (limited to 'sys/kern/vfs_init.c')
-rw-r--r--sys/kern/vfs_init.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c
index 1cbe2d4..d88deca 100644
--- a/sys/kern/vfs_init.c
+++ b/sys/kern/vfs_init.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_init.c 8.3 (Berkeley) 1/4/94
- * $Id: vfs_init.c,v 1.43 1999/01/28 17:32:00 dillon Exp $
+ * $Id: vfs_init.c,v 1.44 1999/02/16 10:49:49 dfr Exp $
*/
@@ -331,13 +331,14 @@ int
vfs_register(struct vfsconf *vfc)
{
struct linker_set *l;
+ struct sysctl_oid *oidp;
struct vfsconf *vfsp;
vfsp = NULL;
l = &sysctl__vfs;
if (vfsconf)
for (vfsp = vfsconf; vfsp->vfc_next; vfsp = vfsp->vfc_next)
- if (!strcmp(vfc->vfc_name, vfsp->vfc_name))
+ if (strcmp(vfc->vfc_name, vfsp->vfc_name) == 0)
return EEXIST;
vfc->vfc_typenum = maxvfsconf++;
@@ -348,6 +349,24 @@ vfs_register(struct vfsconf *vfc)
vfc->vfc_next = NULL;
/*
+ * If this filesystem has a sysctl node under vfs
+ * (i.e. vfs.xxfs), then change the oid number of that node to
+ * match the filesystem's type number. This allows user code
+ * which uses the type number to read sysctl variables defined
+ * by the filesystem to continue working. Since the oids are
+ * in a sorted list, we need to make sure the order is
+ * preserved by re-registering the oid after modifying its
+ * number.
+ */
+ for (oidp = SLIST_FIRST(&sysctl__vfs_children); oidp;
+ oidp = SLIST_NEXT(oidp, oid_link))
+ if (strcmp(oidp->oid_name, vfc->vfc_name) == 0) {
+ sysctl_unregister_oid(oidp);
+ oidp->oid_number = vfc->vfc_typenum;
+ sysctl_register_oid(oidp);
+ }
+
+ /*
* Call init function for this VFS...
*/
(*(vfc->vfc_vfsops->vfs_init))(vfc);
OpenPOWER on IntegriCloud