Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Replace a large number of link set based sysctl node cre...
details: https://anonhg.NetBSD.org/src/rev/b6efb768d90d
branches: trunk
changeset: 747470:b6efb768d90d
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Sep 16 15:23:04 2009 +0000
description:
Replace a large number of link set based sysctl node creations with
calls from subsystem constructors. Benefits both future kernel
modules and rump.
no change to sysctl nodes on i386/MONOLITHIC & build tested i386/ALL
diffstat:
sys/kern/init_main.c | 6 ++++--
sys/kern/kern_sysctl.c | 22 ++++++++++++++--------
sys/kern/subr_autoconf.c | 10 +++++++---
sys/kern/subr_bufq.c | 22 +++++++++++++++++++---
sys/kern/subr_iostat.c | 10 +++++++---
sys/kern/uipc_accf.c | 8 +++++---
sys/miscfs/syncfs/sync_subr.c | 11 ++++++++---
sys/net/if.c | 39 +++++++++++++++------------------------
sys/net/route.c | 12 +++++++++---
sys/net/rtsock.c | 9 ++++++---
sys/netinet/if_arp.c | 10 +++++++---
sys/netinet/igmp.c | 10 +++++++---
sys/netinet/in_proto.c | 5 +++--
sys/netinet/ip_carp.c | 16 +++++++++++++---
sys/netinet/ip_carp.h | 3 ++-
sys/netinet/ip_icmp.c | 11 ++++++++---
sys/netinet/ip_input.c | 11 ++++++++---
sys/netinet/raw_ip.c | 10 +++++++---
sys/netinet/tcp_subr.c | 6 ++++--
sys/netinet/tcp_usrreq.c | 25 +++++++++----------------
sys/netinet/tcp_var.h | 3 ++-
sys/netinet/udp_usrreq.c | 11 ++++++++---
sys/netinet6/icmp6.c | 11 +++++++----
sys/netinet6/ip6_input.c | 9 ++++++---
sys/netinet6/ip6_mroute.c | 9 ++++++---
sys/netinet6/raw_ip6.c | 10 +++++++---
sys/netinet6/udp6_usrreq.c | 11 +++++++----
sys/rump/librump/rumpkern/rump.c | 8 +++++---
sys/sys/sysctl.h | 3 ++-
29 files changed, 212 insertions(+), 119 deletions(-)
diffs (truncated from 1186 to 300 lines):
diff -r 92c557362b61 -r b6efb768d90d sys/kern/init_main.c
--- a/sys/kern/init_main.c Wed Sep 16 15:10:23 2009 +0000
+++ b/sys/kern/init_main.c Wed Sep 16 15:23:04 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init_main.c,v 1.399 2009/09/13 18:45:10 pooka Exp $ */
+/* $NetBSD: init_main.c,v 1.400 2009/09/16 15:23:04 pooka Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.399 2009/09/13 18:45:10 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.400 2009/09/16 15:23:04 pooka Exp $");
#include "opt_ddb.h"
#include "opt_ipsec.h"
@@ -589,6 +589,8 @@
*/
config_finalize();
+ sysctl_finalize();
+
/*
* Now that autoconfiguration has completed, we can determine
* the root and dump devices.
diff -r 92c557362b61 -r b6efb768d90d sys/kern/kern_sysctl.c
--- a/sys/kern/kern_sysctl.c Wed Sep 16 15:10:23 2009 +0000
+++ b/sys/kern/kern_sysctl.c Wed Sep 16 15:23:04 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_sysctl.c,v 1.225 2009/08/24 20:53:00 dyoung Exp $ */
+/* $NetBSD: kern_sysctl.c,v 1.226 2009/09/16 15:23:04 pooka Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.225 2009/08/24 20:53:00 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.226 2009/09/16 15:23:04 pooka Exp $");
#include "opt_defcorename.h"
#include "ksyms.h"
@@ -235,14 +235,20 @@
f = (void*)*sysctl_setup;
(*f)(NULL);
}
+}
- /*
- * setting this means no more permanent nodes can be added,
- * trees that claim to be readonly at the root now are, and if
- * the main tree is readonly, *everything* is.
- */
+/*
+ * Setting this means no more permanent nodes can be added,
+ * trees that claim to be readonly at the root now are, and if
+ * the main tree is readonly, *everything* is.
+ *
+ * Call this at the end of kernel init.
+ */
+void
+sysctl_finalize(void)
+{
+
sysctl_root.sysctl_flags |= CTLFLAG_PERMANENT;
-
}
/*
diff -r 92c557362b61 -r b6efb768d90d sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c Wed Sep 16 15:10:23 2009 +0000
+++ b/sys/kern/subr_autoconf.c Wed Sep 16 15:23:04 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.181 2009/09/06 16:18:56 pooka Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.182 2009/09/16 15:23:04 pooka Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.181 2009/09/06 16:18:56 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.182 2009/09/16 15:23:04 pooka Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -225,6 +225,8 @@
static int config_do_twiddle;
static callout_t config_twiddle_ch;
+static void sysctl_detach_setup(struct sysctllog **);
+
/*
* Initialize the autoconfiguration data structures. Normally this
* is done by configure(), but some platforms need to do this very
@@ -267,6 +269,7 @@
initcftable.ct_cfdata = cfdata;
TAILQ_INSERT_TAIL(&allcftables, &initcftable, ct_list);
+ sysctl_detach_setup(NULL);
config_initialized = 1;
}
@@ -2578,7 +2581,8 @@
mutex_exit(&alldevs_mtx);
}
-SYSCTL_SETUP(sysctl_detach_setup, "sysctl detach setup")
+static void
+sysctl_detach_setup(struct sysctllog **clog)
{
const struct sysctlnode *node = NULL;
diff -r 92c557362b61 -r b6efb768d90d sys/kern/subr_bufq.c
--- a/sys/kern/subr_bufq.c Wed Sep 16 15:10:23 2009 +0000
+++ b/sys/kern/subr_bufq.c Wed Sep 16 15:23:04 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_bufq.c,v 1.18 2009/01/19 14:54:28 yamt Exp $ */
+/* $NetBSD: subr_bufq.c,v 1.19 2009/09/16 15:23:04 pooka Exp $ */
/* NetBSD: subr_disk.c,v 1.70 2005/08/20 12:00:01 yamt Exp $ */
/*-
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.18 2009/01/19 14:54:28 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.19 2009/09/16 15:23:04 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -76,12 +76,24 @@
#include <sys/bufq.h>
#include <sys/bufq_impl.h>
#include <sys/kmem.h>
+#include <sys/once.h>
#include <sys/sysctl.h>
BUFQ_DEFINE(dummy, 0, NULL); /* so that bufq_strats won't be empty */
#define STRAT_MATCH(id, bs) (strcmp((id), (bs)->bs_name) == 0)
+static int bufq_init(void);
+static void sysctl_kern_bufq_strategies_setup(struct sysctllog **);
+
+static int
+bufq_init(void)
+{
+
+ sysctl_kern_bufq_strategies_setup(NULL);
+ return 0;
+}
+
/*
* Create a device buffer queue.
*/
@@ -92,8 +104,11 @@
const struct bufq_strat *bsp;
const struct bufq_strat * const *it;
struct bufq_state *bufq;
+ static ONCE_DECL(bufq_init_ctrl);
int error = 0;
+ RUN_ONCE(&bufq_init_ctrl, bufq_init);
+
KASSERT((flags & BUFQ_EXACT) == 0 || strategy != BUFQ_STRAT_ANY);
switch (flags & BUFQ_SORT_MASK) {
@@ -309,7 +324,8 @@
return error;
}
-SYSCTL_SETUP(sysctl_kern_bufq_strategies_setup, "sysctl kern.bufq tree setup")
+static void
+sysctl_kern_bufq_strategies_setup(struct sysctllog **clog)
{
const struct sysctlnode *node;
diff -r 92c557362b61 -r b6efb768d90d sys/kern/subr_iostat.c
--- a/sys/kern/subr_iostat.c Wed Sep 16 15:10:23 2009 +0000
+++ b/sys/kern/subr_iostat.c Wed Sep 16 15:23:04 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_iostat.c,v 1.17 2009/04/04 07:30:10 ad Exp $ */
+/* $NetBSD: subr_iostat.c,v 1.18 2009/09/16 15:23:04 pooka Exp $ */
/* NetBSD: subr_disk.c,v 1.69 2005/05/29 22:24:15 christos Exp */
/*-
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_iostat.c,v 1.17 2009/04/04 07:30:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_iostat.c,v 1.18 2009/09/16 15:23:04 pooka Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -96,6 +96,8 @@
int iostat_count; /* number of drives in global drivelist */
krwlock_t iostatlist_lock;
+static void sysctl_io_stats_setup(struct sysctllog **);
+
/*
* Initialise the iostat subsystem.
*/
@@ -104,6 +106,7 @@
{
rw_init(&iostatlist_lock);
+ sysctl_io_stats_setup(NULL);
}
/*
@@ -376,7 +379,8 @@
return (error);
}
-SYSCTL_SETUP(sysctl_io_stats_setup, "sysctl i/o stats setup")
+static void
+sysctl_io_stats_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,
diff -r 92c557362b61 -r b6efb768d90d sys/kern/uipc_accf.c
--- a/sys/kern/uipc_accf.c Wed Sep 16 15:10:23 2009 +0000
+++ b/sys/kern/uipc_accf.c Wed Sep 16 15:23:04 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_accf.c,v 1.8 2008/11/20 10:00:54 ad Exp $ */
+/* $NetBSD: uipc_accf.c,v 1.9 2009/09/16 15:23:04 pooka Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_accf.c,v 1.8 2008/11/20 10:00:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_accf.c,v 1.9 2009/09/16 15:23:04 pooka Exp $");
#define ACCEPT_FILTER_MOD
@@ -87,7 +87,8 @@
/*
* Names of Accept filter sysctl objects
*/
-SYSCTL_SETUP(sysctl_net_inet_accf_setup, "sysctl net.inet.accf subtree setup")
+static void
+sysctl_net_inet_accf_setup(struct sysctllog **clog)
{
sysctl_createv(clog, 0, NULL, NULL,
@@ -184,6 +185,7 @@
{
rw_init(&accept_filter_lock);
+ sysctl_net_inet_accf_setup(NULL);
return 0;
}
diff -r 92c557362b61 -r b6efb768d90d sys/miscfs/syncfs/sync_subr.c
--- a/sys/miscfs/syncfs/sync_subr.c Wed Sep 16 15:10:23 2009 +0000
+++ b/sys/miscfs/syncfs/sync_subr.c Wed Sep 16 15:23:04 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sync_subr.c,v 1.40 2009/03/15 17:22:38 cegger Exp $ */
+/* $NetBSD: sync_subr.c,v 1.41 2009/09/16 15:23:04 pooka Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sync_subr.c,v 1.40 2009/03/15 17:22:38 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sync_subr.c,v 1.41 2009/09/16 15:23:04 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -102,6 +102,8 @@
static struct synclist *syncer_workitem_pending;
struct lwp *updateproc = NULL;
+static void sysctl_vfs_syncfs_setup(struct sysctllog **);
+
void
vn_initialize_syncerd(void)
{
@@ -109,6 +111,8 @@
syncer_last = SYNCER_MAXDELAY + 2;
+ sysctl_vfs_syncfs_setup(NULL);
+
syncer_workitem_pending =
kmem_alloc(syncer_last * sizeof (struct synclist), KM_SLEEP);
@@ -344,7 +348,8 @@
Home |
Main Index |
Thread Index |
Old Index