Module Name: src
Committed By: pgoyette
Date: Mon Mar 16 21:20:13 UTC 2020
Modified Files:
src/sys/compat/linux/common: linux_mod.c linux_sysctl.c linux_sysctl.h
src/sys/compat/linux32/common: linux32_mod.c linux32_sysctl.c
linux32_sysctl.h
src/sys/dev/acpi: acpi_cpu.c
src/sys/dev/pci: ubsec.c
src/sys/dev/sysmon: swsensor.c swwdog.c
src/sys/fs/adosfs: advfsops.c
src/sys/fs/autofs: autofs_vfsops.c
src/sys/fs/cd9660: cd9660_vfsops.c
src/sys/fs/filecorefs: filecore_vfsops.c
src/sys/fs/msdosfs: msdosfs_vfsops.c
src/sys/fs/nilfs: nilfs_vfsops.c
src/sys/fs/ptyfs: ptyfs_vfsops.c
src/sys/fs/smbfs: smbfs_vfsops.c
src/sys/fs/udf: udf_vfsops.c
src/sys/fs/union: union_vfsops.c
src/sys/kern: sys_aio.c sys_mqueue.c vfs_wapbl.c
src/sys/miscfs/fdesc: fdesc_vfsops.c
src/sys/miscfs/kernfs: kernfs_vfsops.c
src/sys/miscfs/nullfs: null_vfsops.c
src/sys/miscfs/overlay: overlay_vfsops.c
src/sys/miscfs/procfs: procfs_vfsops.c
src/sys/miscfs/umapfs: umap_vfsops.c
src/sys/net: bpf.c
src/sys/netinet: accf_http.c
src/sys/nfs: nfs_vfsops.c
src/sys/opencrypto: crypto.c
src/sys/secmodel/bsd44: bsd44.h secmodel_bsd44.c
src/sys/secmodel/extensions: secmodel_extensions.c
src/sys/secmodel/overlay: secmodel_overlay.c
src/sys/secmodel/securelevel: secmodel_securelevel.c securelevel.h
src/sys/secmodel/suser: secmodel_suser.c suser.h
src/sys/ufs/ext2fs: ext2fs_vfsops.c
src/sys/ufs/ffs: ffs_vfsops.c
src/sys/ufs/lfs: lfs_vfsops.c
src/sys/ufs/mfs: mfs_vfsops.c
src/sys/ufs/ufs: ufs_dirhash.c
Log Message:
Use the module subsystem's ability to process SYSCTL_SETUP() entries to
automate installation of sysctl nodes.
Note that there are still a number of device and pseudo-device modules
that create entries tied to individual device units, rather than to the
module itself. These are not changed.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/compat/linux/common/linux_mod.c
cvs rdiff -u -r1.44 -r1.45 src/sys/compat/linux/common/linux_sysctl.c
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/linux/common/linux_sysctl.h
cvs rdiff -u -r1.12 -r1.13 src/sys/compat/linux32/common/linux32_mod.c
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/linux32/common/linux32_sysctl.c
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/linux32/common/linux32_sysctl.h
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/acpi/acpi_cpu.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pci/ubsec.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/sysmon/swsensor.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/sysmon/swwdog.c
cvs rdiff -u -r1.78 -r1.79 src/sys/fs/adosfs/advfsops.c
cvs rdiff -u -r1.9 -r1.10 src/sys/fs/autofs/autofs_vfsops.c
cvs rdiff -u -r1.94 -r1.95 src/sys/fs/cd9660/cd9660_vfsops.c
cvs rdiff -u -r1.82 -r1.83 src/sys/fs/filecorefs/filecore_vfsops.c
cvs rdiff -u -r1.132 -r1.133 src/sys/fs/msdosfs/msdosfs_vfsops.c
cvs rdiff -u -r1.25 -r1.26 src/sys/fs/nilfs/nilfs_vfsops.c
cvs rdiff -u -r1.57 -r1.58 src/sys/fs/ptyfs/ptyfs_vfsops.c
cvs rdiff -u -r1.108 -r1.109 src/sys/fs/smbfs/smbfs_vfsops.c
cvs rdiff -u -r1.77 -r1.78 src/sys/fs/udf/udf_vfsops.c
cvs rdiff -u -r1.80 -r1.81 src/sys/fs/union/union_vfsops.c
cvs rdiff -u -r1.46 -r1.47 src/sys/kern/sys_aio.c
cvs rdiff -u -r1.45 -r1.46 src/sys/kern/sys_mqueue.c
cvs rdiff -u -r1.105 -r1.106 src/sys/kern/vfs_wapbl.c
cvs rdiff -u -r1.93 -r1.94 src/sys/miscfs/fdesc/fdesc_vfsops.c
cvs rdiff -u -r1.98 -r1.99 src/sys/miscfs/kernfs/kernfs_vfsops.c
cvs rdiff -u -r1.96 -r1.97 src/sys/miscfs/nullfs/null_vfsops.c
cvs rdiff -u -r1.68 -r1.69 src/sys/miscfs/overlay/overlay_vfsops.c
cvs rdiff -u -r1.102 -r1.103 src/sys/miscfs/procfs/procfs_vfsops.c
cvs rdiff -u -r1.101 -r1.102 src/sys/miscfs/umapfs/umap_vfsops.c
cvs rdiff -u -r1.235 -r1.236 src/sys/net/bpf.c
cvs rdiff -u -r1.9 -r1.10 src/sys/netinet/accf_http.c
cvs rdiff -u -r1.239 -r1.240 src/sys/nfs/nfs_vfsops.c
cvs rdiff -u -r1.112 -r1.113 src/sys/opencrypto/crypto.c
cvs rdiff -u -r1.6 -r1.7 src/sys/secmodel/bsd44/bsd44.h
cvs rdiff -u -r1.16 -r1.17 src/sys/secmodel/bsd44/secmodel_bsd44.c
cvs rdiff -u -r1.11 -r1.12 src/sys/secmodel/extensions/secmodel_extensions.c
cvs rdiff -u -r1.13 -r1.14 src/sys/secmodel/overlay/secmodel_overlay.c
cvs rdiff -u -r1.33 -r1.34 \
src/sys/secmodel/securelevel/secmodel_securelevel.c
cvs rdiff -u -r1.4 -r1.5 src/sys/secmodel/securelevel/securelevel.h
cvs rdiff -u -r1.51 -r1.52 src/sys/secmodel/suser/secmodel_suser.c
cvs rdiff -u -r1.2 -r1.3 src/sys/secmodel/suser/suser.h
cvs rdiff -u -r1.216 -r1.217 src/sys/ufs/ext2fs/ext2fs_vfsops.c
cvs rdiff -u -r1.365 -r1.366 src/sys/ufs/ffs/ffs_vfsops.c
cvs rdiff -u -r1.376 -r1.377 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.113 -r1.114 src/sys/ufs/mfs/mfs_vfsops.c
cvs rdiff -u -r1.39 -r1.40 src/sys/ufs/ufs/ufs_dirhash.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/compat/linux/common/linux_mod.c
diff -u src/sys/compat/linux/common/linux_mod.c:1.11 src/sys/compat/linux/common/linux_mod.c:1.12
--- src/sys/compat/linux/common/linux_mod.c:1.11 Sun Jan 27 02:08:40 2019
+++ src/sys/compat/linux/common/linux_mod.c Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_mod.c,v 1.11 2019/01/27 02:08:40 pgoyette Exp $ */
+/* $NetBSD: linux_mod.c,v 1.12 2020/03/16 21:20:09 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.11 2019/01/27 02:08:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.12 2020/03/16 21:20:09 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_execfmt.h"
@@ -164,17 +164,13 @@ compat_linux_modcmd(modcmd_t cmd, void *
switch (cmd) {
case MODULE_CMD_INIT:
linux_futex_init();
- linux_sysctl_init();
error = exec_add(linux_execsw, __arraycount(linux_execsw));
- if (error != 0)
- linux_sysctl_fini();
return error;
case MODULE_CMD_FINI:
error = exec_remove(linux_execsw, __arraycount(linux_execsw));
if (error)
return error;
- linux_sysctl_fini();
linux_futex_fini();
return 0;
Index: src/sys/compat/linux/common/linux_sysctl.c
diff -u src/sys/compat/linux/common/linux_sysctl.c:1.44 src/sys/compat/linux/common/linux_sysctl.c:1.45
--- src/sys/compat/linux/common/linux_sysctl.c:1.44 Fri Sep 29 17:08:00 2017
+++ src/sys/compat/linux/common/linux_sysctl.c Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_sysctl.c,v 1.44 2017/09/29 17:08:00 maxv Exp $ */
+/* $NetBSD: linux_sysctl.c,v 1.45 2020/03/16 21:20:09 pgoyette Exp $ */
/*-
* Copyright (c) 2003, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.44 2017/09/29 17:08:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.45 2020/03/16 21:20:09 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -68,73 +68,61 @@ struct sysctlnode linux_sysctl_root = {
.sysctl_size = sizeof(struct sysctlnode),
};
-static struct sysctllog *linux_clog1;
-static struct sysctllog *linux_clog2;
extern int linux_enabled;
-void
-linux_sysctl_fini(void)
-{
-
- sysctl_teardown(&linux_clog2);
- sysctl_teardown(&linux_clog1);
- sysctl_free(&linux_sysctl_root);
-}
-
-void
-linux_sysctl_init(void)
+SYSCTL_SETUP(linux_sysctl_setup, "linux emulation sysctls")
{
const struct sysctlnode *node = &linux_sysctl_root;
- sysctl_createv(&linux_clog1, 0, &node, &node,
+ sysctl_createv(clog, 0, &node, &node,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "kern", NULL,
NULL, 0, NULL, 0,
LINUX_CTL_KERN, CTL_EOL);
- sysctl_createv(&linux_clog1, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "ostype", NULL,
NULL, 0, linux_sysname, sizeof(linux_sysname),
LINUX_KERN_OSTYPE, CTL_EOL);
- sysctl_createv(&linux_clog1, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "osrelease", NULL,
NULL, 0, linux_release, sizeof(linux_release),
LINUX_KERN_OSRELEASE, CTL_EOL);
- sysctl_createv(&linux_clog1, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "version", NULL,
NULL, 0, linux_version, sizeof(linux_version),
LINUX_KERN_VERSION, CTL_EOL);
- sysctl_createv(&linux_clog2, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "linux",
SYSCTL_DESCR("Linux emulation settings"),
NULL, 0, NULL, 0,
CTL_EMUL, EMUL_LINUX, CTL_EOL);
- sysctl_createv(&linux_clog2, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "kern",
SYSCTL_DESCR("Linux kernel emulation settings"),
NULL, 0, NULL, 0,
CTL_EMUL, EMUL_LINUX, EMUL_LINUX_KERN, CTL_EOL);
- sysctl_createv(&linux_clog2, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "ostype",
SYSCTL_DESCR("Linux operating system type"),
NULL, 0, linux_sysname, sizeof(linux_sysname),
CTL_EMUL, EMUL_LINUX, EMUL_LINUX_KERN,
EMUL_LINUX_KERN_OSTYPE, CTL_EOL);
- sysctl_createv(&linux_clog2, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "osrelease",
SYSCTL_DESCR("Linux operating system release"),
NULL, 0, linux_release, sizeof(linux_release),
CTL_EMUL, EMUL_LINUX, EMUL_LINUX_KERN,
EMUL_LINUX_KERN_OSRELEASE, CTL_EOL);
- sysctl_createv(&linux_clog2, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "osversion",
SYSCTL_DESCR("Linux operating system revision"),
@@ -142,7 +130,7 @@ linux_sysctl_init(void)
CTL_EMUL, EMUL_LINUX, EMUL_LINUX_KERN,
EMUL_LINUX_KERN_VERSION, CTL_EOL);
- sysctl_createv(&linux_clog2, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_READWRITE,
CTLTYPE_INT, "enabled",
SYSCTL_DESCR("Linux compat enabled."),
Index: src/sys/compat/linux/common/linux_sysctl.h
diff -u src/sys/compat/linux/common/linux_sysctl.h:1.6 src/sys/compat/linux/common/linux_sysctl.h:1.7
--- src/sys/compat/linux/common/linux_sysctl.h:1.6 Fri Sep 29 17:08:00 2017
+++ src/sys/compat/linux/common/linux_sysctl.h Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_sysctl.h,v 1.6 2017/09/29 17:08:00 maxv Exp $ */
+/* $NetBSD: linux_sysctl.h,v 1.7 2020/03/16 21:20:09 pgoyette Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -466,9 +466,6 @@
#define LINUX_BUS_ISA_PORT_BASE 2
#define LINUX_BUS_ISA_PORT_SHIFT 3
-void linux_sysctl_init(void);
-void linux_sysctl_fini(void);
-
int linux_sysctl_enable(SYSCTLFN_PROTO);
#endif /* !_LINUX_SYSCTL_H */
Index: src/sys/compat/linux32/common/linux32_mod.c
diff -u src/sys/compat/linux32/common/linux32_mod.c:1.12 src/sys/compat/linux32/common/linux32_mod.c:1.13
--- src/sys/compat/linux32/common/linux32_mod.c:1.12 Sun Jan 27 02:08:40 2019
+++ src/sys/compat/linux32/common/linux32_mod.c Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_mod.c,v 1.12 2019/01/27 02:08:40 pgoyette Exp $ */
+/* $NetBSD: linux32_mod.c,v 1.13 2020/03/16 21:20:09 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.12 2019/01/27 02:08:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.13 2020/03/16 21:20:09 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_execfmt.h"
@@ -124,10 +124,7 @@ compat_linux32_modcmd(modcmd_t cmd, void
switch (cmd) {
case MODULE_CMD_INIT:
- linux32_sysctl_init();
error = exec_add(linux32_execsw, __arraycount(linux32_execsw));
- if (error != 0)
- linux32_sysctl_fini();
return error;
case MODULE_CMD_FINI:
@@ -135,7 +132,6 @@ compat_linux32_modcmd(modcmd_t cmd, void
exec_remove(linux32_execsw, __arraycount(linux32_execsw));
if (error)
return error;
- linux32_sysctl_fini();
return 0;
default:
Index: src/sys/compat/linux32/common/linux32_sysctl.c
diff -u src/sys/compat/linux32/common/linux32_sysctl.c:1.17 src/sys/compat/linux32/common/linux32_sysctl.c:1.18
--- src/sys/compat/linux32/common/linux32_sysctl.c:1.17 Fri Sep 29 17:47:29 2017
+++ src/sys/compat/linux32/common/linux32_sysctl.c Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_sysctl.c,v 1.17 2017/09/29 17:47:29 maxv Exp $ */
+/* $NetBSD: linux32_sysctl.c,v 1.18 2020/03/16 21:20:09 pgoyette Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -31,7 +31,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_sysctl.c,v 1.17 2017/09/29 17:47:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_sysctl.c,v 1.18 2020/03/16 21:20:09 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -68,82 +68,70 @@ struct sysctlnode linux32_sysctl_root =
.sysctl_size = sizeof(struct sysctlnode),
};
-static struct sysctllog *linux32_clog1;
-static struct sysctllog *linux32_clog2;
extern int linux32_enabled;
-void
-linux32_sysctl_fini(void)
-{
-
- sysctl_teardown(&linux32_clog2);
- sysctl_teardown(&linux32_clog1);
- sysctl_free(&linux32_sysctl_root);
-}
-
-void
-linux32_sysctl_init(void)
+SYSCTL_SETUP(linux32_sysctl_init, "linux32 emulation sysctls")
{
const struct sysctlnode *node = &linux32_sysctl_root;
- sysctl_createv(&linux32_clog1, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "linux32",
SYSCTL_DESCR("Linux 32 bit emulation settings"),
NULL, 0, NULL, 0,
CTL_EMUL, EMUL_LINUX32, CTL_EOL);
- sysctl_createv(&linux32_clog1, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "kern",
SYSCTL_DESCR("Linux 32 bit kernel emulation settings"),
NULL, 0, NULL, 0,
CTL_EMUL, EMUL_LINUX32, EMUL_LINUX32_KERN, CTL_EOL);
- sysctl_createv(&linux32_clog1, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "ostype",
SYSCTL_DESCR("Linux 32 bit operating system type"),
NULL, 0, linux32_sysname, sizeof(linux32_sysname),
CTL_EMUL, EMUL_LINUX32, EMUL_LINUX32_KERN,
EMUL_LINUX32_KERN_OSTYPE, CTL_EOL);
- sysctl_createv(&linux32_clog1, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "osrelease",
SYSCTL_DESCR("Linux 32 bit operating system release"),
NULL, 0, linux32_release, sizeof(linux32_release),
CTL_EMUL, EMUL_LINUX32, EMUL_LINUX32_KERN,
EMUL_LINUX32_KERN_OSRELEASE, CTL_EOL);
- sysctl_createv(&linux32_clog1, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "osversion",
SYSCTL_DESCR("Linux 32 bit operating system revision"),
NULL, 0, linux32_version, sizeof(linux32_version),
CTL_EMUL, EMUL_LINUX32, EMUL_LINUX32_KERN,
EMUL_LINUX32_KERN_VERSION, CTL_EOL);
- sysctl_createv(&linux32_clog1, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_READWRITE,
CTLTYPE_INT, "enabled",
SYSCTL_DESCR("Linux 32 bit compat enabled."),
linux32_sysctl_enable, 0, &linux32_enabled, 0,
CTL_EMUL, EMUL_LINUX32, CTL_CREATE, CTL_EOL);
- sysctl_createv(&linux32_clog2, 0, &node, &node,
+ sysctl_createv(clog, 0, &node, &node,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "kern", NULL,
NULL, 0, NULL, 0,
LINUX_CTL_KERN, CTL_EOL);
- sysctl_createv(&linux32_clog2, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "ostype", NULL,
NULL, 0, linux32_sysname, sizeof(linux32_sysname),
LINUX_KERN_OSTYPE, CTL_EOL);
- sysctl_createv(&linux32_clog2, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "osrelease", NULL,
NULL, 0, linux32_release, sizeof(linux32_release),
LINUX_KERN_OSRELEASE, CTL_EOL);
- sysctl_createv(&linux32_clog2, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "version", NULL,
NULL, 0, linux32_version, sizeof(linux32_version),
Index: src/sys/compat/linux32/common/linux32_sysctl.h
diff -u src/sys/compat/linux32/common/linux32_sysctl.h:1.4 src/sys/compat/linux32/common/linux32_sysctl.h:1.5
--- src/sys/compat/linux32/common/linux32_sysctl.h:1.4 Wed Aug 22 01:05:23 2018
+++ src/sys/compat/linux32/common/linux32_sysctl.h Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_sysctl.h,v 1.4 2018/08/22 01:05:23 msaitoh Exp $ */
+/* $NetBSD: linux32_sysctl.h,v 1.5 2020/03/16 21:20:09 pgoyette Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -44,9 +44,6 @@ extern char linux32_version[];
#define EMUL_LINUX32_KERN_OSRELEASE 2
#define EMUL_LINUX32_KERN_VERSION 3
-void linux32_sysctl_init(void);
-void linux32_sysctl_fini(void);
-
int linux32_sysctl_enable(SYSCTLFN_PROTO);
#endif /* !_LINUX32_SYSCTL_H */
Index: src/sys/dev/acpi/acpi_cpu.c
diff -u src/sys/dev/acpi/acpi_cpu.c:1.51 src/sys/dev/acpi/acpi_cpu.c:1.52
--- src/sys/dev/acpi/acpi_cpu.c:1.51 Thu Jun 1 02:45:09 2017
+++ src/sys/dev/acpi/acpi_cpu.c Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.51 2017/06/01 02:45:09 chs Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.52 2020/03/16 21:20:09 pgoyette Exp $ */
/*-
* Copyright (c) 2010, 2011 Jukka Ruohonen <[email protected]>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.51 2017/06/01 02:45:09 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.52 2020/03/16 21:20:09 pgoyette Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -55,7 +55,6 @@ static int acpicpu_detach(device_t, i
static int acpicpu_once_attach(void);
static int acpicpu_once_detach(void);
static void acpicpu_start(device_t);
-static void acpicpu_sysctl(device_t);
static ACPI_STATUS acpicpu_object(ACPI_HANDLE, struct acpicpu_object *);
static uint32_t acpicpu_cap(struct acpicpu_softc *);
@@ -73,7 +72,6 @@ static const char *acpicpu_debug_print_
static uint32_t acpicpu_count = 0;
struct acpicpu_softc **acpicpu_sc = NULL;
-static struct sysctllog *acpicpu_log = NULL;
static bool acpicpu_dynamic = true;
static bool acpicpu_passive = true;
@@ -234,7 +232,6 @@ acpicpu_once_attach(void)
return 0;
KASSERT(acpicpu_sc == NULL);
- KASSERT(acpicpu_log == NULL);
acpicpu_sc = kmem_zalloc(maxcpus * sizeof(*sc), KM_SLEEP);
@@ -254,9 +251,6 @@ acpicpu_once_detach(void)
cpufreq_deregister();
- if (acpicpu_log != NULL)
- sysctl_teardown(&acpicpu_log);
-
if (acpicpu_sc != NULL)
kmem_free(acpicpu_sc, maxcpus * sizeof(*sc));
@@ -296,7 +290,6 @@ acpicpu_start(device_t self)
if ((sc->sc_flags & ACPICPU_FLAG_T) != 0)
acpicpu_tstate_start(self);
- acpicpu_sysctl(self);
aprint_debug_dev(self, "ACPI CPUs started\n");
/*
@@ -328,29 +321,26 @@ acpicpu_start(device_t self)
}
}
-static void
-acpicpu_sysctl(device_t self)
+SYSCTL_SETUP(acpicpu_sysctl, "acpi_cpu sysctls")
{
const struct sysctlnode *node;
int err;
- KASSERT(acpicpu_log == NULL);
-
- err = sysctl_createv(&acpicpu_log, 0, NULL, &node,
+ err = sysctl_createv(clog, 0, NULL, &node,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "acpi", NULL,
NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL);
if (err != 0)
goto fail;
- err = sysctl_createv(&acpicpu_log, 0, &node, &node,
+ err = sysctl_createv(clog, 0, &node, &node,
0, CTLTYPE_NODE, "cpu", SYSCTL_DESCR("ACPI CPU"),
NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
if (err != 0)
goto fail;
- err = sysctl_createv(&acpicpu_log, 0, &node, NULL,
+ err = sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_READWRITE, CTLTYPE_BOOL, "dynamic",
SYSCTL_DESCR("Dynamic states"), NULL, 0,
&acpicpu_dynamic, 0, CTL_CREATE, CTL_EOL);
@@ -358,7 +348,7 @@ acpicpu_sysctl(device_t self)
if (err != 0)
goto fail;
- err = sysctl_createv(&acpicpu_log, 0, &node, NULL,
+ err = sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_READWRITE, CTLTYPE_BOOL, "passive",
SYSCTL_DESCR("Passive cooling"), NULL, 0,
&acpicpu_passive, 0, CTL_CREATE, CTL_EOL);
@@ -369,7 +359,7 @@ acpicpu_sysctl(device_t self)
return;
fail:
- aprint_error_dev(self, "failed to initialize sysctl (err %d)\n", err);
+ aprint_error("%s: failed to init sysctl (err %d)\n", __func__, err);
}
static ACPI_STATUS
Index: src/sys/dev/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.47 src/sys/dev/pci/ubsec.c:1.48
--- src/sys/dev/pci/ubsec.c:1.47 Sun Nov 10 21:16:36 2019
+++ src/sys/dev/pci/ubsec.c Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ubsec.c,v 1.47 2019/11/10 21:16:36 chs Exp $ */
+/* $NetBSD: ubsec.c,v 1.48 2020/03/16 21:20:09 pgoyette Exp $ */
/* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
/* $OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$ */
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.47 2019/11/10 21:16:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.48 2020/03/16 21:20:09 pgoyette Exp $");
#undef UBSEC_DEBUG
@@ -87,7 +87,6 @@ __KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.
static int ubsec_probe(device_t, cfdata_t, void *);
static void ubsec_attach(device_t, device_t, void *);
static int ubsec_detach(device_t, int);
-static int ubsec_sysctl_init(void);
static void ubsec_reset_board(struct ubsec_softc *);
static void ubsec_init_board(struct ubsec_softc *);
static void ubsec_init_pciregs(struct pci_attach_args *pa);
@@ -166,8 +165,6 @@ static void ubsec_dump_ctx2(volatile str
struct ubsec_stats ubsecstats;
-static struct sysctllog *ubsec_sysctllog;
-
/*
* ubsec_maxbatch controls the number of crypto ops to voluntarily
* collect into one submission to the hardware. This batching happens
@@ -617,12 +614,8 @@ ubsec_modcmd(modcmd_t cmd, void *data)
error = config_init_component(cfdriver_ioconf_ubsec,
cfattach_ioconf_ubsec, cfdata_ioconf_ubsec);
#endif
- if (error == 0)
- error = ubsec_sysctl_init();
return error;
case MODULE_CMD_FINI:
- if (ubsec_sysctllog != NULL)
- sysctl_teardown(&ubsec_sysctllog);
#ifdef _MODULE
error = config_fini_component(cfdriver_ioconf_ubsec,
cfattach_ioconf_ubsec, cfdata_ioconf_ubsec);
@@ -633,33 +626,30 @@ ubsec_modcmd(modcmd_t cmd, void *data)
}
}
-static int
-ubsec_sysctl_init(void)
+SYSCTL_SETUP(ubsec_sysctl_init, "ubsec sysctl")
{
const struct sysctlnode *node = NULL;
- ubsec_sysctllog = NULL;
-
- sysctl_createv(&ubsec_sysctllog, 0, NULL, &node,
+ sysctl_createv(clog, 0, NULL, &node,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "ubsec",
SYSCTL_DESCR("ubsec opetions"),
NULL, 0, NULL, 0,
CTL_HW, CTL_CREATE, CTL_EOL);
- sysctl_createv(&ubsec_sysctllog, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "maxbatch",
SYSCTL_DESCR("max ops to batch w/o interrupt"),
NULL, 0, &ubsec_maxbatch, 0,
CTL_CREATE, CTL_EOL);
- sysctl_createv(&ubsec_sysctllog, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "maxaggr",
SYSCTL_DESCR("max ops to aggregate under one interrupt"),
NULL, 0, &ubsec_maxaggr, 0,
CTL_CREATE, CTL_EOL);
- return 0;
+ return;
}
/*
Index: src/sys/dev/sysmon/swsensor.c
diff -u src/sys/dev/sysmon/swsensor.c:1.15 src/sys/dev/sysmon/swsensor.c:1.16
--- src/sys/dev/sysmon/swsensor.c:1.15 Sat Apr 25 23:55:23 2015
+++ src/sys/dev/sysmon/swsensor.c Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: swsensor.c,v 1.15 2015/04/25 23:55:23 pgoyette Exp $ */
+/* $NetBSD: swsensor.c,v 1.16 2020/03/16 21:20:09 pgoyette Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: swsensor.c,v 1.15 2015/04/25 23:55:23 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: swsensor.c,v 1.16 2020/03/16 21:20:09 pgoyette Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -45,8 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: swsensor.c,v
int swsensorattach(int);
-static struct sysctllog *swsensor_sysctllog = NULL;
-
static int sensor_value_sysctl = 0;
static int sensor_state_sysctl = 0;
@@ -66,18 +64,14 @@ MODULE(MODULE_CLASS_DRIVER, swsensor, "s
* Set-up the sysctl interface for setting the sensor's cur_value
*/
-static
-void
-sysctl_swsensor_setup(void)
+SYSCTL_SETUP(sysctl_swsensor_setup, "swsensor sysctl")
{
int ret;
int node_sysctl_num;
const struct sysctlnode *me = NULL;
const struct sysctlnode *me2;
- KASSERT(swsensor_sysctllog == NULL);
-
- ret = sysctl_createv(&swsensor_sysctllog, 0, NULL, &me,
+ ret = sysctl_createv(clog, 0, NULL, &me,
CTLFLAG_READWRITE,
CTLTYPE_NODE, "swsensor", NULL,
NULL, 0, NULL, 0,
@@ -86,7 +80,7 @@ sysctl_swsensor_setup(void)
return;
node_sysctl_num = me->sysctl_num;
- ret = sysctl_createv(&swsensor_sysctllog, 0, NULL, &me2,
+ ret = sysctl_createv(clog, 0, NULL, &me2,
CTLFLAG_READWRITE,
CTLTYPE_INT, "cur_value", NULL,
NULL, 0, &sw_sensor_value, 0,
@@ -96,7 +90,7 @@ sysctl_swsensor_setup(void)
sensor_value_sysctl = me2->sysctl_num;
node_sysctl_num = me->sysctl_num;
- ret = sysctl_createv(&swsensor_sysctllog, 0, NULL, &me2,
+ ret = sysctl_createv(clog, 0, NULL, &me2,
CTLFLAG_READWRITE,
CTLTYPE_INT, "state", NULL,
NULL, 0, &sw_sensor_state, 0,
@@ -352,7 +346,6 @@ swsensor_init(void *arg)
return error;
}
- sysctl_swsensor_setup();
aprint_normal("swsensor: initialized\n");
return 0;
@@ -365,8 +358,6 @@ swsensor_fini(void *arg)
sysmon_envsys_unregister(swsensor_sme);
- sysctl_teardown(&swsensor_sysctllog);
-
return 0;
}
Index: src/sys/dev/sysmon/swwdog.c
diff -u src/sys/dev/sysmon/swwdog.c:1.21 src/sys/dev/sysmon/swwdog.c:1.22
--- src/sys/dev/sysmon/swwdog.c:1.21 Wed Jan 1 22:57:17 2020
+++ src/sys/dev/sysmon/swwdog.c Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: swwdog.c,v 1.21 2020/01/01 22:57:17 thorpej Exp $ */
+/* $NetBSD: swwdog.c,v 1.22 2020/03/16 21:20:09 pgoyette Exp $ */
/*
* Copyright (c) 2004, 2005 Steven M. Bellovin
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: swwdog.c,v 1.21 2020/01/01 22:57:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: swwdog.c,v 1.22 2020/03/16 21:20:09 pgoyette Exp $");
/*
*
@@ -85,9 +85,6 @@ static int swwdog_disarm(struct swwdog_s
static void swwdog_panic(void *);
-static void swwdog_sysctl_setup(void);
-static struct sysctllog *swwdog_sysctllog = NULL;
-
static int swwdog_match(device_t, cfdata_t, void *);
static void swwdog_attach(device_t, device_t, void *);
static int swwdog_detach(device_t, int);
@@ -181,8 +178,6 @@ swwdog_attach(device_t parent, device_t
if (!pmf_device_register(self, swwdog_suspend, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
-
- swwdog_sysctl_setup();
}
static int
@@ -192,7 +187,6 @@ swwdog_detach(device_t self, int flags)
pmf_device_deregister(self);
swwdog_disarm(sc);
- sysctl_teardown(&swwdog_sysctllog);
sysmon_wdog_unregister(&sc->sc_smw);
callout_destroy(&sc->sc_c);
workqueue_destroy(wq);
@@ -274,18 +268,15 @@ swwdog_panic(void *vsc)
workqueue_enqueue(wq, &wk, NULL);
}
-static void
-swwdog_sysctl_setup(void)
+SYSCTL_SETUP(swwdog_sysctl_setup, "swwdog sysctl")
{
const struct sysctlnode *me;
- KASSERT(swwdog_sysctllog == NULL);
-
- sysctl_createv(&swwdog_sysctllog, 0, NULL, &me, CTLFLAG_READWRITE,
+ sysctl_createv(clog, 0, NULL, &me, CTLFLAG_READWRITE,
CTLTYPE_NODE, "swwdog", NULL,
NULL, 0, NULL, 0,
CTL_HW, CTL_CREATE, CTL_EOL);
- sysctl_createv(&swwdog_sysctllog, 0, NULL, NULL, CTLFLAG_READWRITE,
+ sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_READWRITE,
CTLTYPE_BOOL, "reboot", "reboot if timer expires",
NULL, 0, &swwdog_reboot, sizeof(bool),
CTL_HW, me->sysctl_num, CTL_CREATE, CTL_EOL);
Index: src/sys/fs/adosfs/advfsops.c
diff -u src/sys/fs/adosfs/advfsops.c:1.78 src/sys/fs/adosfs/advfsops.c:1.79
--- src/sys/fs/adosfs/advfsops.c:1.78 Fri Jan 17 20:08:07 2020
+++ src/sys/fs/adosfs/advfsops.c Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: advfsops.c,v 1.78 2020/01/17 20:08:07 ad Exp $ */
+/* $NetBSD: advfsops.c,v 1.79 2020/03/16 21:20:09 pgoyette Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.78 2020/01/17 20:08:07 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.79 2020/03/16 21:20:09 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -65,8 +65,6 @@ MODULE(MODULE_CLASS_VFS, adosfs, NULL);
VFS_PROTOS(adosfs);
-static struct sysctllog *adosfs_sysctl_log;
-
int adosfs_mountfs(struct vnode *, struct mount *, struct lwp *);
int adosfs_loadbitmap(struct adosfsmount *);
@@ -812,6 +810,15 @@ struct vfsops adosfs_vfsops = {
.vfs_opv_descs = adosfs_vnodeopv_descs
};
+SYSCTL_SETUP(adosfs_sysctl_setup, "adosfs sysctl")
+{ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "adosfs",
+ SYSCTL_DESCR("AmigaDOS file system"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 16, CTL_EOL);
+}
+
static int
adosfs_modcmd(modcmd_t cmd, void *arg)
{
@@ -822,12 +829,6 @@ adosfs_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&adosfs_vfsops);
if (error != 0)
break;
- sysctl_createv(&adosfs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "adosfs",
- SYSCTL_DESCR("AmigaDOS file system"),
- NULL, 0, NULL, 0,
- CTL_VFS, 16, CTL_EOL);
/*
* XXX the "16" above could be dynamic, thereby eliminating
* one more instance of the "number to vfs" mapping problem,
@@ -838,7 +839,6 @@ adosfs_modcmd(modcmd_t cmd, void *arg)
error = vfs_detach(&adosfs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&adosfs_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/fs/autofs/autofs_vfsops.c
diff -u src/sys/fs/autofs/autofs_vfsops.c:1.9 src/sys/fs/autofs/autofs_vfsops.c:1.10
--- src/sys/fs/autofs/autofs_vfsops.c:1.9 Fri Jan 17 20:08:07 2020
+++ src/sys/fs/autofs/autofs_vfsops.c Mon Mar 16 21:20:09 2020
@@ -33,7 +33,7 @@
*
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.9 2020/01/17 20:08:07 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.10 2020/03/16 21:20:09 pgoyette Exp $");
#include "autofs.h"
@@ -46,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: autofs_vfsop
MODULE(MODULE_CLASS_VFS, autofs, NULL);
static int autofs_statvfs(struct mount *, struct statvfs *);
-static int autofs_sysctl_create(void);
static void
autofs_init(void)
@@ -66,7 +65,6 @@ autofs_init(void)
mutex_init(&autofs_softc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
autofs_softc->sc_dev_opened = false;
- autofs_sysctl_create();
workqueue_create(&autofs_tmo_wq, "autofstmo",
autofs_timeout_wq, NULL, 0, 0, WQ_MPSAFE);
}
@@ -375,10 +373,7 @@ static struct vfsops autofs_vfsops = {
#define AUTOFS_SYSCTL_RETRY_DELAY 6
#define AUTOFS_SYSCTL_INTERRUPTIBLE 7
-static struct sysctllog *autofs_sysctl_log;
-
-static int
-autofs_sysctl_create(void)
+SYSCTL_SETUP(autofs_sysctl_create, "autofs sysctl")
{
int error;
@@ -387,7 +382,7 @@ autofs_sysctl_create(void)
* more instance of the "number to vfs" mapping problem, but
* "33" is the order as taken from sys/mount.h
*/
- error = sysctl_createv(&autofs_sysctl_log, 0, NULL, NULL,
+ error = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "autofs",
SYSCTL_DESCR("Automounter filesystem"),
@@ -396,7 +391,7 @@ autofs_sysctl_create(void)
if (error)
goto fail;
- error = sysctl_createv(&autofs_sysctl_log, 0, NULL, NULL,
+ error = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "autofs_debug",
SYSCTL_DESCR("Enable debug messages"),
@@ -405,7 +400,7 @@ autofs_sysctl_create(void)
if (error)
goto fail;
- error = sysctl_createv(&autofs_sysctl_log, 0, NULL, NULL,
+ error = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "autofs_mount_on_stat",
SYSCTL_DESCR("Trigger mount on stat(2) on mountpoint"),
@@ -414,7 +409,7 @@ autofs_sysctl_create(void)
if (error)
goto fail;
- error = sysctl_createv(&autofs_sysctl_log, 0, NULL, NULL,
+ error = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "autofs_timeout",
SYSCTL_DESCR("Number of seconds to wait for automountd(8)"),
@@ -423,7 +418,7 @@ autofs_sysctl_create(void)
if (error)
goto fail;
- error = sysctl_createv(&autofs_sysctl_log, 0, NULL, NULL,
+ error = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "autofs_cache",
SYSCTL_DESCR("Number of seconds to wait before reinvoking"),
@@ -432,7 +427,7 @@ autofs_sysctl_create(void)
if (error)
goto fail;
- error = sysctl_createv(&autofs_sysctl_log, 0, NULL, NULL,
+ error = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "autofs_retry_attempts",
SYSCTL_DESCR("Number of attempts before failing mount"),
@@ -441,7 +436,7 @@ autofs_sysctl_create(void)
if (error)
goto fail;
- error = sysctl_createv(&autofs_sysctl_log, 0, NULL, NULL,
+ error = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "autofs_retry_delay",
SYSCTL_DESCR("Number of seconds before retrying"),
@@ -450,7 +445,7 @@ autofs_sysctl_create(void)
if (error)
goto fail;
- error = sysctl_createv(&autofs_sysctl_log, 0, NULL, NULL,
+ error = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "autofs_interruptible",
SYSCTL_DESCR("Allow requests to be interrupted by signal"),
@@ -459,11 +454,11 @@ autofs_sysctl_create(void)
if (error)
goto fail;
- return 0;
+ return;
fail:
AUTOFS_WARN("sysctl_createv failed with error %d", error);
- return error;
+ return;
}
extern const struct cdevsw autofs_cdevsw;
Index: src/sys/fs/cd9660/cd9660_vfsops.c
diff -u src/sys/fs/cd9660/cd9660_vfsops.c:1.94 src/sys/fs/cd9660/cd9660_vfsops.c:1.95
--- src/sys/fs/cd9660/cd9660_vfsops.c:1.94 Fri Jan 17 20:08:07 2020
+++ src/sys/fs/cd9660/cd9660_vfsops.c Mon Mar 16 21:20:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660_vfsops.c,v 1.94 2020/01/17 20:08:07 ad Exp $ */
+/* $NetBSD: cd9660_vfsops.c,v 1.95 2020/03/16 21:20:09 pgoyette Exp $ */
/*-
* Copyright (c) 1994
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.94 2020/01/17 20:08:07 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.95 2020/03/16 21:20:09 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -78,8 +78,6 @@ MODULE(MODULE_CLASS_VFS, cd9660, NULL);
MALLOC_JUSTDEFINE(M_ISOFSMNT, "ISOFS mount", "ISOFS mount structure");
-static struct sysctllog *cd9660_sysctl_log;
-
extern const struct vnodeopv_desc cd9660_vnodeop_opv_desc;
extern const struct vnodeopv_desc cd9660_specop_opv_desc;
extern const struct vnodeopv_desc cd9660_fifoop_opv_desc;
@@ -131,22 +129,15 @@ static int iso_makemp(struct iso_mnt *is
static int iso_mountfs(struct vnode *devvp, struct mount *mp,
struct lwp *l, struct iso_args *argp);
-static int
-cd9660_modcmd(modcmd_t cmd, void *arg)
+SYSCTL_SETUP(cd9660_sysctl_setup, "cd9660 sysctl")
{
- int error;
- switch (cmd) {
- case MODULE_CMD_INIT:
- error = vfs_attach(&cd9660_vfsops);
- if (error != 0)
- break;
- sysctl_createv(&cd9660_sysctl_log, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "cd9660",
SYSCTL_DESCR("ISO-9660 file system"),
NULL, 0, NULL, 0,
CTL_VFS, 14, CTL_EOL);
- sysctl_createv(&cd9660_sysctl_log, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "utf8_joliet",
SYSCTL_DESCR("Encode Joliet filenames to UTF-8"),
@@ -157,12 +148,23 @@ cd9660_modcmd(modcmd_t cmd, void *arg)
* one more instance of the "number to vfs" mapping problem,
* but "14" is the order as taken from sys/mount.h
*/
+}
+
+static int
+cd9660_modcmd(modcmd_t cmd, void *arg)
+{
+ int error;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ error = vfs_attach(&cd9660_vfsops);
+ if (error != 0)
+ break;
break;
case MODULE_CMD_FINI:
error = vfs_detach(&cd9660_vfsops);
if (error != 0)
break;
- sysctl_teardown(&cd9660_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/fs/filecorefs/filecore_vfsops.c
diff -u src/sys/fs/filecorefs/filecore_vfsops.c:1.82 src/sys/fs/filecorefs/filecore_vfsops.c:1.83
--- src/sys/fs/filecorefs/filecore_vfsops.c:1.82 Fri Jan 17 20:08:07 2020
+++ src/sys/fs/filecorefs/filecore_vfsops.c Mon Mar 16 21:20:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: filecore_vfsops.c,v 1.82 2020/01/17 20:08:07 ad Exp $ */
+/* $NetBSD: filecore_vfsops.c,v 1.83 2020/03/16 21:20:10 pgoyette Exp $ */
/*-
* Copyright (c) 1994 The Regents of the University of California.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.82 2020/01/17 20:08:07 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.83 2020/03/16 21:20:10 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -97,8 +97,6 @@ __KERNEL_RCSID(0, "$NetBSD: filecore_vfs
MODULE(MODULE_CLASS_VFS, filecore, NULL);
-static struct sysctllog *filecore_sysctl_log;
-
extern const struct vnodeopv_desc filecore_vnodeop_opv_desc;
const struct vnodeopv_desc * const filecore_vnodeopv_descs[] = {
@@ -132,6 +130,22 @@ struct vfsops filecore_vfsops = {
.vfs_opv_descs = filecore_vnodeopv_descs
};
+SYSCTL_SETUP(filecore_sysctl_setup, "filecore fs sysctl")
+{
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "filecore",
+ SYSCTL_DESCR("Acorn FILECORE file system"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 19, CTL_EOL);
+ /*
+ * XXX the "19" above could be dynamic, thereby eliminating
+ * one more instance of the "number to vfs" mapping problem,
+ * but "19" is the order as taken from sys/mount.h
+ */
+}
+
static int
filecore_modcmd(modcmd_t cmd, void *arg)
{
@@ -142,23 +156,11 @@ filecore_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&filecore_vfsops);
if (error != 0)
break;
- sysctl_createv(&filecore_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "filecore",
- SYSCTL_DESCR("Acorn FILECORE file system"),
- NULL, 0, NULL, 0,
- CTL_VFS, 19, CTL_EOL);
- /*
- * XXX the "19" above could be dynamic, thereby eliminating
- * one more instance of the "number to vfs" mapping problem,
- * but "19" is the order as taken from sys/mount.h
- */
break;
case MODULE_CMD_FINI:
error = vfs_detach(&filecore_vfsops);
if (error != 0)
break;
- sysctl_teardown(&filecore_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/fs/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.132 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.133
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.132 Thu Feb 27 22:12:53 2020
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c Mon Mar 16 21:20:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: msdosfs_vfsops.c,v 1.132 2020/02/27 22:12:53 ad Exp $ */
+/* $NetBSD: msdosfs_vfsops.c,v 1.133 2020/03/16 21:20:10 pgoyette Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.132 2020/02/27 22:12:53 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.133 2020/03/16 21:20:10 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -106,8 +106,6 @@ MALLOC_JUSTDEFINE(M_MSDOSFSMNT, "MSDOSFS
MALLOC_JUSTDEFINE(M_MSDOSFSFAT, "MSDOSFS FAT", "MSDOS FS FAT table");
MALLOC_JUSTDEFINE(M_MSDOSFSTMP, "MSDOSFS temp", "MSDOS FS temp. structures");
-static struct sysctllog *msdosfs_sysctl_log;
-
extern const struct vnodeopv_desc msdosfs_vnodeop_opv_desc;
const struct vnodeopv_desc * const msdosfs_vnodeopv_descs[] = {
@@ -142,6 +140,21 @@ struct vfsops msdosfs_vfsops = {
.vfs_opv_descs = msdosfs_vnodeopv_descs
};
+SYSCTL_SETUP(msdosfs_sysctl_setup, "msdosfs sysctl")
+{
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "msdosfs",
+ SYSCTL_DESCR("MS-DOS file system"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 4, CTL_EOL);
+ /*
+ * XXX the "4" above could be dynamic, thereby eliminating one
+ * more instance of the "number to vfs" mapping problem, but
+ * "4" is the order as taken from sys/mount.h
+ */
+}
+
static int
msdos_modcmd(modcmd_t cmd, void *arg)
{
@@ -152,23 +165,11 @@ msdos_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&msdosfs_vfsops);
if (error != 0)
break;
- sysctl_createv(&msdosfs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "msdosfs",
- SYSCTL_DESCR("MS-DOS file system"),
- NULL, 0, NULL, 0,
- CTL_VFS, 4, CTL_EOL);
- /*
- * XXX the "4" above could be dynamic, thereby eliminating one
- * more instance of the "number to vfs" mapping problem, but
- * "4" is the order as taken from sys/mount.h
- */
break;
case MODULE_CMD_FINI:
error = vfs_detach(&msdosfs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&msdosfs_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/fs/nilfs/nilfs_vfsops.c
diff -u src/sys/fs/nilfs/nilfs_vfsops.c:1.25 src/sys/fs/nilfs/nilfs_vfsops.c:1.26
--- src/sys/fs/nilfs/nilfs_vfsops.c:1.25 Fri Jan 17 20:08:07 2020
+++ src/sys/fs/nilfs/nilfs_vfsops.c Mon Mar 16 21:20:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: nilfs_vfsops.c,v 1.25 2020/01/17 20:08:07 ad Exp $ */
+/* $NetBSD: nilfs_vfsops.c,v 1.26 2020/03/16 21:20:10 pgoyette Exp $ */
/*
* Copyright (c) 2008, 2009 Reinoud Zandijk
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: nilfs_vfsops.c,v 1.25 2020/01/17 20:08:07 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nilfs_vfsops.c,v 1.26 2020/03/16 21:20:10 pgoyette Exp $");
#endif /* not lint */
@@ -80,7 +80,6 @@ struct pool nilfs_node_pool;
/* globals */
struct _nilfs_devices nilfs_devices;
-static struct sysctllog *nilfs_sysctl_log;
/* supported functions predefined */
VFS_PROTOS(nilfs);
@@ -235,10 +234,34 @@ nilfs_done(void)
*/
#define NILFS_VERBOSE_SYSCTLOPT 1
+SYSCTL_SETUP(nilfs_sysctl_setup, "nilfs sysctl")
+{
+ const struct sysctlnode *node;
+
+ /*
+ * XXX the "30" below could be dynamic, thereby eliminating one
+ * more instance of the "number to vfs" mapping problem, but
+ * "30" is the order as taken from sys/mount.h
+ */
+ sysctl_createv(clog, 0, NULL, &node,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "nilfs",
+ SYSCTL_DESCR("NTT's NILFSv2"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 30, CTL_EOL);
+#ifdef DEBUG
+ sysctl_createv(clog, 0, NULL, &node,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "verbose",
+ SYSCTL_DESCR("Bitmask for filesystem debugging"),
+ NULL, 0, &nilfs_verbose, 0,
+ CTL_VFS, 30, NILFS_VERBOSE_SYSCTLOPT, CTL_EOL);
+#endif
+}
+
static int
nilfs_modcmd(modcmd_t cmd, void *arg)
{
- const struct sysctlnode *node;
int error;
switch (cmd) {
@@ -246,31 +269,11 @@ nilfs_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&nilfs_vfsops);
if (error != 0)
break;
- /*
- * XXX the "30" below could be dynamic, thereby eliminating one
- * more instance of the "number to vfs" mapping problem, but
- * "30" is the order as taken from sys/mount.h
- */
- sysctl_createv(&nilfs_sysctl_log, 0, NULL, &node,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "nilfs",
- SYSCTL_DESCR("NTT's NILFSv2"),
- NULL, 0, NULL, 0,
- CTL_VFS, 30, CTL_EOL);
-#ifdef DEBUG
- sysctl_createv(&nilfs_sysctl_log, 0, NULL, &node,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "verbose",
- SYSCTL_DESCR("Bitmask for filesystem debugging"),
- NULL, 0, &nilfs_verbose, 0,
- CTL_VFS, 30, NILFS_VERBOSE_SYSCTLOPT, CTL_EOL);
-#endif
break;
case MODULE_CMD_FINI:
error = vfs_detach(&nilfs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&nilfs_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/fs/ptyfs/ptyfs_vfsops.c
diff -u src/sys/fs/ptyfs/ptyfs_vfsops.c:1.57 src/sys/fs/ptyfs/ptyfs_vfsops.c:1.58
--- src/sys/fs/ptyfs/ptyfs_vfsops.c:1.57 Fri Jan 17 20:08:08 2020
+++ src/sys/fs/ptyfs/ptyfs_vfsops.c Mon Mar 16 21:20:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ptyfs_vfsops.c,v 1.57 2020/01/17 20:08:08 ad Exp $ */
+/* $NetBSD: ptyfs_vfsops.c,v 1.58 2020/03/16 21:20:10 pgoyette Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.57 2020/01/17 20:08:08 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.58 2020/03/16 21:20:10 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -70,8 +70,6 @@ MALLOC_JUSTDEFINE(M_PTYFSTMP, "ptyfs tem
VFS_PROTOS(ptyfs);
-static struct sysctllog *ptyfs_sysctl_log;
-
static int ptyfs__allocvp(struct mount *, struct lwp *, struct vnode **,
dev_t, char);
static int ptyfs__makename(struct mount *, struct lwp *, char *, size_t,
@@ -499,6 +497,22 @@ struct vfsops ptyfs_vfsops = {
.vfs_opv_descs = ptyfs_vnodeopv_descs
};
+SYSCTL_SETUP(ptyfs_sysctl_setup, "ptyfs sysctl")
+{
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "ptyfs",
+ SYSCTL_DESCR("Pty file system"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 23, CTL_EOL);
+ /*
+ * XXX the "23" above could be dynamic, thereby eliminating
+ * one more instance of the "number to vfs" mapping problem,
+ * but "23" is the order as taken from sys/mount.h
+ */
+}
+
static int
ptyfs_modcmd(modcmd_t cmd, void *arg)
{
@@ -509,23 +523,11 @@ ptyfs_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&ptyfs_vfsops);
if (error != 0)
break;
- sysctl_createv(&ptyfs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "ptyfs",
- SYSCTL_DESCR("Pty file system"),
- NULL, 0, NULL, 0,
- CTL_VFS, 23, CTL_EOL);
- /*
- * XXX the "23" above could be dynamic, thereby eliminating
- * one more instance of the "number to vfs" mapping problem,
- * but "23" is the order as taken from sys/mount.h
- */
break;
case MODULE_CMD_FINI:
error = vfs_detach(&ptyfs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&ptyfs_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/fs/smbfs/smbfs_vfsops.c
diff -u src/sys/fs/smbfs/smbfs_vfsops.c:1.108 src/sys/fs/smbfs/smbfs_vfsops.c:1.109
--- src/sys/fs/smbfs/smbfs_vfsops.c:1.108 Thu Feb 27 22:12:54 2020
+++ src/sys/fs/smbfs/smbfs_vfsops.c Mon Mar 16 21:20:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_vfsops.c,v 1.108 2020/02/27 22:12:54 ad Exp $ */
+/* $NetBSD: smbfs_vfsops.c,v 1.109 2020/03/16 21:20:10 pgoyette Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.108 2020/02/27 22:12:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.109 2020/03/16 21:20:10 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -66,8 +66,6 @@ MODULE(MODULE_CLASS_VFS, smbfs, "nsmb");
VFS_PROTOS(smbfs);
-static struct sysctllog *smbfs_sysctl_log;
-
static int smbfs_setroot(struct mount *);
extern struct vnodeopv_desc smbfs_vnodeop_opv_desc;
@@ -104,10 +102,30 @@ struct vfsops smbfs_vfsops = {
.vfs_opv_descs = smbfs_vnodeopv_descs
};
+SYSCTL_SETUP(smbfs_sysctl_setpu, "smbfs sysctl")
+{
+ const struct sysctlnode *smb = NULL;
+
+ sysctl_createv(clog, 0, NULL, &smb,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "samba",
+ SYSCTL_DESCR("SMB/CIFS remote file system"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, CTL_CREATE, CTL_EOL);
+
+ if (smb != NULL) {
+ sysctl_createv(clog, 0, &smb, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+ CTLTYPE_INT, "version",
+ SYSCTL_DESCR("smbfs version"),
+ NULL, SMBFS_VERSION, NULL, 0,
+ CTL_CREATE, CTL_EOL);
+ }
+}
+
static int
smbfs_modcmd(modcmd_t cmd, void *arg)
{
- const struct sysctlnode *smb = NULL;
int error;
switch (cmd) {
@@ -115,27 +133,11 @@ smbfs_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&smbfs_vfsops);
if (error != 0)
break;
- sysctl_createv(&smbfs_sysctl_log, 0, NULL, &smb,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "samba",
- SYSCTL_DESCR("SMB/CIFS remote file system"),
- NULL, 0, NULL, 0,
- CTL_VFS, CTL_CREATE, CTL_EOL);
-
- if (smb != NULL) {
- sysctl_createv(&smbfs_sysctl_log, 0, &smb, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
- CTLTYPE_INT, "version",
- SYSCTL_DESCR("smbfs version"),
- NULL, SMBFS_VERSION, NULL, 0,
- CTL_CREATE, CTL_EOL);
- }
break;
case MODULE_CMD_FINI:
error = vfs_detach(&smbfs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&smbfs_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/fs/udf/udf_vfsops.c
diff -u src/sys/fs/udf/udf_vfsops.c:1.77 src/sys/fs/udf/udf_vfsops.c:1.78
--- src/sys/fs/udf/udf_vfsops.c:1.77 Fri Jan 17 20:08:08 2020
+++ src/sys/fs/udf/udf_vfsops.c Mon Mar 16 21:20:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vfsops.c,v 1.77 2020/01/17 20:08:08 ad Exp $ */
+/* $NetBSD: udf_vfsops.c,v 1.78 2020/03/16 21:20:10 pgoyette Exp $ */
/*
* Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.77 2020/01/17 20:08:08 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.78 2020/03/16 21:20:10 pgoyette Exp $");
#endif /* not lint */
@@ -79,8 +79,6 @@ MALLOC_JUSTDEFINE(M_UDFVOLD, "UDF volsp
MALLOC_JUSTDEFINE(M_UDFTEMP, "UDF temp", "UDF scrap space");
struct pool udf_node_pool;
-static struct sysctllog *udf_sysctl_log;
-
/* internal functions */
static int udf_mountfs(struct vnode *, struct mount *, struct lwp *, struct udf_args *);
@@ -169,10 +167,29 @@ udf_done(void)
*/
#define UDF_VERBOSE_SYSCTLOPT 1
+SYSCTL_SETUP(udf_sysctl_setup, "udf sysctl")
+{
+ const struct sysctlnode *node;
+
+ sysctl_createv(clog, 0, NULL, &node,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "udf",
+ SYSCTL_DESCR("OSTA Universal File System"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 24, CTL_EOL);
+#ifdef DEBUG
+ sysctl_createv(clog, 0, NULL, &node,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "verbose",
+ SYSCTL_DESCR("Bitmask for filesystem debugging"),
+ NULL, 0, &udf_verbose, 0,
+ CTL_VFS, 24, UDF_VERBOSE_SYSCTLOPT, CTL_EOL);
+#endif
+}
+
static int
udf_modcmd(modcmd_t cmd, void *arg)
{
- const struct sysctlnode *node;
int error;
switch (cmd) {
@@ -185,26 +202,11 @@ udf_modcmd(modcmd_t cmd, void *arg)
* more instance of the "number to vfs" mapping problem, but
* "24" is the order as taken from sys/mount.h
*/
- sysctl_createv(&udf_sysctl_log, 0, NULL, &node,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "udf",
- SYSCTL_DESCR("OSTA Universal File System"),
- NULL, 0, NULL, 0,
- CTL_VFS, 24, CTL_EOL);
-#ifdef DEBUG
- sysctl_createv(&udf_sysctl_log, 0, NULL, &node,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "verbose",
- SYSCTL_DESCR("Bitmask for filesystem debugging"),
- NULL, 0, &udf_verbose, 0,
- CTL_VFS, 24, UDF_VERBOSE_SYSCTLOPT, CTL_EOL);
-#endif
break;
case MODULE_CMD_FINI:
error = vfs_detach(&udf_vfsops);
if (error != 0)
break;
- sysctl_teardown(&udf_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/fs/union/union_vfsops.c
diff -u src/sys/fs/union/union_vfsops.c:1.80 src/sys/fs/union/union_vfsops.c:1.81
--- src/sys/fs/union/union_vfsops.c:1.80 Fri Jan 17 20:08:08 2020
+++ src/sys/fs/union/union_vfsops.c Mon Mar 16 21:20:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: union_vfsops.c,v 1.80 2020/01/17 20:08:08 ad Exp $ */
+/* $NetBSD: union_vfsops.c,v 1.81 2020/03/16 21:20:10 pgoyette Exp $ */
/*
* Copyright (c) 1994 The Regents of the University of California.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.80 2020/01/17 20:08:08 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.81 2020/03/16 21:20:10 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -99,8 +99,6 @@ __KERNEL_RCSID(0, "$NetBSD: union_vfsops
MODULE(MODULE_CLASS_VFS, union, NULL);
-static struct sysctllog *union_sysctl_log;
-
/*
* Mount union filesystem
*/
@@ -545,6 +543,22 @@ struct vfsops union_vfsops = {
.vfs_opv_descs = union_vnodeopv_descs
};
+SYSCTL_SETUP(unionfs_sysctl_setup, "unionfs sysctl")
+{
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "union",
+ SYSCTL_DESCR("Union file system"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 15, CTL_EOL);
+ /*
+ * XXX the "15" above could be dynamic, thereby eliminating
+ * one more instance of the "number to vfs" mapping problem,
+ * but "15" is the order as taken from sys/mount.h
+ */
+}
+
static int
union_modcmd(modcmd_t cmd, void *arg)
{
@@ -555,23 +569,11 @@ union_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&union_vfsops);
if (error != 0)
break;
- sysctl_createv(&union_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "union",
- SYSCTL_DESCR("Union file system"),
- NULL, 0, NULL, 0,
- CTL_VFS, 15, CTL_EOL);
- /*
- * XXX the "15" above could be dynamic, thereby eliminating
- * one more instance of the "number to vfs" mapping problem,
- * but "15" is the order as taken from sys/mount.h
- */
break;
case MODULE_CMD_FINI:
error = vfs_detach(&union_vfsops);
if (error != 0)
break;
- sysctl_teardown(&union_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/kern/sys_aio.c
diff -u src/sys/kern/sys_aio.c:1.46 src/sys/kern/sys_aio.c:1.47
--- src/sys/kern/sys_aio.c:1.46 Sat Feb 1 02:23:04 2020
+++ src/sys/kern/sys_aio.c Mon Mar 16 21:20:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_aio.c,v 1.46 2020/02/01 02:23:04 riastradh Exp $ */
+/* $NetBSD: sys_aio.c,v 1.47 2020/03/16 21:20:10 pgoyette Exp $ */
/*
* Copyright (c) 2007 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_aio.c,v 1.46 2020/02/01 02:23:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_aio.c,v 1.47 2020/03/16 21:20:10 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -73,7 +73,6 @@ u_int aio_listio_max = AIO_LISTIO_MAX;
static u_int aio_max = AIO_MAX;
static u_int aio_jobs_count;
-static struct sysctllog *aio_sysctl;
static struct pool aio_job_pool;
static struct pool aio_lio_pool;
static void * aio_ehook;
@@ -86,7 +85,6 @@ static void aio_exit(proc_t *, void *);
static int sysctl_aio_listio_max(SYSCTLFN_PROTO);
static int sysctl_aio_max(SYSCTLFN_PROTO);
-static int sysctl_aio_init(void);
static const struct syscall_package aio_syscalls[] = {
{ SYS_aio_cancel, 0, (sy_call_t *)sys_aio_cancel },
@@ -127,8 +125,6 @@ aio_fini(bool interface)
return EBUSY;
}
}
- if (aio_sysctl != NULL)
- sysctl_teardown(&aio_sysctl);
KASSERT(aio_jobs_count == 0);
exithook_disestablish(aio_ehook);
@@ -151,11 +147,6 @@ aio_init(void)
"aio_lio_pool", &pool_allocator_nointr, IPL_NONE);
aio_ehook = exithook_establish(aio_exit, NULL);
- error = sysctl_aio_init();
- if (error != 0) {
- (void)aio_fini(false);
- return error;
- }
error = syscall_establish(NULL, aio_syscalls);
if (error != 0)
(void)aio_fini(false);
@@ -1088,14 +1079,11 @@ sysctl_aio_max(SYSCTLFN_ARGS)
return 0;
}
-static int
-sysctl_aio_init(void)
+SYSCTL_SETUP(sysctl_aio_init, "aio sysctl")
{
int rv;
- aio_sysctl = NULL;
-
- rv = sysctl_createv(&aio_sysctl, 0, NULL, NULL,
+ rv = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_IMMEDIATE,
CTLTYPE_INT, "posix_aio",
SYSCTL_DESCR("Version of IEEE Std 1003.1 and its "
@@ -1105,9 +1093,9 @@ sysctl_aio_init(void)
CTL_KERN, CTL_CREATE, CTL_EOL);
if (rv != 0)
- return rv;
+ return;
- rv = sysctl_createv(&aio_sysctl, 0, NULL, NULL,
+ rv = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "aio_listio_max",
SYSCTL_DESCR("Maximum number of asynchronous I/O "
@@ -1116,9 +1104,9 @@ sysctl_aio_init(void)
CTL_KERN, CTL_CREATE, CTL_EOL);
if (rv != 0)
- return rv;
+ return;
- rv = sysctl_createv(&aio_sysctl, 0, NULL, NULL,
+ rv = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "aio_max",
SYSCTL_DESCR("Maximum number of asynchronous I/O "
@@ -1126,7 +1114,7 @@ sysctl_aio_init(void)
sysctl_aio_max, 0, &aio_max, 0,
CTL_KERN, CTL_CREATE, CTL_EOL);
- return rv;
+ return;
}
/*
Index: src/sys/kern/sys_mqueue.c
diff -u src/sys/kern/sys_mqueue.c:1.45 src/sys/kern/sys_mqueue.c:1.46
--- src/sys/kern/sys_mqueue.c:1.45 Sun Sep 15 20:51:03 2019
+++ src/sys/kern/sys_mqueue.c Mon Mar 16 21:20:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_mqueue.c,v 1.45 2019/09/15 20:51:03 christos Exp $ */
+/* $NetBSD: sys_mqueue.c,v 1.46 2020/03/16 21:20:10 pgoyette Exp $ */
/*
* Copyright (c) 2007-2011 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.45 2019/09/15 20:51:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.46 2020/03/16 21:20:10 pgoyette Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -79,13 +79,11 @@ static u_int mq_max_maxmsg = 16 * 32;
static pool_cache_t mqmsg_cache __read_mostly;
static kmutex_t mqlist_lock __cacheline_aligned;
static LIST_HEAD(, mqueue) mqueue_head __cacheline_aligned;
-static struct sysctllog * mqsysctl_log;
static kauth_listener_t mq_listener;
static int mqueue_sysinit(void);
static int mqueue_sysfini(bool);
-static int mqueue_sysctl_init(void);
static int mq_poll_fop(file_t *, int);
static int mq_stat_fop(file_t *, struct stat *);
static int mq_close_fop(file_t *);
@@ -151,15 +149,7 @@ mqueue_sysinit(void)
mutex_init(&mqlist_lock, MUTEX_DEFAULT, IPL_NONE);
LIST_INIT(&mqueue_head);
- error = mqueue_sysctl_init();
- if (error) {
- (void)mqueue_sysfini(false);
- return error;
- }
error = syscall_establish(NULL, mqueue_syscalls);
- if (error) {
- (void)mqueue_sysfini(false);
- }
mq_listener = kauth_listen_scope(KAUTH_SCOPE_SYSTEM,
mq_listener_cb, NULL);
return error;
@@ -188,9 +178,6 @@ mqueue_sysfini(bool interface)
}
}
- if (mqsysctl_log != NULL)
- sysctl_teardown(&mqsysctl_log);
-
kauth_unlisten_scope(mq_listener);
mutex_destroy(&mqlist_lock);
@@ -1148,14 +1135,11 @@ err:
/*
* System control nodes.
*/
-static int
-mqueue_sysctl_init(void)
+SYSCTL_SETUP(mqueue_sysctl_init, "mqueue systl")
{
const struct sysctlnode *node = NULL;
- mqsysctl_log = NULL;
-
- sysctl_createv(&mqsysctl_log, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
CTLTYPE_INT, "posix_msg",
SYSCTL_DESCR("Version of IEEE Std 1003.1 and its "
@@ -1163,7 +1147,7 @@ mqueue_sysctl_init(void)
"system attempts to conform"),
NULL, _POSIX_MESSAGE_PASSING, NULL, 0,
CTL_KERN, CTL_CREATE, CTL_EOL);
- sysctl_createv(&mqsysctl_log, 0, NULL, &node,
+ sysctl_createv(clog, 0, NULL, &node,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "mqueue",
SYSCTL_DESCR("Message queue options"),
@@ -1171,41 +1155,41 @@ mqueue_sysctl_init(void)
CTL_KERN, CTL_CREATE, CTL_EOL);
if (node == NULL)
- return ENXIO;
+ return;
- sysctl_createv(&mqsysctl_log, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "mq_open_max",
SYSCTL_DESCR("Maximal number of message queue descriptors "
"that process could open"),
NULL, 0, &mq_open_max, 0,
CTL_CREATE, CTL_EOL);
- sysctl_createv(&mqsysctl_log, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "mq_prio_max",
SYSCTL_DESCR("Maximal priority of the message"),
NULL, 0, &mq_prio_max, 0,
CTL_CREATE, CTL_EOL);
- sysctl_createv(&mqsysctl_log, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "mq_max_msgsize",
SYSCTL_DESCR("Maximal allowed size of the message"),
NULL, 0, &mq_max_msgsize, 0,
CTL_CREATE, CTL_EOL);
- sysctl_createv(&mqsysctl_log, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "mq_def_maxmsg",
SYSCTL_DESCR("Default maximal message count"),
NULL, 0, &mq_def_maxmsg, 0,
CTL_CREATE, CTL_EOL);
- sysctl_createv(&mqsysctl_log, 0, &node, NULL,
+ sysctl_createv(clog, 0, &node, NULL,
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
CTLTYPE_INT, "mq_max_maxmsg",
SYSCTL_DESCR("Maximal allowed message count"),
NULL, 0, &mq_max_maxmsg, 0,
CTL_CREATE, CTL_EOL);
- return 0;
+ return;
}
/*
Index: src/sys/kern/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.105 src/sys/kern/vfs_wapbl.c:1.106
--- src/sys/kern/vfs_wapbl.c:1.105 Sat Mar 14 15:32:51 2020
+++ src/sys/kern/vfs_wapbl.c Mon Mar 16 21:20:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_wapbl.c,v 1.105 2020/03/14 15:32:51 ad Exp $ */
+/* $NetBSD: vfs_wapbl.c,v 1.106 2020/03/16 21:20:10 pgoyette Exp $ */
/*-
* Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
#define WAPBL_INTERNAL
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.105 2020/03/14 15:32:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.106 2020/03/16 21:20:10 pgoyette Exp $");
#include <sys/param.h>
#include <sys/bitops.h>
@@ -68,7 +68,6 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,
#define wapbl_free(a, s) kmem_free((a), (s))
#define wapbl_calloc(n, s) kmem_zalloc((n)*(s), KM_SLEEP)
-static struct sysctllog *wapbl_sysctl;
static int wapbl_flush_disk_cache = 1;
static int wapbl_verbose_commit = 0;
static int wapbl_allow_dpofua = 0; /* switched off by default for now */
@@ -318,60 +317,57 @@ const struct wapbl_ops wapbl_ops = {
.wo_wapbl_biodone = wapbl_biodone,
};
-static int
-wapbl_sysctl_init(void)
+SYSCTL_SETUP(wapbl_sysctl_init, "wapbl sysctl")
{
int rv;
const struct sysctlnode *rnode, *cnode;
- wapbl_sysctl = NULL;
-
- rv = sysctl_createv(&wapbl_sysctl, 0, NULL, &rnode,
+ rv = sysctl_createv(clog, 0, NULL, &rnode,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "wapbl",
SYSCTL_DESCR("WAPBL journaling options"),
NULL, 0, NULL, 0,
CTL_VFS, CTL_CREATE, CTL_EOL);
if (rv)
- return rv;
+ return;
- rv = sysctl_createv(&wapbl_sysctl, 0, &rnode, &cnode,
+ rv = sysctl_createv(clog, 0, &rnode, &cnode,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "flush_disk_cache",
SYSCTL_DESCR("flush disk cache"),
NULL, 0, &wapbl_flush_disk_cache, 0,
CTL_CREATE, CTL_EOL);
if (rv)
- return rv;
+ return;
- rv = sysctl_createv(&wapbl_sysctl, 0, &rnode, &cnode,
+ rv = sysctl_createv(clog, 0, &rnode, &cnode,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "verbose_commit",
SYSCTL_DESCR("show time and size of wapbl log commits"),
NULL, 0, &wapbl_verbose_commit, 0,
CTL_CREATE, CTL_EOL);
if (rv)
- return rv;
+ return;
- rv = sysctl_createv(&wapbl_sysctl, 0, &rnode, &cnode,
+ rv = sysctl_createv(clog, 0, &rnode, &cnode,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "allow_dpofua",
SYSCTL_DESCR("allow use of FUA/DPO instead of cache flush if available"),
NULL, 0, &wapbl_allow_dpofua, 0,
CTL_CREATE, CTL_EOL);
if (rv)
- return rv;
+ return;
- rv = sysctl_createv(&wapbl_sysctl, 0, &rnode, &cnode,
+ rv = sysctl_createv(clog, 0, &rnode, &cnode,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "journal_iobufs",
SYSCTL_DESCR("count of bufs used for journal I/O (max async count)"),
NULL, 0, &wapbl_journal_iobufs, 0,
CTL_CREATE, CTL_EOL);
if (rv)
- return rv;
+ return;
- return rv;
+ return;
}
static void
@@ -382,17 +378,12 @@ wapbl_init(void)
"wapblentrypl", &pool_allocator_kmem, IPL_VM);
pool_init(&wapbl_dealloc_pool, sizeof(struct wapbl_dealloc), 0, 0, 0,
"wapbldealloc", &pool_allocator_nointr, IPL_NONE);
-
- wapbl_sysctl_init();
}
static int
wapbl_fini(void)
{
- if (wapbl_sysctl != NULL)
- sysctl_teardown(&wapbl_sysctl);
-
pool_destroy(&wapbl_dealloc_pool);
pool_destroy(&wapbl_entry_pool);
Index: src/sys/miscfs/fdesc/fdesc_vfsops.c
diff -u src/sys/miscfs/fdesc/fdesc_vfsops.c:1.93 src/sys/miscfs/fdesc/fdesc_vfsops.c:1.94
--- src/sys/miscfs/fdesc/fdesc_vfsops.c:1.93 Fri Jan 17 20:08:09 2020
+++ src/sys/miscfs/fdesc/fdesc_vfsops.c Mon Mar 16 21:20:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdesc_vfsops.c,v 1.93 2020/01/17 20:08:09 ad Exp $ */
+/* $NetBSD: fdesc_vfsops.c,v 1.94 2020/03/16 21:20:11 pgoyette Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.93 2020/01/17 20:08:09 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.94 2020/03/16 21:20:11 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -263,16 +263,9 @@ struct vfsops fdesc_vfsops = {
.vfs_opv_descs = fdesc_vnodeopv_descs
};
-static int
-fdesc_modcmd(modcmd_t cmd, void *arg)
+SYSCTL_SETUP(fdesc_sysctl_setup, "fdesc sysctl")
{
- int error;
- switch (cmd) {
- case MODULE_CMD_INIT:
- error = vfs_attach(&fdesc_vfsops);
- if (error != 0)
- break;
sysctl_createv(&fdesc_sysctl_log, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "fdesc",
@@ -284,12 +277,23 @@ fdesc_modcmd(modcmd_t cmd, void *arg)
* more instance of the "number to vfs" mapping problem, but
* "7" is the order as taken from sys/mount.h
*/
+}
+
+static int
+fdesc_modcmd(modcmd_t cmd, void *arg)
+{
+ int error;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ error = vfs_attach(&fdesc_vfsops);
+ if (error != 0)
+ break;
break;
case MODULE_CMD_FINI:
error = vfs_detach(&fdesc_vfsops);
if (error != 0)
break;
- sysctl_teardown(&fdesc_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/miscfs/kernfs/kernfs_vfsops.c
diff -u src/sys/miscfs/kernfs/kernfs_vfsops.c:1.98 src/sys/miscfs/kernfs/kernfs_vfsops.c:1.99
--- src/sys/miscfs/kernfs/kernfs_vfsops.c:1.98 Tue Feb 4 04:19:24 2020
+++ src/sys/miscfs/kernfs/kernfs_vfsops.c Mon Mar 16 21:20:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kernfs_vfsops.c,v 1.98 2020/02/04 04:19:24 riastradh Exp $ */
+/* $NetBSD: kernfs_vfsops.c,v 1.99 2020/03/16 21:20:11 pgoyette Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.98 2020/02/04 04:19:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.99 2020/03/16 21:20:11 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -74,8 +74,6 @@ VFS_PROTOS(kernfs);
void kernfs_get_rrootdev(void);
-static struct sysctllog *kernfs_sysctl_log;
-
void
kernfs_init(void)
{
@@ -328,6 +326,22 @@ struct vfsops kernfs_vfsops = {
.vfs_opv_descs = kernfs_vnodeopv_descs
};
+SYSCTL_SETUP(kernfs_sysctl_setup, "kernfs sysctl")
+{
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "kernfs",
+ SYSCTL_DESCR("/kern file system"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 11, CTL_EOL);
+ /*
+ * XXX the "11" above could be dynamic, thereby eliminating one
+ * more instance of the "number to vfs" mapping problem, but
+ * "11" is the order as taken from sys/mount.h
+ */
+}
+
static int
kernfs_modcmd(modcmd_t cmd, void *arg)
{
@@ -338,23 +352,11 @@ kernfs_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&kernfs_vfsops);
if (error != 0)
break;
- sysctl_createv(&kernfs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "kernfs",
- SYSCTL_DESCR("/kern file system"),
- NULL, 0, NULL, 0,
- CTL_VFS, 11, CTL_EOL);
- /*
- * XXX the "11" above could be dynamic, thereby eliminating one
- * more instance of the "number to vfs" mapping problem, but
- * "11" is the order as taken from sys/mount.h
- */
break;
case MODULE_CMD_FINI:
error = vfs_detach(&kernfs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&kernfs_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/miscfs/nullfs/null_vfsops.c
diff -u src/sys/miscfs/nullfs/null_vfsops.c:1.96 src/sys/miscfs/nullfs/null_vfsops.c:1.97
--- src/sys/miscfs/nullfs/null_vfsops.c:1.96 Sun Dec 15 20:30:56 2019
+++ src/sys/miscfs/nullfs/null_vfsops.c Mon Mar 16 21:20:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: null_vfsops.c,v 1.96 2019/12/15 20:30:56 joerg Exp $ */
+/* $NetBSD: null_vfsops.c,v 1.97 2020/03/16 21:20:11 pgoyette Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.96 2019/12/15 20:30:56 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.97 2020/03/16 21:20:11 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -93,8 +93,6 @@ MODULE(MODULE_CLASS_VFS, null, "layerfs"
VFS_PROTOS(nullfs);
-static struct sysctllog *nullfs_sysctl_log;
-
int
nullfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
{
@@ -238,6 +236,22 @@ struct vfsops nullfs_vfsops = {
.vfs_opv_descs = nullfs_vnodeopv_descs
};
+SYSCTL_SETUP(nullfs_sysctl_setup, "nullfs sysctl")
+{
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "null",
+ SYSCTL_DESCR("Loopback file system"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 9, CTL_EOL);
+ /*
+ * XXX the "9" above could be dynamic, thereby eliminating
+ * one more instance of the "number to vfs" mapping problem,
+ * but "9" is the order as taken from sys/mount.h
+ */
+}
+
static int
null_modcmd(modcmd_t cmd, void *arg)
{
@@ -248,23 +262,11 @@ null_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&nullfs_vfsops);
if (error != 0)
break;
- sysctl_createv(&nullfs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "null",
- SYSCTL_DESCR("Loopback file system"),
- NULL, 0, NULL, 0,
- CTL_VFS, 9, CTL_EOL);
- /*
- * XXX the "9" above could be dynamic, thereby eliminating
- * one more instance of the "number to vfs" mapping problem,
- * but "9" is the order as taken from sys/mount.h
- */
break;
case MODULE_CMD_FINI:
error = vfs_detach(&nullfs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&nullfs_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/miscfs/overlay/overlay_vfsops.c
diff -u src/sys/miscfs/overlay/overlay_vfsops.c:1.68 src/sys/miscfs/overlay/overlay_vfsops.c:1.69
--- src/sys/miscfs/overlay/overlay_vfsops.c:1.68 Wed Feb 20 10:06:00 2019
+++ src/sys/miscfs/overlay/overlay_vfsops.c Mon Mar 16 21:20:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: overlay_vfsops.c,v 1.68 2019/02/20 10:06:00 hannken Exp $ */
+/* $NetBSD: overlay_vfsops.c,v 1.69 2020/03/16 21:20:11 pgoyette Exp $ */
/*
* Copyright (c) 1999, 2000 National Aeronautics & Space Administration
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.68 2019/02/20 10:06:00 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.69 2020/03/16 21:20:11 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -270,6 +270,16 @@ struct vfsops overlay_vfsops = {
.vfs_opv_descs = ov_vnodeopv_descs
};
+SYSCTL_SETUP(overlay_sysctl_setup, "overlay fs sysctl")
+{
+
+ sysctl_createv(&overlay_sysctl_log, 0, NULL, NULL,
+ CTLFLAG_PERMANENT, CTLTYPE_NODE, "overlay",
+ SYSCTL_DESCR("Overlay file system"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, CTL_CREATE, CTL_EOL);
+}
+
static int
overlay_modcmd(modcmd_t cmd, void *arg)
{
@@ -280,17 +290,11 @@ overlay_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&overlay_vfsops);
if (error != 0)
break;
- sysctl_createv(&overlay_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT, CTLTYPE_NODE, "overlay",
- SYSCTL_DESCR("Overlay file system"),
- NULL, 0, NULL, 0,
- CTL_VFS, CTL_CREATE, CTL_EOL);
break;
case MODULE_CMD_FINI:
error = vfs_detach(&overlay_vfsops);
if (error != 0)
break;
- sysctl_teardown(&overlay_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/miscfs/procfs/procfs_vfsops.c
diff -u src/sys/miscfs/procfs/procfs_vfsops.c:1.102 src/sys/miscfs/procfs/procfs_vfsops.c:1.103
--- src/sys/miscfs/procfs/procfs_vfsops.c:1.102 Fri Jan 17 20:08:09 2020
+++ src/sys/miscfs/procfs/procfs_vfsops.c Mon Mar 16 21:20:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_vfsops.c,v 1.102 2020/01/17 20:08:09 ad Exp $ */
+/* $NetBSD: procfs_vfsops.c,v 1.103 2020/03/16 21:20:11 pgoyette Exp $ */
/*
* Copyright (c) 1993
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.102 2020/01/17 20:08:09 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.103 2020/03/16 21:20:11 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -109,8 +109,6 @@ MODULE(MODULE_CLASS_VFS, procfs, "ptrace
VFS_PROTOS(procfs);
-static struct sysctllog *procfs_sysctl_log;
-
static kauth_listener_t procfs_listener;
/*
@@ -518,6 +516,21 @@ procfs_listener_cb(kauth_cred_t cred, ka
return result;
}
+SYSCTL_SETUP(procfs_sysctl_setup, "procfs sysctl")
+{
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "procfs",
+ SYSCTL_DESCR("Process file system"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 12, CTL_EOL);
+ /*
+ * XXX the "12" above could be dynamic, thereby eliminating
+ * one more instance of the "number to vfs" mapping problem,
+ * but "12" is the order as taken from sys/mount.h
+ */
+}
static int
procfs_modcmd(modcmd_t cmd, void *arg)
@@ -529,17 +542,6 @@ procfs_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&procfs_vfsops);
if (error != 0)
break;
- sysctl_createv(&procfs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "procfs",
- SYSCTL_DESCR("Process file system"),
- NULL, 0, NULL, 0,
- CTL_VFS, 12, CTL_EOL);
- /*
- * XXX the "12" above could be dynamic, thereby eliminating
- * one more instance of the "number to vfs" mapping problem,
- * but "12" is the order as taken from sys/mount.h
- */
procfs_listener = kauth_listen_scope(KAUTH_SCOPE_PROCESS,
procfs_listener_cb, NULL);
@@ -549,7 +551,6 @@ procfs_modcmd(modcmd_t cmd, void *arg)
error = vfs_detach(&procfs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&procfs_sysctl_log);
kauth_unlisten_scope(procfs_listener);
break;
default:
Index: src/sys/miscfs/umapfs/umap_vfsops.c
diff -u src/sys/miscfs/umapfs/umap_vfsops.c:1.101 src/sys/miscfs/umapfs/umap_vfsops.c:1.102
--- src/sys/miscfs/umapfs/umap_vfsops.c:1.101 Tue Aug 20 20:18:54 2019
+++ src/sys/miscfs/umapfs/umap_vfsops.c Mon Mar 16 21:20:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: umap_vfsops.c,v 1.101 2019/08/20 20:18:54 perseant Exp $ */
+/* $NetBSD: umap_vfsops.c,v 1.102 2020/03/16 21:20:11 pgoyette Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.101 2019/08/20 20:18:54 perseant Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.102 2020/03/16 21:20:11 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -62,8 +62,6 @@ MODULE(MODULE_CLASS_VFS, umap, "layerfs"
VFS_PROTOS(umapfs);
-static struct sysctllog *umapfs_sysctl_log;
-
/*
* Mount umap layer
*/
@@ -328,6 +326,22 @@ struct vfsops umapfs_vfsops = {
.vfs_opv_descs = umapfs_vnodeopv_descs
};
+SYSCTL_SETUP(umapfs_sysctl_setup, "umapfs sysctl")
+{
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "umap",
+ SYSCTL_DESCR("UID/GID remapping file system"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 10, CTL_EOL);
+ /*
+ * XXX the "10" above could be dynamic, thereby eliminating
+ * one more instance of the "number to vfs" mapping problem,
+ * but "10" is the order as taken from sys/mount.h
+ */
+}
+
static int
umap_modcmd(modcmd_t cmd, void *arg)
{
@@ -338,23 +352,11 @@ umap_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&umapfs_vfsops);
if (error != 0)
break;
- sysctl_createv(&umapfs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "umap",
- SYSCTL_DESCR("UID/GID remapping file system"),
- NULL, 0, NULL, 0,
- CTL_VFS, 10, CTL_EOL);
- /*
- * XXX the "10" above could be dynamic, thereby eliminating
- * one more instance of the "number to vfs" mapping problem,
- * but "10" is the order as taken from sys/mount.h
- */
break;
case MODULE_CMD_FINI:
error = vfs_detach(&umapfs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&umapfs_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/net/bpf.c
diff -u src/sys/net/bpf.c:1.235 src/sys/net/bpf.c:1.236
--- src/sys/net/bpf.c:1.235 Fri Feb 7 12:35:33 2020
+++ src/sys/net/bpf.c Mon Mar 16 21:20:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf.c,v 1.235 2020/02/07 12:35:33 thorpej Exp $ */
+/* $NetBSD: bpf.c,v 1.236 2020/03/16 21:20:11 pgoyette Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.235 2020/02/07 12:35:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.236 2020/03/16 21:20:11 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_bpf.h"
@@ -2427,14 +2427,12 @@ bpf_sysctl_gstats_handler(SYSCTLFN_ARGS)
return 0;
}
-static struct sysctllog *bpf_sysctllog;
-static void
-sysctl_net_bpf_setup(void)
+SYSCTL_SETUP(sysctl_net_bpf_setup, "bpf sysctls")
{
const struct sysctlnode *node;
node = NULL;
- sysctl_createv(&bpf_sysctllog, 0, NULL, &node,
+ sysctl_createv(clog, 0, NULL, &node,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "bpf",
SYSCTL_DESCR("BPF options"),
@@ -2442,26 +2440,26 @@ sysctl_net_bpf_setup(void)
CTL_NET, CTL_CREATE, CTL_EOL);
if (node != NULL) {
#if defined(MODULAR) || defined(BPFJIT)
- sysctl_createv(&bpf_sysctllog, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_BOOL, "jit",
SYSCTL_DESCR("Toggle Just-In-Time compilation"),
sysctl_net_bpf_jit, 0, &bpf_jit, 0,
CTL_NET, node->sysctl_num, CTL_CREATE, CTL_EOL);
#endif
- sysctl_createv(&bpf_sysctllog, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "maxbufsize",
SYSCTL_DESCR("Maximum size for data capture buffer"),
sysctl_net_bpf_maxbufsize, 0, &bpf_maxbufsize, 0,
CTL_NET, node->sysctl_num, CTL_CREATE, CTL_EOL);
- sysctl_createv(&bpf_sysctllog, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRUCT, "stats",
SYSCTL_DESCR("BPF stats"),
bpf_sysctl_gstats_handler, 0, NULL, 0,
CTL_NET, node->sysctl_num, CTL_CREATE, CTL_EOL);
- sysctl_createv(&bpf_sysctllog, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRUCT, "peers",
SYSCTL_DESCR("BPF peers"),
@@ -2510,7 +2508,6 @@ bpf_modcmd(modcmd_t cmd, void *arg)
bpf_ops_handover_enter(&bpf_ops_kernel);
atomic_swap_ptr(&bpf_ops, &bpf_ops_kernel);
bpf_ops_handover_exit();
- sysctl_net_bpf_setup();
break;
case MODULE_CMD_FINI:
@@ -2535,7 +2532,6 @@ bpf_modcmd(modcmd_t cmd, void *arg)
* disable packet capture.
*/
error = EOPNOTSUPP;
- /* insert sysctl teardown */
break;
default:
Index: src/sys/netinet/accf_http.c
diff -u src/sys/netinet/accf_http.c:1.9 src/sys/netinet/accf_http.c:1.10
--- src/sys/netinet/accf_http.c:1.9 Thu Aug 20 14:40:19 2015
+++ src/sys/netinet/accf_http.c Mon Mar 16 21:20:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: accf_http.c,v 1.9 2015/08/20 14:40:19 christos Exp $ */
+/* $NetBSD: accf_http.c,v 1.10 2020/03/16 21:20:11 pgoyette Exp $ */
/*-
* Copyright (c) 2000 Paycounter, Inc.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: accf_http.c,v 1.9 2015/08/20 14:40:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: accf_http.c,v 1.10 2020/03/16 21:20:11 pgoyette Exp $");
#define ACCEPT_FILTER_MOD
@@ -80,51 +80,48 @@ accf_httpattach(int junk)
}
+SYSCTL_SETUP(accf_sysctl_setup, "accf sysctl")
+{
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "inet", NULL,
+ NULL, 0, NULL, 0,
+ CTL_NET, PF_INET, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "accf", NULL,
+ NULL, 0, NULL, 0,
+ CTL_NET, PF_INET, SO_ACCEPTFILTER, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "http",
+ SYSCTL_DESCR("HTTP accept filter"),
+ NULL, 0, NULL, 0,
+ CTL_NET, PF_INET, SO_ACCEPTFILTER, ACCF_HTTP, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "parsehttpversion",
+ SYSCTL_DESCR("Parse http version so that non "
+ "1.x requests work"),
+ NULL, 0, &parse_http_version, 0,
+ CTL_NET, PF_INET, SO_ACCEPTFILTER, ACCF_HTTP,
+ ACCFCTL_PARSEVER, CTL_EOL);
+}
+
static int
accf_httpready_modcmd(modcmd_t cmd, void *arg)
{
- static struct sysctllog *clog;
int error;
switch (cmd) {
case MODULE_CMD_INIT:
error = accept_filt_add(&accf_http_filter);
- if (error != 0) {
- return error;
- }
- sysctl_createv(&clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "inet", NULL,
- NULL, 0, NULL, 0,
- CTL_NET, PF_INET, CTL_EOL);
- sysctl_createv(&clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "accf", NULL,
- NULL, 0, NULL, 0,
- CTL_NET, PF_INET, SO_ACCEPTFILTER, CTL_EOL);
- sysctl_createv(&clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "http",
- SYSCTL_DESCR("HTTP accept filter"),
- NULL, 0, NULL, 0,
- CTL_NET, PF_INET, SO_ACCEPTFILTER, ACCF_HTTP, CTL_EOL);
- sysctl_createv(&clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "parsehttpversion",
- SYSCTL_DESCR("Parse http version so that non "
- "1.x requests work"),
- NULL, 0, &parse_http_version, 0,
- CTL_NET, PF_INET, SO_ACCEPTFILTER, ACCF_HTTP,
- ACCFCTL_PARSEVER, CTL_EOL);
return 0;
case MODULE_CMD_FINI:
error = accept_filt_del(&accf_http_filter);
- if (error != 0) {
- return error;
- }
- sysctl_teardown(&clog);
- return 0;
+ return error;
default:
return ENOTTY;
Index: src/sys/nfs/nfs_vfsops.c
diff -u src/sys/nfs/nfs_vfsops.c:1.239 src/sys/nfs/nfs_vfsops.c:1.240
--- src/sys/nfs/nfs_vfsops.c:1.239 Thu Feb 27 22:12:54 2020
+++ src/sys/nfs/nfs_vfsops.c Mon Mar 16 21:20:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_vfsops.c,v 1.239 2020/02/27 22:12:54 ad Exp $ */
+/* $NetBSD: nfs_vfsops.c,v 1.240 2020/03/16 21:20:11 pgoyette Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.239 2020/02/27 22:12:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.240 2020/03/16 21:20:11 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_nfs.h"
@@ -131,12 +131,9 @@ struct vfsops nfs_vfsops = {
extern u_int32_t nfs_procids[NFS_NPROCS];
extern u_int32_t nfs_prog, nfs_vers;
-static struct sysctllog *nfs_clog;
static int nfs_mount_diskless(struct nfs_dlmount *, const char *,
struct mount **, struct vnode **, struct lwp *);
-static void nfs_sysctl_init(void);
-static void nfs_sysctl_fini(void);
static int
nfs_modcmd(modcmd_t cmd, void *arg)
@@ -146,15 +143,9 @@ nfs_modcmd(modcmd_t cmd, void *arg)
switch (cmd) {
case MODULE_CMD_INIT:
error = vfs_attach(&nfs_vfsops);
- if (error == 0) {
- nfs_sysctl_init();
- }
return error;
case MODULE_CMD_FINI:
error = vfs_detach(&nfs_vfsops);
- if (error == 0) {
- nfs_sysctl_fini();
- }
return error;
default:
return ENOTTY;
@@ -1032,11 +1023,10 @@ sysctl_vfs_nfs_iothreads(SYSCTLFN_ARGS)
return nfs_set_niothreads(val);
}
-static void
-nfs_sysctl_init(void)
+SYSCTL_SETUP(nfs_sysctl_init, "nfs sysctl")
{
- sysctl_createv(&nfs_clog, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "nfs",
SYSCTL_DESCR("NFS vfs options"),
@@ -1048,13 +1038,13 @@ nfs_sysctl_init(void)
* "2" is the order as taken from sys/mount.h
*/
- sysctl_createv(&nfs_clog, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRUCT, "nfsstats",
SYSCTL_DESCR("NFS operation statistics"),
NULL, 0, &nfsstats, sizeof(nfsstats),
CTL_VFS, 2, NFS_NFSSTATS, CTL_EOL);
- sysctl_createv(&nfs_clog, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "iothreads",
SYSCTL_DESCR("Number of NFS client processes desired"),
@@ -1062,13 +1052,6 @@ nfs_sysctl_init(void)
CTL_VFS, 2, NFS_IOTHREADS, CTL_EOL);
}
-static void
-nfs_sysctl_fini(void)
-{
-
- sysctl_teardown(&nfs_clog);
-}
-
/* ARGSUSED */
int
nfs_fhtovp(struct mount *mp, struct fid *fid, int lktype, struct vnode **vpp)
Index: src/sys/opencrypto/crypto.c
diff -u src/sys/opencrypto/crypto.c:1.112 src/sys/opencrypto/crypto.c:1.113
--- src/sys/opencrypto/crypto.c:1.112 Sat Feb 1 13:48:08 2020
+++ src/sys/opencrypto/crypto.c Mon Mar 16 21:20:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: crypto.c,v 1.112 2020/02/01 13:48:08 riastradh Exp $ */
+/* $NetBSD: crypto.c,v 1.113 2020/03/16 21:20:12 pgoyette Exp $ */
/* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $ */
/* $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.112 2020/02/01 13:48:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.113 2020/03/16 21:20:12 pgoyette Exp $");
#include <sys/param.h>
#include <sys/reboot.h>
@@ -383,8 +383,7 @@ int crypto_userasymcrypto = 1; /* userla
*/
int crypto_devallowsoft = 1; /* only use hardware crypto */
-static void
-sysctl_opencrypto_setup(struct sysctllog **clog)
+SYSCTL_SETUP(sysctl_opencrypto_setup, "opencrypto sysctl")
{
const struct sysctlnode *ocnode;
const struct sysctlnode *retqnode, *retkqnode;
@@ -519,8 +518,6 @@ static struct cryptostats cryptostats;
static int crypto_timing = 0;
#endif
-static struct sysctllog *sysctl_opencrypto_clog;
-
static void
crypto_crp_ret_qs_init(void)
{
@@ -587,8 +584,6 @@ crypto_init0(void)
return crypto_destroy(false);
}
- sysctl_opencrypto_setup(&sysctl_opencrypto_clog);
-
return 0;
}
@@ -655,9 +650,6 @@ crypto_destroy(bool exit_kthread)
}
}
- if (sysctl_opencrypto_clog != NULL)
- sysctl_teardown(&sysctl_opencrypto_clog);
-
if (crypto_ret_si != NULL)
softint_disestablish(crypto_ret_si);
Index: src/sys/secmodel/bsd44/bsd44.h
diff -u src/sys/secmodel/bsd44/bsd44.h:1.6 src/sys/secmodel/bsd44/bsd44.h:1.7
--- src/sys/secmodel/bsd44/bsd44.h:1.6 Sun Dec 4 19:25:00 2011
+++ src/sys/secmodel/bsd44/bsd44.h Mon Mar 16 21:20:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bsd44.h,v 1.6 2011/12/04 19:25:00 jym Exp $ */
+/* $NetBSD: bsd44.h,v 1.7 2020/03/16 21:20:12 pgoyette Exp $ */
/*-
* Copyright (c) 2006 Elad Efrat <[email protected]>
* All rights reserved.
@@ -36,6 +36,4 @@ void secmodel_bsd44_init(void);
void secmodel_bsd44_start(void);
void secmodel_bsd44_stop(void);
-void sysctl_security_bsd44_setup(struct sysctllog **);
-
#endif /* !_SECMODEL_BSD44_BSD44_H_ */
Index: src/sys/secmodel/bsd44/secmodel_bsd44.c
diff -u src/sys/secmodel/bsd44/secmodel_bsd44.c:1.16 src/sys/secmodel/bsd44/secmodel_bsd44.c:1.17
--- src/sys/secmodel/bsd44/secmodel_bsd44.c:1.16 Tue Feb 25 18:30:13 2014
+++ src/sys/secmodel/bsd44/secmodel_bsd44.c Mon Mar 16 21:20:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_bsd44.c,v 1.16 2014/02/25 18:30:13 pooka Exp $ */
+/* $NetBSD: secmodel_bsd44.c,v 1.17 2020/03/16 21:20:12 pgoyette Exp $ */
/*-
* Copyright (c) 2006 Elad Efrat <[email protected]>
* All rights reserved.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: secmodel_bsd44.c,v 1.16 2014/02/25 18:30:13 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_bsd44.c,v 1.17 2020/03/16 21:20:12 pgoyette Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -46,10 +46,8 @@ __KERNEL_RCSID(0, "$NetBSD: secmodel_bsd
MODULE(MODULE_CLASS_SECMODEL, secmodel_bsd44, "suser,securelevel,extensions");
static secmodel_t bsd44_sm;
-static struct sysctllog *sysctl_bsd44_log;
-void
-sysctl_security_bsd44_setup(struct sysctllog **clog)
+SYSCTL_SETUP(sysctl_security_bsd44_setup, "secmodel_bsd44 sysctl")
{
const struct sysctlnode *rnode;
@@ -108,11 +106,9 @@ secmodel_bsd44_modcmd(modcmd_t cmd, void
secmodel_bsd44_init();
secmodel_bsd44_start();
- sysctl_security_bsd44_setup(&sysctl_bsd44_log);
break;
case MODULE_CMD_FINI:
- sysctl_teardown(&sysctl_bsd44_log);
secmodel_bsd44_stop();
error = secmodel_deregister(bsd44_sm);
Index: src/sys/secmodel/extensions/secmodel_extensions.c
diff -u src/sys/secmodel/extensions/secmodel_extensions.c:1.11 src/sys/secmodel/extensions/secmodel_extensions.c:1.12
--- src/sys/secmodel/extensions/secmodel_extensions.c:1.11 Fri Feb 21 00:26:23 2020
+++ src/sys/secmodel/extensions/secmodel_extensions.c Mon Mar 16 21:20:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_extensions.c,v 1.11 2020/02/21 00:26:23 joerg Exp $ */
+/* $NetBSD: secmodel_extensions.c,v 1.12 2020/03/16 21:20:12 pgoyette Exp $ */
/*-
* Copyright (c) 2011 Elad Efrat <[email protected]>
* All rights reserved.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: secmodel_extensions.c,v 1.11 2020/02/21 00:26:23 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_extensions.c,v 1.12 2020/03/16 21:20:12 pgoyette Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -57,7 +57,6 @@ int user_set_dbregs;
static kauth_listener_t l_system, l_process, l_network;
static secmodel_t extensions_sm;
-static struct sysctllog *extensions_sysctl_log;
static void secmodel_extensions_init(void);
static void secmodel_extensions_start(void);
@@ -75,8 +74,8 @@ static int secmodel_extensions_process_c
static int secmodel_extensions_network_cb(kauth_cred_t, kauth_action_t,
void *, void *, void *, void *, void *);
-static void
-sysctl_security_extensions_setup(struct sysctllog **clog)
+SYSCTL_SETUP(sysctl_security_extensions_setup,
+ "security extensions sysctl")
{
const struct sysctlnode *rnode, *rnode2;
@@ -308,11 +307,9 @@ extensions_modcmd(modcmd_t cmd, void *ar
secmodel_extensions_init();
secmodel_extensions_start();
- sysctl_security_extensions_setup(&extensions_sysctl_log);
break;
case MODULE_CMD_FINI:
- sysctl_teardown(&extensions_sysctl_log);
secmodel_extensions_stop();
error = secmodel_deregister(extensions_sm);
Index: src/sys/secmodel/overlay/secmodel_overlay.c
diff -u src/sys/secmodel/overlay/secmodel_overlay.c:1.13 src/sys/secmodel/overlay/secmodel_overlay.c:1.14
--- src/sys/secmodel/overlay/secmodel_overlay.c:1.13 Tue Feb 25 18:30:13 2014
+++ src/sys/secmodel/overlay/secmodel_overlay.c Mon Mar 16 21:20:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_overlay.c,v 1.13 2014/02/25 18:30:13 pooka Exp $ */
+/* $NetBSD: secmodel_overlay.c,v 1.14 2020/03/16 21:20:12 pgoyette Exp $ */
/*-
* Copyright (c) 2006 Elad Efrat <[email protected]>
* All rights reserved.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: secmodel_overlay.c,v 1.13 2014/02/25 18:30:13 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_overlay.c,v 1.14 2020/03/16 21:20:12 pgoyette Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -68,7 +68,6 @@ static kauth_listener_t l_generic, l_sys
l_device, l_vnode;
static secmodel_t overlay_sm;
-static struct sysctllog *sysctl_overlay_log;
/*
* Initialize the overlay security model.
@@ -127,8 +126,7 @@ secmodel_overlay_init(void)
secmodel_securelevel_device_cb, NULL);
}
-void
-sysctl_security_overlay_setup(struct sysctllog **clog)
+SYSCTL_SETUP(sysctl_security_overlay_setup, "secmod overlay sysctl")
{
const struct sysctlnode *rnode;
@@ -207,11 +205,9 @@ secmodel_overlay_modcmd(modcmd_t cmd, vo
secmodel_suser_stop();
secmodel_securelevel_stop();
secmodel_overlay_start();
- sysctl_security_overlay_setup(&sysctl_overlay_log);
break;
case MODULE_CMD_FINI:
- sysctl_teardown(&sysctl_overlay_log);
secmodel_overlay_stop();
error = secmodel_deregister(overlay_sm);
Index: src/sys/secmodel/securelevel/secmodel_securelevel.c
diff -u src/sys/secmodel/securelevel/secmodel_securelevel.c:1.33 src/sys/secmodel/securelevel/secmodel_securelevel.c:1.34
--- src/sys/secmodel/securelevel/secmodel_securelevel.c:1.33 Fri Feb 21 00:26:23 2020
+++ src/sys/secmodel/securelevel/secmodel_securelevel.c Mon Mar 16 21:20:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_securelevel.c,v 1.33 2020/02/21 00:26:23 joerg Exp $ */
+/* $NetBSD: secmodel_securelevel.c,v 1.34 2020/03/16 21:20:12 pgoyette Exp $ */
/*-
* Copyright (c) 2006 Elad Efrat <[email protected]>
* All rights reserved.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: secmodel_securelevel.c,v 1.33 2020/02/21 00:26:23 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_securelevel.c,v 1.34 2020/03/16 21:20:12 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_insecure.h"
@@ -65,7 +65,6 @@ static kauth_listener_t l_system, l_proc
l_vnode;
static secmodel_t securelevel_sm;
-static struct sysctllog *securelevel_sysctl_log;
/*
* Sysctl helper routine for securelevel. Ensures that the value only rises
@@ -92,8 +91,7 @@ secmodel_securelevel_sysctl(SYSCTLFN_ARG
return (error);
}
-void
-sysctl_security_securelevel_setup(struct sysctllog **clog)
+SYSCTL_SETUP(sysctl_security_securelevel_setup, "securelevel sysctl")
{
const struct sysctlnode *rnode, *rnode2;
@@ -219,11 +217,9 @@ securelevel_modcmd(modcmd_t cmd, void *a
"returned %d\n", error);
secmodel_securelevel_start();
- sysctl_security_securelevel_setup(&securelevel_sysctl_log);
break;
case MODULE_CMD_FINI:
- sysctl_teardown(&securelevel_sysctl_log);
secmodel_securelevel_stop();
error = secmodel_deregister(securelevel_sm);
Index: src/sys/secmodel/securelevel/securelevel.h
diff -u src/sys/secmodel/securelevel/securelevel.h:1.4 src/sys/secmodel/securelevel/securelevel.h:1.5
--- src/sys/secmodel/securelevel/securelevel.h:1.4 Sun Dec 4 19:25:00 2011
+++ src/sys/secmodel/securelevel/securelevel.h Mon Mar 16 21:20:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: securelevel.h,v 1.4 2011/12/04 19:25:00 jym Exp $ */
+/* $NetBSD: securelevel.h,v 1.5 2020/03/16 21:20:12 pgoyette Exp $ */
/*-
* Copyright (c) 2006 Elad Efrat <[email protected]>
* All rights reserved.
@@ -38,8 +38,6 @@ void secmodel_securelevel_init(void);
void secmodel_securelevel_start(void);
void secmodel_securelevel_stop(void);
-void sysctl_security_securelevel_setup(struct sysctllog **);
-
int secmodel_securelevel_system_cb(kauth_cred_t, kauth_action_t, void *,
void *, void *, void *, void *);
int secmodel_securelevel_process_cb(kauth_cred_t, kauth_action_t, void *,
Index: src/sys/secmodel/suser/secmodel_suser.c
diff -u src/sys/secmodel/suser/secmodel_suser.c:1.51 src/sys/secmodel/suser/secmodel_suser.c:1.52
--- src/sys/secmodel/suser/secmodel_suser.c:1.51 Fri Feb 21 00:26:23 2020
+++ src/sys/secmodel/suser/secmodel_suser.c Mon Mar 16 21:20:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_suser.c,v 1.51 2020/02/21 00:26:23 joerg Exp $ */
+/* $NetBSD: secmodel_suser.c,v 1.52 2020/03/16 21:20:12 pgoyette Exp $ */
/*-
* Copyright (c) 2006 Elad Efrat <[email protected]>
* All rights reserved.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: secmodel_suser.c,v 1.51 2020/02/21 00:26:23 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_suser.c,v 1.52 2020/03/16 21:20:12 pgoyette Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -61,10 +61,8 @@ static kauth_listener_t l_generic, l_sys
l_device, l_vnode;
static secmodel_t suser_sm;
-static struct sysctllog *suser_sysctl_log;
-void
-sysctl_security_suser_setup(struct sysctllog **clog)
+SYSCTL_SETUP(sysctl_security_suser_setup, "secmodel_user sysctl")
{
const struct sysctlnode *rnode;
@@ -163,11 +161,9 @@ suser_modcmd(modcmd_t cmd, void *arg)
secmodel_suser_init();
secmodel_suser_start();
- sysctl_security_suser_setup(&suser_sysctl_log);
break;
case MODULE_CMD_FINI:
- sysctl_teardown(&suser_sysctl_log);
secmodel_suser_stop();
error = secmodel_deregister(suser_sm);
Index: src/sys/secmodel/suser/suser.h
diff -u src/sys/secmodel/suser/suser.h:1.2 src/sys/secmodel/suser/suser.h:1.3
--- src/sys/secmodel/suser/suser.h:1.2 Sun Dec 4 19:25:01 2011
+++ src/sys/secmodel/suser/suser.h Mon Mar 16 21:20:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: suser.h,v 1.2 2011/12/04 19:25:01 jym Exp $ */
+/* $NetBSD: suser.h,v 1.3 2020/03/16 21:20:12 pgoyette Exp $ */
/*-
* Copyright (c) 2006 Elad Efrat <[email protected]>
* All rights reserved.
@@ -36,8 +36,6 @@ void secmodel_suser_init(void);
void secmodel_suser_start(void);
void secmodel_suser_stop(void);
-void sysctl_security_suser_setup(struct sysctllog **);
-
int secmodel_suser_generic_cb(kauth_cred_t, kauth_action_t, void *,
void *, void *, void *, void *);
int secmodel_suser_system_cb(kauth_cred_t, kauth_action_t, void *,
Index: src/sys/ufs/ext2fs/ext2fs_vfsops.c
diff -u src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.216 src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.217
--- src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.216 Thu Feb 27 22:12:54 2020
+++ src/sys/ufs/ext2fs/ext2fs_vfsops.c Mon Mar 16 21:20:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_vfsops.c,v 1.216 2020/02/27 22:12:54 ad Exp $ */
+/* $NetBSD: ext2fs_vfsops.c,v 1.217 2020/03/16 21:20:12 pgoyette Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.216 2020/02/27 22:12:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.217 2020/03/16 21:20:12 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -105,8 +105,6 @@ MODULE(MODULE_CLASS_VFS, ext2fs, "ufs");
int ext2fs_sbupdate(struct ufsmount *, int);
static int ext2fs_sbfill(struct m_ext2fs *, int);
-static struct sysctllog *ext2fs_sysctl_log;
-
extern const struct vnodeopv_desc ext2fs_vnodeop_opv_desc;
extern const struct vnodeopv_desc ext2fs_specop_opv_desc;
extern const struct vnodeopv_desc ext2fs_fifoop_opv_desc;
@@ -174,17 +172,10 @@ ext2fs_set_inode_guid(struct inode *ip)
}
}
-static int
-ext2fs_modcmd(modcmd_t cmd, void *arg)
+SYSCTL_SETUP(ext2fs_sysctl_setup, "ext2fs sysctl")
{
- int error;
- switch (cmd) {
- case MODULE_CMD_INIT:
- error = vfs_attach(&ext2fs_vfsops);
- if (error != 0)
- break;
- sysctl_createv(&ext2fs_sysctl_log, 0, NULL, NULL,
+ sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "ext2fs",
SYSCTL_DESCR("Linux EXT2FS file system"),
@@ -195,12 +186,23 @@ ext2fs_modcmd(modcmd_t cmd, void *arg)
* one more instance of the "number to vfs" mapping problem,
* but "17" is the order as taken from sys/mount.h
*/
+}
+
+static int
+ext2fs_modcmd(modcmd_t cmd, void *arg)
+{
+ int error;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ error = vfs_attach(&ext2fs_vfsops);
+ if (error != 0)
+ break;
break;
case MODULE_CMD_FINI:
error = vfs_detach(&ext2fs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&ext2fs_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.365 src/sys/ufs/ffs/ffs_vfsops.c:1.366
--- src/sys/ufs/ffs/ffs_vfsops.c:1.365 Thu Feb 27 22:12:54 2020
+++ src/sys/ufs/ffs/ffs_vfsops.c Mon Mar 16 21:20:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_vfsops.c,v 1.365 2020/02/27 22:12:54 ad Exp $ */
+/* $NetBSD: ffs_vfsops.c,v 1.366 2020/03/16 21:20:12 pgoyette Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.365 2020/02/27 22:12:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.366 2020/03/16 21:20:12 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -120,8 +120,6 @@ static int ffs_is_appleufs(struct vnode
static int ffs_init_vnode(struct ufsmount *, struct vnode *, ino_t);
static void ffs_deinit_vnode(struct ufsmount *, struct vnode *);
-static struct sysctllog *ffs_sysctl_log;
-
static kauth_listener_t ffs_snapshot_listener;
/* how many times ffs_init() was called */
@@ -254,6 +252,63 @@ ffs_snapshot_cb(kauth_cred_t cred, kauth
return result;
}
+SYSCTL_SETUP(ffs_sysctl_setup, "ffs sysctls")
+{
+#ifdef UFS_EXTATTR
+ extern int ufs_extattr_autocreate;
+#endif
+ extern int ffs_log_changeopt;
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_NODE, "ffs",
+ SYSCTL_DESCR("Berkeley Fast File System"),
+ NULL, 0, NULL, 0,
+ CTL_VFS, 1, CTL_EOL);
+ /*
+ * @@@ should we even bother with these first three?
+ */
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "doclusterread", NULL,
+ sysctl_notavail, 0, NULL, 0,
+ CTL_VFS, 1, FFS_CLUSTERREAD, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "doclusterwrite", NULL,
+ sysctl_notavail, 0, NULL, 0,
+ CTL_VFS, 1, FFS_CLUSTERWRITE, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "doreallocblks", NULL,
+ sysctl_notavail, 0, NULL, 0,
+ CTL_VFS, 1, FFS_REALLOCBLKS, CTL_EOL);
+#if 0
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "doasyncfree",
+ SYSCTL_DESCR("Release dirty blocks asynchronously"),
+ NULL, 0, &doasyncfree, 0,
+ CTL_VFS, 1, FFS_ASYNCFREE, CTL_EOL);
+#endif
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "log_changeopt",
+ SYSCTL_DESCR("Log changes in optimization strategy"),
+ NULL, 0, &ffs_log_changeopt, 0,
+ CTL_VFS, 1, FFS_LOG_CHANGEOPT, CTL_EOL);
+#ifdef UFS_EXTATTR
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "extattr_autocreate",
+ SYSCTL_DESCR("Size of attribute for "
+ "backing file autocreation"),
+ NULL, 0, &ufs_extattr_autocreate, 0,
+ CTL_VFS, 1, FFS_EXTATTR_AUTOCREATE, CTL_EOL);
+
+#endif /* UFS_EXTATTR */
+}
+
static int
ffs_modcmd(modcmd_t cmd, void *arg)
{
@@ -262,10 +317,6 @@ ffs_modcmd(modcmd_t cmd, void *arg)
#if 0
extern int doasyncfree;
#endif
-#ifdef UFS_EXTATTR
- extern int ufs_extattr_autocreate;
-#endif
- extern int ffs_log_changeopt;
switch (cmd) {
case MODULE_CMD_INIT:
@@ -273,55 +324,6 @@ ffs_modcmd(modcmd_t cmd, void *arg)
if (error != 0)
break;
- sysctl_createv(&ffs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "ffs",
- SYSCTL_DESCR("Berkeley Fast File System"),
- NULL, 0, NULL, 0,
- CTL_VFS, 1, CTL_EOL);
- /*
- * @@@ should we even bother with these first three?
- */
- sysctl_createv(&ffs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "doclusterread", NULL,
- sysctl_notavail, 0, NULL, 0,
- CTL_VFS, 1, FFS_CLUSTERREAD, CTL_EOL);
- sysctl_createv(&ffs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "doclusterwrite", NULL,
- sysctl_notavail, 0, NULL, 0,
- CTL_VFS, 1, FFS_CLUSTERWRITE, CTL_EOL);
- sysctl_createv(&ffs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "doreallocblks", NULL,
- sysctl_notavail, 0, NULL, 0,
- CTL_VFS, 1, FFS_REALLOCBLKS, CTL_EOL);
-#if 0
- sysctl_createv(&ffs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "doasyncfree",
- SYSCTL_DESCR("Release dirty blocks asynchronously"),
- NULL, 0, &doasyncfree, 0,
- CTL_VFS, 1, FFS_ASYNCFREE, CTL_EOL);
-#endif
- sysctl_createv(&ffs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "log_changeopt",
- SYSCTL_DESCR("Log changes in optimization strategy"),
- NULL, 0, &ffs_log_changeopt, 0,
- CTL_VFS, 1, FFS_LOG_CHANGEOPT, CTL_EOL);
-#ifdef UFS_EXTATTR
- sysctl_createv(&ffs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "extattr_autocreate",
- SYSCTL_DESCR("Size of attribute for "
- "backing file autocreation"),
- NULL, 0, &ufs_extattr_autocreate, 0,
- CTL_VFS, 1, FFS_EXTATTR_AUTOCREATE, CTL_EOL);
-
-#endif /* UFS_EXTATTR */
-
ffs_snapshot_listener = kauth_listen_scope(KAUTH_SCOPE_SYSTEM,
ffs_snapshot_cb, NULL);
if (ffs_snapshot_listener == NULL)
@@ -332,7 +334,6 @@ ffs_modcmd(modcmd_t cmd, void *arg)
error = vfs_detach(&ffs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&ffs_sysctl_log);
if (ffs_snapshot_listener != NULL)
kauth_unlisten_scope(ffs_snapshot_listener);
break;
Index: src/sys/ufs/lfs/lfs_vfsops.c
diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.376 src/sys/ufs/lfs/lfs_vfsops.c:1.377
--- src/sys/ufs/lfs/lfs_vfsops.c:1.376 Sat Mar 14 20:23:51 2020
+++ src/sys/ufs/lfs/lfs_vfsops.c Mon Mar 16 21:20:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_vfsops.c,v 1.376 2020/03/14 20:23:51 ad Exp $ */
+/* $NetBSD: lfs_vfsops.c,v 1.377 2020/03/16 21:20:13 pgoyette Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.376 2020/03/14 20:23:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.377 2020/03/16 21:20:13 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@@ -122,8 +122,6 @@ static int lfs_gop_write(struct vnode *,
static int lfs_mountfs(struct vnode *, struct mount *, struct lwp *);
static int lfs_flushfiles(struct mount *, int);
-static struct sysctllog *lfs_sysctl_log;
-
extern const struct vnodeopv_desc lfs_vnodeop_opv_desc;
extern const struct vnodeopv_desc lfs_specop_opv_desc;
extern const struct vnodeopv_desc lfs_fifoop_opv_desc;
@@ -201,8 +199,7 @@ sysctl_lfs_dostats(SYSCTLFN_ARGS)
return (0);
}
-static void
-lfs_sysctl_setup(struct sysctllog **clog)
+SYSCTL_SETUP(lfs_sysctl_setup, "lfs sysctl")
{
int i;
extern int lfs_writeindir, lfs_dostats, lfs_clean_vnhead,
@@ -355,7 +352,6 @@ lfs_modcmd(modcmd_t cmd, void *arg)
syscall_disestablish(NULL, lfs_syscalls);
break;
}
- lfs_sysctl_setup(&lfs_sysctl_log);
cv_init(&lfs_allclean_wakeup, "segment");
break;
case MODULE_CMD_FINI:
@@ -363,7 +359,6 @@ lfs_modcmd(modcmd_t cmd, void *arg)
if (error != 0)
break;
syscall_disestablish(NULL, lfs_syscalls);
- sysctl_teardown(&lfs_sysctl_log);
cv_destroy(&lfs_allclean_wakeup);
break;
default:
Index: src/sys/ufs/mfs/mfs_vfsops.c
diff -u src/sys/ufs/mfs/mfs_vfsops.c:1.113 src/sys/ufs/mfs/mfs_vfsops.c:1.114
--- src/sys/ufs/mfs/mfs_vfsops.c:1.113 Mon Apr 17 08:32:02 2017
+++ src/sys/ufs/mfs/mfs_vfsops.c Mon Mar 16 21:20:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: mfs_vfsops.c,v 1.113 2017/04/17 08:32:02 hannken Exp $ */
+/* $NetBSD: mfs_vfsops.c,v 1.114 2020/03/16 21:20:13 pgoyette Exp $ */
/*
* Copyright (c) 1989, 1990, 1993, 1994
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.113 2017/04/17 08:32:02 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.114 2020/03/16 21:20:13 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -76,8 +76,6 @@ static int mfs_initcnt;
extern int (**mfs_vnodeop_p)(void *);
-static struct sysctllog *mfs_sysctl_log;
-
/*
* mfs vfs operations.
*/
@@ -116,6 +114,23 @@ struct vfsops mfs_vfsops = {
.vfs_opv_descs = mfs_vnodeopv_descs
};
+SYSCTL_SETUP(mfs_sysctl_setup, "mfs sysctl")
+{
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_ALIAS,
+ CTLTYPE_NODE, "mfs",
+ SYSCTL_DESCR("Memory based file system"),
+ NULL, 1, NULL, 0,
+ CTL_VFS, 3, CTL_EOL);
+ /*
+ * XXX the "1" and the "3" above could be dynamic, thereby
+ * eliminating one more instance of the "number to vfs"
+ * mapping problem, but they are in order as taken from
+ * sys/mount.h
+ */
+}
+
static int
mfs_modcmd(modcmd_t cmd, void *arg)
{
@@ -126,24 +141,11 @@ mfs_modcmd(modcmd_t cmd, void *arg)
error = vfs_attach(&mfs_vfsops);
if (error != 0)
break;
- sysctl_createv(&mfs_sysctl_log, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_ALIAS,
- CTLTYPE_NODE, "mfs",
- SYSCTL_DESCR("Memory based file system"),
- NULL, 1, NULL, 0,
- CTL_VFS, 3, CTL_EOL);
- /*
- * XXX the "1" and the "3" above could be dynamic, thereby
- * eliminating one more instance of the "number to vfs"
- * mapping problem, but they are in order as taken from
- * sys/mount.h
- */
break;
case MODULE_CMD_FINI:
error = vfs_detach(&mfs_vfsops);
if (error != 0)
break;
- sysctl_teardown(&mfs_sysctl_log);
break;
default:
error = ENOTTY;
Index: src/sys/ufs/ufs/ufs_dirhash.c
diff -u src/sys/ufs/ufs/ufs_dirhash.c:1.39 src/sys/ufs/ufs/ufs_dirhash.c:1.40
--- src/sys/ufs/ufs/ufs_dirhash.c:1.39 Sat Mar 14 18:08:40 2020
+++ src/sys/ufs/ufs/ufs_dirhash.c Mon Mar 16 21:20:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_dirhash.c,v 1.39 2020/03/14 18:08:40 ad Exp $ */
+/* $NetBSD: ufs_dirhash.c,v 1.40 2020/03/16 21:20:13 pgoyette Exp $ */
/*
* Copyright (c) 2001, 2002 Ian Dowse. All rights reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.39 2020/03/14 18:08:40 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.40 2020/03/16 21:20:13 pgoyette Exp $");
/*
* This implements a hash-based lookup scheme for UFS directories.
@@ -93,8 +93,6 @@ static TAILQ_HEAD(, dirhash) ufsdirhash_
/* Protects: ufsdirhash_list, `dh_list' field, ufs_dirhashmem. */
static kmutex_t ufsdirhash_lock;
-static struct sysctllog *ufsdirhash_sysctl_log;
-
/*
* Locking order:
* ufsdirhash_lock
@@ -1089,47 +1087,46 @@ ufsdirhash_recycle(int wanted)
return (0);
}
-static void
-ufsdirhash_sysctl_init(void)
+SYSCTL_SETUP(ufsdirhash_sysctl_init, "ufs_dirhash sysctl")
{
const struct sysctlnode *rnode, *cnode;
- sysctl_createv(&ufsdirhash_sysctl_log, 0, NULL, &rnode,
+ sysctl_createv(clog, 0, NULL, &rnode,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "ufs",
SYSCTL_DESCR("ufs"),
NULL, 0, NULL, 0,
CTL_VFS, CTL_CREATE, CTL_EOL);
- sysctl_createv(&ufsdirhash_sysctl_log, 0, &rnode, &rnode,
+ sysctl_createv(clog, 0, &rnode, &rnode,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "dirhash",
SYSCTL_DESCR("dirhash"),
NULL, 0, NULL, 0,
CTL_CREATE, CTL_EOL);
- sysctl_createv(&ufsdirhash_sysctl_log, 0, &rnode, &cnode,
+ sysctl_createv(clog, 0, &rnode, &cnode,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "minblocks",
SYSCTL_DESCR("minimum hashed directory size in blocks"),
NULL, 0, &ufs_dirhashminblks, 0,
CTL_CREATE, CTL_EOL);
- sysctl_createv(&ufsdirhash_sysctl_log, 0, &rnode, &cnode,
+ sysctl_createv(clog, 0, &rnode, &cnode,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "maxmem",
SYSCTL_DESCR("maximum dirhash memory usage"),
NULL, 0, &ufs_dirhashmaxmem, 0,
CTL_CREATE, CTL_EOL);
- sysctl_createv(&ufsdirhash_sysctl_log, 0, &rnode, &cnode,
+ sysctl_createv(clog, 0, &rnode, &cnode,
CTLFLAG_PERMANENT|CTLFLAG_READONLY,
CTLTYPE_INT, "memused",
SYSCTL_DESCR("current dirhash memory usage"),
NULL, 0, &ufs_dirhashmem, 0,
CTL_CREATE, CTL_EOL);
- sysctl_createv(&ufsdirhash_sysctl_log, 0, &rnode, &cnode,
+ sysctl_createv(clog, 0, &rnode, &cnode,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "docheck",
SYSCTL_DESCR("enable extra sanity checks"),
@@ -1147,7 +1144,6 @@ ufsdirhash_init(void)
ufsdirhash_cache = pool_cache_init(sizeof(struct dirhash), 0,
0, 0, "dirhash", NULL, IPL_NONE, NULL, NULL, NULL);
TAILQ_INIT(&ufsdirhash_list);
- ufsdirhash_sysctl_init();
}
void
@@ -1158,5 +1154,4 @@ ufsdirhash_done(void)
pool_cache_destroy(ufsdirhashblk_cache);
pool_cache_destroy(ufsdirhash_cache);
mutex_destroy(&ufsdirhash_lock);
- sysctl_teardown(&ufsdirhash_sysctl_log);
}