Change the rest of the sysctl subsystem to use const consistently.

The __UNCONST macro is now used only where necessary and the RW macros
are gone.  Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
This commit is contained in:
atatat 2005-06-20 02:49:18 +00:00
parent b0366b2ebd
commit df13e3579e
27 changed files with 144 additions and 133 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: sysctl.9,v 1.5 2004/03/24 23:51:18 wiz Exp $
.\" $NetBSD: sysctl.9,v 1.6 2005/06/20 02:49:19 atatat Exp $
.\"
.\" Copyright (c) 2004 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -53,8 +53,8 @@ Primary external interfaces:
.Fn sysctl_unlock "struct lwp *l"
.Ft int
.Fn sysctl_createv "struct sysctllog **log" "int cflags" \
"struct sysctlnode **rnode" "struct sysctlnode **cnode" "int flags" \
"int type" "const char *namep" "const char *desc" \
"const struct sysctlnode **rnode" "const struct sysctlnode **cnode" \
"int flags" "int type" "const char *namep" "const char *desc" \
"sysctlfn func" "u_quad_t qv" "void *newp" "size_t newlen" ...
.Ft int
.Fn sysctl_destroyv "struct sysctlnode *rnode" ...
@ -69,19 +69,19 @@ Primary external interfaces:
Core internal functions:
.Ft int
.Fn sysctl_locate "struct lwp *l" "const int *name" "u_int namelen" \
"struct sysctlnode **rnode" "int *nip"
"const struct sysctlnode **rnode" "int *nip"
.Ft int
.Fn sysctl_lookup "const int *name" "u_int namelen" "void *oldp" \
"size_t *oldlenp" "const void *newp" "size_t newlen" "const int *oname" \
"struct lwp *l" "struct sysctlnode *rnode"
"struct lwp *l" "const struct sysctlnode *rnode"
.Ft int
.Fn sysctl_create "const int *name" "u_int namelen" "void *oldp" \
"size_t *oldlenp" "const void *newp" "size_t newlen" "const int *oname" \
"struct lwp *l" "struct sysctlnode *rnode"
"struct lwp *l" "const struct sysctlnode *rnode"
.Ft int
.Fn sysctl_destroy "const int *name" "u_int namelen" "void *oldp" \
"size_t *oldlenp" "const void *newp" "size_t newlen" "const int *oname" \
"struct lwp *l" "struct sysctlnode *rnode"
"struct lwp *l" "const struct sysctlnode *rnode"
.Ft int
.Fn sysctl_query "const int *name" "u_int namelen" "void *oldp" \
"size_t *oldlenp" "const void *newp" "size_t newlen" "const int *oname" \
@ -497,12 +497,6 @@ The use of the
.Dv SYSCTLFN_ARGS, and
.Dv SYSCTLFN_CALL
macros ensure that all arguments are passed properly.
The
.Dv SYSCTLFN_RWPROTO
and
.Dv SYSCTLFN_RWARGS
macros are only used internally by those core SYSCTL routines that may
have cause to modify the data in the given SYSCTL tree.
The single argument to the
.Dv SYSCTLFN_CALL
macro is the pointer to the node being examined.

View File

@ -1,4 +1,4 @@
/* $NetBSD: tspld.c,v 1.6 2005/06/04 22:40:03 he Exp $ */
/* $NetBSD: tspld.c,v 1.7 2005/06/20 02:49:19 atatat Exp $ */
/*-
* Copyright (c) 2004 Jesse Off
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tspld.c,v 1.6 2005/06/04 22:40:03 he Exp $");
__KERNEL_RCSID(0, "$NetBSD: tspld.c,v 1.7 2005/06/20 02:49:19 atatat Exp $");
#include <sys/param.h>
#include <sys/sysctl.h>
@ -105,7 +105,7 @@ tspldattach(parent, self, aux)
int i, rev, features, jp, model;
struct tspld_softc *sc = (struct tspld_softc *)self;
bus_space_handle_t ioh;
struct sysctlnode *node;
const struct sysctlnode *node;
if (sysctl_createv(NULL, 0, NULL, NULL,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw",

View File

@ -1,4 +1,4 @@
/* $NetBSD: power.c,v 1.2 2005/06/03 15:21:35 chs Exp $ */
/* $NetBSD: power.c,v 1.3 2005/06/20 02:49:19 atatat Exp $ */
/*
* Copyright (c) 2004 Jochen Kunz.
* All rights reserved.
@ -34,7 +34,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: power.c,v 1.2 2005/06/03 15:21:35 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: power.c,v 1.3 2005/06/20 02:49:19 atatat Exp $");
/*
@ -114,7 +114,7 @@ pwr_sw_init(bus_space_tag_t bst)
{
struct pdc_power_info pdc_power_info PDC_ALIGNMENT;
struct sysctllog *sysctl_log;
struct sysctlnode *pwr_sw_node;
const struct sysctlnode *pwr_sw_node;
int error, stage;
pwr_sw_state = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: est.c,v 1.8 2005/05/29 21:34:23 christos Exp $ */
/* $NetBSD: est.c,v 1.9 2005/06/20 02:49:19 atatat Exp $ */
/*
* Copyright (c) 2003 Michael Eriksson.
* All rights reserved.
@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: est.c,v 1.8 2005/05/29 21:34:23 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: est.c,v 1.9 2005/06/20 02:49:19 atatat Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -391,7 +391,7 @@ est_init(struct cpu_info *ci)
{
const struct est_cpu *ccpu;
const struct fqlist *fql;
struct sysctlnode *node, *estnode, *freqnode;
const struct sysctlnode *node, *estnode, *freqnode;
u_int64_t msr;
int i, j, rc;
int mhz, mv;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ichlpcib.c,v 1.8 2005/02/03 21:35:44 perry Exp $ */
/* $NetBSD: ichlpcib.c,v 1.9 2005/06/20 02:49:19 atatat Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.8 2005/02/03 21:35:44 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.9 2005/06/20 02:49:19 atatat Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -306,7 +306,7 @@ speedstep_bad_hb_check(struct pci_attach_args *pa)
static void
speedstep_configure(struct lpcib_softc *sc, struct pci_attach_args *pa)
{
struct sysctlnode *node, *ssnode;
const struct sysctlnode *node, *ssnode;
int rv;
/* Supported on ICH2-M, ICH3-M and ICH4-M. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: darwin_sysctl.c,v 1.35 2005/05/29 22:08:16 christos Exp $ */
/* $NetBSD: darwin_sysctl.c,v 1.36 2005/06/20 02:49:18 atatat Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: darwin_sysctl.c,v 1.35 2005/05/29 22:08:16 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: darwin_sysctl.c,v 1.36 2005/06/20 02:49:18 atatat Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -110,7 +110,7 @@ darwin_sysctl_redispatch(SYSCTLFN_ARGS)
*/
SYSCTL_SETUP(sysctl_darwin_emul_setup, "darwin emulated sysctl tree setup")
{
struct sysctlnode *_root = &darwin_sysctl_root;
const struct sysctlnode *_root = &darwin_sysctl_root;
sysctl_createv(clog, 0, &_root, NULL,
CTLFLAG_PERMANENT,

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_sysctl.c,v 1.16 2004/05/25 04:29:08 atatat Exp $ */
/* $NetBSD: linux_sysctl.c,v 1.17 2005/06/20 02:49:19 atatat Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.16 2004/05/25 04:29:08 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.17 2005/06/20 02:49:19 atatat Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -84,7 +84,7 @@ struct sysctlnode linux_sysctl_root = {
*/
SYSCTL_SETUP(linux_sysctl_setup, "linux emulated sysctl subtree setup")
{
struct sysctlnode *node = &linux_sysctl_root;
const struct sysctlnode *node = &linux_sysctl_root;
sysctl_createv(clog, 0, &node, &node,
CTLFLAG_PERMANENT,

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_sysctl.c,v 1.15 2004/04/27 03:49:03 atatat Exp $ */
/* $NetBSD: netbsd32_sysctl.c,v 1.16 2005/06/20 02:49:18 atatat Exp $ */
/*
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.15 2004/04/27 03:49:03 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.16 2005/06/20 02:49:18 atatat Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ddb.h"
@ -103,7 +103,7 @@ netbsd32_sysctl_vm_loadavg(SYSCTLFN_ARGS)
SYSCTL_SETUP(netbsd32_sysctl_emul_setup, "sysctl netbsd32 shadow tree setup")
{
struct sysctlnode *_root = &netbsd32_sysctl_root;
const struct sysctlnode *_root = &netbsd32_sysctl_root;
extern char machine_arch32[];
sysctl_createv(clog, 0, &_root, NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ac97.c,v 1.75 2005/05/30 04:43:46 christos Exp $ */
/* $NetBSD: ac97.c,v 1.76 2005/06/20 02:49:18 atatat Exp $ */
/* $OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $ */
/*
@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.75 2005/05/30 04:43:46 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.76 2005/06/20 02:49:18 atatat Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1225,9 +1225,9 @@ ac97_attach_type(struct ac97_host_if *host_if, struct device *sc_dev, int type)
}
}
} else if (as->type == AC97_CODEC_TYPE_MODEM) {
struct sysctlnode *node;
struct sysctlnode *node_line1;
struct sysctlnode *node_line2;
const struct sysctlnode *node;
const struct sysctlnode *node_line1;
const struct sysctlnode *node_line2;
uint16_t xrate = 8000;
uint16_t xval, reg;
int err;

View File

@ -1,4 +1,4 @@
/* $NetBSD: an.c,v 1.33 2005/01/15 11:01:46 dyoung Exp $ */
/* $NetBSD: an.c,v 1.34 2005/06/20 02:49:18 atatat Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.33 2005/01/15 11:01:46 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.34 2005/06/20 02:49:18 atatat Exp $");
#include "bpfilter.h"
@ -331,7 +331,7 @@ an_attach(struct an_softc *sc)
SYSCTL_SETUP(sysctl_an, "sysctl an(4) subtree setup")
{
int rc;
struct sysctlnode *cnode, *rnode;
const struct sysctlnode *cnode, *rnode;
if ((rc = sysctl_createv(clog, 0, NULL, &rnode,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ath.c,v 1.45 2005/02/27 00:27:00 perry Exp $ */
/* $NetBSD: ath.c,v 1.46 2005/06/20 02:49:18 atatat Exp $ */
/*-
* Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
@ -41,7 +41,7 @@
__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.54 2004/04/05 04:42:42 sam Exp $");
#endif
#ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.45 2005/02/27 00:27:00 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.46 2005/06/20 02:49:18 atatat Exp $");
#endif
/*
@ -334,7 +334,7 @@ sysctl_ath_verify(SYSCTLFN_ARGS)
SYSCTL_SETUP(sysctl_ath, "sysctl ath subtree setup")
{
int rc, ath_node_num;
struct sysctlnode *node;
const struct sysctlnode *node;
if ((rc = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtw.c,v 1.46 2005/06/10 02:35:34 dyoung Exp $ */
/* $NetBSD: rtw.c,v 1.47 2005/06/20 02:49:18 atatat Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.46 2005/06/10 02:35:34 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.47 2005/06/20 02:49:18 atatat Exp $");
#include "bpfilter.h"
@ -120,7 +120,7 @@ static int rtw_sysctl_verify_rxbufs_limit(SYSCTLFN_PROTO);
SYSCTL_SETUP(sysctl_rtw, "sysctl rtw(4) subtree setup")
{
int rc;
struct sysctlnode *cnode, *rnode;
const struct sysctlnode *cnode, *rnode;
if ((rc = sysctl_createv(clog, 0, NULL, &rnode,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: auich.c,v 1.95 2005/04/12 17:30:51 jmcneill Exp $ */
/* $NetBSD: auich.c,v 1.96 2005/06/20 02:49:18 atatat Exp $ */
/*-
* Copyright (c) 2000, 2004, 2005 The NetBSD Foundation, Inc.
@ -118,7 +118,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.95 2005/04/12 17:30:51 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.96 2005/06/20 02:49:18 atatat Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -435,7 +435,7 @@ auich_attach(struct device *parent, struct device *self, void *aux)
pcireg_t v;
const char *intrstr;
const struct auich_devtype *d;
struct sysctlnode *node, *node_ac97clock;
const struct sysctlnode *node, *node_ac97clock;
int err, node_mib, i;
sc = (struct auich_softc *)self;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bge.c,v 1.89 2005/05/22 15:54:46 christos Exp $ */
/* $NetBSD: if_bge.c,v 1.90 2005/06/20 02:49:18 atatat Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.89 2005/05/22 15:54:46 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.90 2005/06/20 02:49:18 atatat Exp $");
#include "bpfilter.h"
#include "vlan.h"
@ -3958,7 +3958,7 @@ sysctl_bge_verify(SYSCTLFN_ARGS)
SYSCTL_SETUP(sysctl_bge, "sysctl bge subtree setup")
{
int rc, bge_root_num;
struct sysctlnode *node;
const struct sysctlnode *node;
if ((rc = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: twe.c,v 1.66 2005/05/30 04:35:23 christos Exp $ */
/* $NetBSD: twe.c,v 1.67 2005/06/20 02:49:18 atatat Exp $ */
/*-
* Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.66 2005/05/30 04:35:23 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.67 2005/06/20 02:49:18 atatat Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -334,7 +334,7 @@ twe_attach(struct device *parent, struct device *self, void *aux)
size_t max_segs, max_xfer;
bus_dma_segment_t seg;
struct ctlname ctlnames[] = CTL_NAMES;
struct sysctlnode *node;
const struct sysctlnode *node;
struct twe_cmd *tc;
struct twe_ccb *ccb;

View File

@ -1,4 +1,4 @@
/* $NetBSD: synaptics.c,v 1.5 2005/02/27 00:27:42 perry Exp $ */
/* $NetBSD: synaptics.c,v 1.6 2005/06/20 02:49:19 atatat Exp $ */
/*
* Copyright (c) 2005, Steve C. Woodford
@ -322,7 +322,7 @@ static void
pms_sysctl_synaptics(struct sysctllog **clog)
{
int rc, root_num;
struct sysctlnode *node;
const struct sysctlnode *node;
if ((rc = sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_vfsops.c,v 1.48 2005/03/29 02:41:05 thorpej Exp $ */
/* $NetBSD: smbfs_vfsops.c,v 1.49 2005/06/20 02:49:19 atatat Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.48 2005/03/29 02:41:05 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.49 2005/06/20 02:49:19 atatat Exp $");
#ifdef _KERNEL_OPT
#include "opt_quota.h"
@ -69,7 +69,7 @@ SYSCTL_INT(_vfs_smbfs, OID_AUTO, version, CTLFLAG_RD, &smbfs_version, 0, "");
#else
SYSCTL_SETUP(sysctl_vfs_samba_setup, "sysctl vfs.samba subtree setup")
{
struct sysctlnode *smb = NULL;
const struct sysctlnode *smb = NULL;
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_sysctl.c,v 1.182 2005/06/09 02:19:59 atatat Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.183 2005/06/20 02:49:18 atatat Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.182 2005/06/09 02:19:59 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.183 2005/06/20 02:49:18 atatat Exp $");
#include "opt_defcorename.h"
#include "opt_insecure.h"
@ -96,7 +96,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.182 2005/06/09 02:19:59 atatat Exp
MALLOC_DEFINE(M_SYSCTLNODE, "sysctlnode", "sysctl node structures");
MALLOC_DEFINE(M_SYSCTLDATA, "sysctldata", "misc sysctl data");
static int sysctl_mmap(SYSCTLFN_RWPROTO);
static int sysctl_mmap(SYSCTLFN_PROTO);
static int sysctl_alloc(struct sysctlnode *, int);
static int sysctl_realloc(struct sysctlnode *);
@ -105,11 +105,11 @@ static int sysctl_cvt_in(struct lwp *, int *, const void *, size_t,
static int sysctl_cvt_out(struct lwp *, int, const struct sysctlnode *,
void *, size_t, size_t *);
static int sysctl_log_add(struct sysctllog **, struct sysctlnode *);
static int sysctl_log_add(struct sysctllog **, const struct sysctlnode *);
static int sysctl_log_realloc(struct sysctllog *);
struct sysctllog {
struct sysctlnode *log_root;
const struct sysctlnode *log_root;
int *log_num;
int log_size, log_left;
};
@ -368,7 +368,7 @@ sysctl_lock(struct lwp *l, void *oldp, size_t savelen)
* ********************************************************************
*/
int
sysctl_dispatch(SYSCTLFN_RWARGS)
sysctl_dispatch(SYSCTLFN_ARGS)
{
int error;
sysctlfn fn;
@ -479,9 +479,9 @@ sysctl_unlock(struct lwp *l)
*/
int
sysctl_locate(struct lwp *l, const int *name, u_int namelen,
struct sysctlnode **rnode, int *nip)
const struct sysctlnode **rnode, int *nip)
{
struct sysctlnode *node, *pnode;
const struct sysctlnode *node, *pnode;
int tn, si, ni, error, alias;
/*
@ -590,7 +590,8 @@ sysctl_query(SYSCTLFN_ARGS)
{
int error, ni, elim, v;
size_t out, left, t;
struct sysctlnode *enode, *onode, qnode;
const struct sysctlnode *enode, *onode;
struct sysctlnode qnode;
if (SYSCTL_VERS(rnode->sysctl_flags) != SYSCTL_VERSION) {
printf("sysctl_query: rnode %p wrong version\n", rnode);
@ -619,7 +620,7 @@ sysctl_query(SYSCTLFN_ARGS)
* if the request specifies a version, check it
*/
if (qnode.sysctl_ver != 0) {
enode = __UNCONST(rnode); /* XXXUNCONST discard const */
enode = rnode;
if (qnode.sysctl_ver != enode->sysctl_ver &&
qnode.sysctl_ver != sysctl_rootof(enode)->sysctl_ver)
return (EINVAL);
@ -686,7 +687,7 @@ sysctl_query(SYSCTLFN_ARGS)
* is proper.
*/
int
sysctl_create(SYSCTLFN_RWARGS)
sysctl_create(SYSCTLFN_ARGS)
{
struct sysctlnode nnode, *node, *pnode;
int error, ni, at, nm, type, sz, flags, rw, anum, v;
@ -745,7 +746,7 @@ sysctl_create(SYSCTLFN_RWARGS)
"node %p\n", rnode);
return (EINVAL);
}
pnode = rnode;
pnode = __UNCONST(rnode); /* we are adding children to this node */
if (newp == NULL)
return (EINVAL);
@ -1186,9 +1187,9 @@ sysctl_create(SYSCTLFN_RWARGS)
* ********************************************************************
*/
#ifdef SYSCTL_DEBUG_CREATE
int _sysctl_create(SYSCTLFN_RWPROTO);
int _sysctl_create(SYSCTLFN_PROTO);
int
_sysctl_create(SYSCTLFN_RWARGS)
_sysctl_create(SYSCTLFN_ARGS)
{
const struct sysctlnode *node;
int k, rc, ni, nl = namelen + (name - oname);
@ -1225,7 +1226,7 @@ _sysctl_create(SYSCTLFN_RWARGS)
* oldp. Since we're removing stuff, there's not much to check.
*/
int
sysctl_destroy(SYSCTLFN_RWARGS)
sysctl_destroy(SYSCTLFN_ARGS)
{
struct sysctlnode *node, *pnode, onode, nnode;
int ni, error, v;
@ -1391,7 +1392,7 @@ sysctl_destroy(SYSCTLFN_RWARGS)
* unless the node says otherwise.
*/
int
sysctl_lookup(SYSCTLFN_RWARGS)
sysctl_lookup(SYSCTLFN_ARGS)
{
int error, rw;
size_t sz, len;
@ -1456,12 +1457,17 @@ sysctl_lookup(SYSCTLFN_RWARGS)
* step one, copy out the stuff we have presently
*/
if (rnode->sysctl_flags & CTLFLAG_IMMEDIATE) {
/*
* note that we discard const here because we are
* modifying the contents of the node (which is okay
* because it's ours)
*/
switch (SYSCTL_TYPE(rnode->sysctl_flags)) {
case CTLTYPE_INT:
d = &rnode->sysctl_idata;
d = __UNCONST(&rnode->sysctl_idata);
break;
case CTLTYPE_QUAD:
d = &rnode->sysctl_qdata;
d = __UNCONST(&rnode->sysctl_qdata);
break;
default:
return (EINVAL);
@ -1560,9 +1566,10 @@ sysctl_lookup(SYSCTLFN_RWARGS)
* unfortunately.
*/
static int
sysctl_mmap(SYSCTLFN_RWARGS)
sysctl_mmap(SYSCTLFN_ARGS)
{
struct sysctlnode nnode, *node;
const struct sysctlnode *node;
struct sysctlnode nnode;
int error;
if (SYSCTL_VERS(rnode->sysctl_flags) != SYSCTL_VERSION) {
@ -1839,14 +1846,15 @@ sysctl_describe(SYSCTLFN_ARGS)
*/
int
sysctl_createv(struct sysctllog **log, int cflags,
struct sysctlnode **rnode, struct sysctlnode **cnode,
const struct sysctlnode **rnode, const struct sysctlnode **cnode,
int flags, int type, const char *namep, const char *descr,
sysctlfn func, u_quad_t qv, void *newp, size_t newlen,
...)
{
va_list ap;
int error, ni, namelen, name[CTL_MAXNAME];
struct sysctlnode *pnode, nnode, onode, *root;
const struct sysctlnode *root, *pnode;
struct sysctlnode nnode, onode, *dnode;
size_t sz;
/*
@ -2021,7 +2029,11 @@ sysctl_createv(struct sysctllog **log, int cflags,
/*
* allow first caller to *set* a
* description actually to set it
*
* discard const here so we can attach
* the description
*/
dnode = __UNCONST(pnode);
if (pnode->sysctl_desc != NULL)
/* skip it...we've got one */;
else if (flags & CTLFLAG_OWNDESC) {
@ -2030,13 +2042,13 @@ sysctl_createv(struct sysctllog **log, int cflags,
M_WAITOK|M_CANFAIL);
if (d != NULL) {
memcpy(d, descr, l);
pnode->sysctl_desc = d;
pnode->sysctl_flags |=
dnode->sysctl_desc = d;
dnode->sysctl_flags |=
CTLFLAG_OWNDESC;
}
}
else
pnode->sysctl_desc = descr;
dnode->sysctl_desc = descr;
}
}
else {
@ -2073,7 +2085,8 @@ sysctl_destroyv(struct sysctlnode *rnode, ...)
{
va_list ap;
int error, name[CTL_MAXNAME], namelen, ni;
struct sysctlnode *pnode, *node, dnode;
const struct sysctlnode *pnode, *node;
struct sysctlnode dnode, *onode;
size_t sz;
va_start(ap, rnode);
@ -2157,9 +2170,14 @@ sysctl_destroyv(struct sysctlnode *rnode, ...)
sz = strlen(node->sysctl_desc) + 1;
d = malloc(sz, M_SYSCTLDATA, M_WAITOK|M_CANFAIL);
if (d != NULL) {
/*
* discard const so that we can
* re-attach the description
*/
memcpy(d, node->sysctl_desc, sz);
node->sysctl_desc = d;
node->sysctl_flags |= CTLFLAG_OWNDESC;
onode = __UNCONST(node);
onode->sysctl_desc = d;
onode->sysctl_flags |= CTLFLAG_OWNDESC;
}
else {
/*
@ -2382,10 +2400,10 @@ sysctl_free(struct sysctlnode *rnode)
}
int
sysctl_log_add(struct sysctllog **logp, struct sysctlnode *node)
sysctl_log_add(struct sysctllog **logp, const struct sysctlnode *node)
{
int name[CTL_MAXNAME], namelen, i;
struct sysctlnode *pnode;
const struct sysctlnode *pnode;
struct sysctllog *log;
if (node->sysctl_flags & CTLFLAG_PERMANENT)
@ -2465,7 +2483,8 @@ sysctl_log_add(struct sysctllog **logp, struct sysctlnode *node)
void
sysctl_teardown(struct sysctllog **logp)
{
struct sysctlnode node, *rnode;
const struct sysctlnode *rnode;
struct sysctlnode node;
struct sysctllog *log;
uint namelen;
int *name, t, v, error, ni;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bpf.c,v 1.107 2005/02/26 22:45:09 perry Exp $ */
/* $NetBSD: bpf.c,v 1.108 2005/06/20 02:49:19 atatat Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.107 2005/02/26 22:45:09 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.108 2005/06/20 02:49:19 atatat Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1694,7 +1694,7 @@ sysctl_net_bpf_maxbufsize(SYSCTLFN_ARGS)
SYSCTL_SETUP(sysctl_net_bfp_setup, "sysctl net.bpf subtree setup")
{
struct sysctlnode *node;
const struct sysctlnode *node;
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_tap.c,v 1.9 2005/06/10 10:28:17 bouyer Exp $ */
/* $NetBSD: if_tap.c,v 1.10 2005/06/20 02:49:19 atatat Exp $ */
/*
* Copyright (c) 2003, 2004 The NetBSD Foundation.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.9 2005/06/10 10:28:17 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.10 2005/06/20 02:49:19 atatat Exp $");
#if defined(_KERNEL_OPT)
#include "bpfilter.h"
@ -257,7 +257,7 @@ tap_attach(struct device *parent, struct device *self, void *aux)
char enaddrstr[18];
uint32_t ui;
int error;
struct sysctlnode *node;
const struct sysctlnode *node;
aprint_normal("%s: faking Ethernet device\n",
self->dv_xname);
@ -1188,7 +1188,7 @@ tap_kqread(struct knote *kn, long hint)
*/
SYSCTL_SETUP(sysctl_tap_setup, "sysctl net.link.tap subtree setup")
{
struct sysctlnode *node;
const struct sysctlnode *node;
int error = 0;
if ((error = sysctl_createv(clog, 0, NULL, NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211.c,v 1.35 2005/06/09 02:19:59 atatat Exp $ */
/* $NetBSD: ieee80211.c,v 1.36 2005/06/20 02:49:18 atatat Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@ -35,7 +35,7 @@
#ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211.c,v 1.11 2004/04/02 20:19:20 sam Exp $");
#else
__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.35 2005/06/09 02:19:59 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.36 2005/06/20 02:49:18 atatat Exp $");
#endif
/*
@ -1155,7 +1155,7 @@ cleanup:
SYSCTL_SETUP(sysctl_ieee80211, "sysctl ieee80211 subtree setup")
{
int rc;
struct sysctlnode *cnode, *rnode;
const struct sysctlnode *cnode, *rnode;
if ((rc = sysctl_createv(clog, 0, NULL, &rnode,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "net", NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_rssadapt.c,v 1.9 2005/02/26 22:45:09 perry Exp $ */
/* $NetBSD: ieee80211_rssadapt.c,v 1.10 2005/06/20 02:49:18 atatat Exp $ */
/*-
* Copyright (c) 2003, 2004 David Young. All rights reserved.
*
@ -143,7 +143,7 @@ SYSCTL_SETUP(sysctl_ieee80211_rssadapt,
"sysctl ieee80211 rssadapt subtree setup")
{
int rc;
struct sysctlnode *node;
const struct sysctlnode *node;
if ((rc = sysctl_createv(clog, 0, NULL, &node,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "net", NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_arp.c,v 1.105 2005/06/01 12:29:58 drochner Exp $ */
/* $NetBSD: if_arp.c,v 1.106 2005/06/20 02:49:18 atatat Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.105 2005/06/01 12:29:58 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.106 2005/06/20 02:49:18 atatat Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@ -1470,7 +1470,7 @@ db_show_arptab(db_expr_t addr, int have_addr, db_expr_t count, const char *modif
SYSCTL_SETUP(sysctl_net_inet_arp_setup, "sysctl net.inet.arp subtree setup")
{
struct sysctlnode *node;
const struct sysctlnode *node;
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_usrreq.c,v 1.105 2005/06/09 02:19:59 atatat Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.106 2005/06/20 02:49:18 atatat Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.105 2005/06/09 02:19:59 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.106 2005/06/20 02:49:18 atatat Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -1196,6 +1196,10 @@ sysctl_inpcblist(SYSCTLFN_ARGS)
struct sockaddr_in6 *in6;
const struct in6pcb *in6p;
#endif
/*
* sysctl_data is const, but CIRCLEQ_FOREACH can't use a const
* struct inpcbtable pointer, so we have to discard const. :-/
*/
struct inpcbtable *pcbtbl = __UNCONST(rnode->sysctl_data);
const struct inpcb_hdr *inph;
struct tcpcb *tp;
@ -1364,7 +1368,7 @@ static void
sysctl_net_inet_tcp_setup2(struct sysctllog **clog, int pf, const char *pfname,
const char *tcpname)
{
struct sysctlnode *sack_node;
const struct sysctlnode *sack_node;
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipsec_netbsd.c,v 1.13 2005/02/26 22:45:13 perry Exp $ */
/* $NetBSD: ipsec_netbsd.c,v 1.14 2005/06/20 02:49:18 atatat Exp $ */
/* $KAME: esp_input.c,v 1.60 2001/09/04 08:43:19 itojun Exp $ */
/* $KAME: ah_input.c,v 1.64 2001/09/04 08:43:19 itojun Exp $ */
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ipsec_netbsd.c,v 1.13 2005/02/26 22:45:13 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: ipsec_netbsd.c,v 1.14 2005/06/20 02:49:18 atatat Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -362,7 +362,7 @@ sysctl_fast_ipsec(SYSCTLFN_ARGS)
/* XXX will need a different oid at parent */
SYSCTL_SETUP(sysctl_net_inet_fast_ipsec_setup, "sysctl net.inet.ipsec subtree setup")
{
struct sysctlnode *_ipsec;
const struct sysctlnode *_ipsec;
int ipproto_ipsec;
sysctl_createv(clog, 0, NULL, NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctl.h,v 1.137 2005/06/16 14:55:58 christos Exp $ */
/* $NetBSD: sysctl.h,v 1.138 2005/06/20 02:49:19 atatat Exp $ */
/*
* Copyright (c) 1989, 1993
@ -944,15 +944,9 @@ extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
#define SYSCTLFN_ARGS const int *name, u_int namelen, void *oldp, \
size_t *oldlenp, const void *newp, size_t newlen, \
const int *oname, struct lwp *l, const struct sysctlnode *rnode
#define SYSCTLFN_RWPROTO const int *, u_int, void *, \
size_t *, const void *, size_t, \
const int *, struct lwp *, struct sysctlnode *
#define SYSCTLFN_RWARGS const int *name, u_int namelen, void *oldp, \
size_t *oldlenp, const void *newp, size_t newlen, \
const int *oname, struct lwp *l, struct sysctlnode *rnode
#define SYSCTLFN_CALL(node) name, namelen, oldp, \
oldlenp, newp, newlen, \
oname, l, __UNCONST(node) /*XXXUNCONST*/
oname, l, node
#ifdef _LKM
@ -1021,28 +1015,28 @@ void sysctl_init(void);
* typical syscall call order
*/
int sysctl_lock(struct lwp *, void *, size_t);
int sysctl_dispatch(SYSCTLFN_RWPROTO);
int sysctl_dispatch(SYSCTLFN_PROTO);
void sysctl_unlock(struct lwp *);
/*
* tree navigation primitives (must obtain lock before using these)
*/
int sysctl_locate(struct lwp *, const int *, u_int, struct sysctlnode **,
int *);
int sysctl_locate(struct lwp *, const int *, u_int,
const struct sysctlnode **, int *);
int sysctl_query(SYSCTLFN_PROTO);
#ifdef SYSCTL_DEBUG_CREATE
#define sysctl_create _sysctl_create
#endif /* SYSCTL_DEBUG_CREATE */
int sysctl_create(SYSCTLFN_RWPROTO);
int sysctl_destroy(SYSCTLFN_RWPROTO);
int sysctl_lookup(SYSCTLFN_RWPROTO);
int sysctl_create(SYSCTLFN_PROTO);
int sysctl_destroy(SYSCTLFN_PROTO);
int sysctl_lookup(SYSCTLFN_PROTO);
int sysctl_describe(SYSCTLFN_PROTO);
/*
* simple variadic interface for adding/removing nodes
*/
int sysctl_createv(struct sysctllog **, int,
struct sysctlnode **, struct sysctlnode **,
const struct sysctlnode **, const struct sysctlnode **,
int, int, const char *, const char *,
sysctlfn, u_quad_t, void *, size_t, ...);
int sysctl_destroyv(struct sysctlnode *, ...);
@ -1199,8 +1193,8 @@ struct sysctldesc {
__sysc_desc_roundup(l)))
#define NEXT_DESCR(d) __sysc_desc_adv((d), (d)->descr_len)
static __inline struct sysctlnode *
sysctl_rootof(struct sysctlnode *n)
static __inline const struct sysctlnode *
sysctl_rootof(const struct sysctlnode *n)
{
while (n->sysctl_parent != NULL)
n = n->sysctl_parent;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_dirhash.c,v 1.3 2005/05/31 02:37:50 christos Exp $ */
/* $NetBSD: ufs_dirhash.c,v 1.4 2005/06/20 02:49:19 atatat Exp $ */
/*
* Copyright (c) 2001, 2002 Ian Dowse. All rights reserved.
@ -1067,7 +1067,7 @@ ufsdirhash_done()
SYSCTL_SETUP(sysctl_vfs_ufs_setup, "sysctl vfs.ufs.dirhash subtree setup")
{
struct sysctlnode *rnode, *cnode;
const struct sysctlnode *rnode, *cnode;
sysctl_createv(clog, 0, NULL, &rnode,
CTLFLAG_PERMANENT,