Subject: Re: sysctl patches for -Wcast-qual
To: None <tech-kern@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: tech-kern
Date: 06/08/2005 17:54:11
--wRRV7LY7NUeQGEoC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Jun 08, 2005 at 11:26:00AM -0500, David Young wrote:
> I have quieted a bunch of -Wcast-qual complaints on sysctl uses.  I made
> SYSCTLFN_CALL(node) cast `node' to const.  I added SYSCTLFN_RWCALL(node)
> to set up a call to sysctl_lookup, whose `rnode' argument is not const.
> Barring any objections, I will commit this in a few hours.
> 
> (Sorry, patches to stop variable shadowing in rtw(4) are inter-mixed.)

Patches attached, this time.

(I'm holding off on committing at Andrew Brown's request.)

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933

--wRRV7LY7NUeQGEoC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=sysctl-patches

Index: sys/arch/i386/i386/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.563
diff -u -r1.563 machdep.c
--- sys/arch/i386/i386/machdep.c	29 May 2005 21:33:01 -0000	1.563
+++ sys/arch/i386/i386/machdep.c	8 Jun 2005 16:14:07 -0000
@@ -429,7 +429,7 @@
 		return (EOPNOTSUPP);
 	}
 
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -459,7 +459,7 @@
 	node = *rnode;
 	node.sysctl_data = bibp->bootpath;
 	node.sysctl_size = sizeof(bibp->bootpath);
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 /*
@@ -476,7 +476,7 @@
 	node.sysctl_data = x86_alldisks;
 	node.sysctl_size = sizeof(struct disklist) +
 	    (x86_ndisks - 1) * sizeof(struct nativedisk_info);
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 /*
Index: sys/dev/ic/ath.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/ath.c,v
retrieving revision 1.45
diff -u -r1.45 ath.c
--- sys/dev/ic/ath.c	27 Feb 2005 00:27:00 -0000	1.45
+++ sys/dev/ic/ath.c	8 Jun 2005 16:14:08 -0000
@@ -301,7 +301,7 @@
 	node = *rnode;
 	t = *(int*)rnode->sysctl_data;
 	node.sysctl_data = &t;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/dev/ic/rtw.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/rtw.c,v
retrieving revision 1.45
diff -u -r1.45 rtw.c
--- sys/dev/ic/rtw.c	2 Mar 2005 05:20:43 -0000	1.45
+++ sys/dev/ic/rtw.c	8 Jun 2005 16:14:10 -0000
@@ -183,7 +183,7 @@
 	node = *rnode;
 	t = *(int*)rnode->sysctl_data;
 	node.sysctl_data = &t;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -703,16 +703,17 @@
 	int i;
 	const char *rfname, *paname;
 	char scratch[sizeof("unknown 0xXX")];
-	uint16_t version;
+	uint16_t srom_version;
 	uint8_t mac[IEEE80211_ADDR_LEN];
 
 	*flags &= ~(RTW_F_DIGPHY|RTW_F_DFLANTB|RTW_F_ANTDIV);
 	*rcr &= ~(RTW_RCR_ENCS1 | RTW_RCR_ENCS2);
 
-	version = RTW_SR_GET16(sr, RTW_SR_VERSION);
-	printf("%s: SROM version %d.%d", dvname, version >> 8, version & 0xff);
+	srom_version = RTW_SR_GET16(sr, RTW_SR_VERSION);
+	printf("%s: SROM version %d.%d", dvname,
+	    srom_version >> 8, srom_version & 0xff);
 
-	if (version <= 0x0101) {
+	if (srom_version <= 0x0101) {
 		printf(" is not understood, limping along with defaults\n");
 		rtw_srom_defaults(sr, flags, cs_threshold, rfchipid, rcr);
 		return 0;
@@ -3810,7 +3811,7 @@
  * revisions A and B.
  */
 static uint8_t
-rtw_check_phydelay(struct rtw_regs *regs, uint32_t rcr0)
+rtw_check_phydelay(struct rtw_regs *regs, uint32_t old_rcr)
 {
 #define REVAB (RTW_RCR_MXDMA_UNLIMITED | RTW_RCR_AICV)
 #define REVC (REVAB | RTW_RCR_RXFTH_WHOLE)
@@ -3825,7 +3826,7 @@
 	if ((RTW_READ(regs, RTW_RCR) & REVC) == REVC)
 		phydelay |= RTW_PHYDELAY_REVC_MAGIC;
 
-	RTW_WRITE(regs, RTW_RCR, rcr0);	/* restore RCR */
+	RTW_WRITE(regs, RTW_RCR, old_rcr);	/* restore RCR */
 	RTW_SYNC(regs, RTW_RCR, RTW_RCR);
 
 	return phydelay;
Index: sys/kern/init_sysctl.c
===================================================================
RCS file: /cvsroot/src/sys/kern/init_sysctl.c,v
retrieving revision 1.42
diff -u -r1.42 init_sysctl.c
--- sys/kern/init_sysctl.c	6 Jun 2005 19:56:46 -0000	1.42
+++ sys/kern/init_sysctl.c	8 Jun 2005 16:14:11 -0000
@@ -1014,7 +1014,7 @@
 	new_vnodes = desiredvnodes;
 	node = *rnode;
 	node.sysctl_data = &new_vnodes;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1046,7 +1046,7 @@
 	new_rtc_offset = rtc_offset;
 	node = *rnode;
 	node.sysctl_data = &new_rtc_offset;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1081,7 +1081,7 @@
 	nmaxproc = maxproc;
 	node = *rnode;
 	node.sysctl_data = &nmaxproc;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1109,7 +1109,7 @@
 	newsecurelevel = securelevel;
 	node = *rnode;
 	node.sysctl_data = &newsecurelevel;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1133,7 +1133,7 @@
 	inthostid = hostid;  /* XXX assumes sizeof int <= sizeof long */
 	node = *rnode;
 	node.sysctl_data = &inthostid;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1153,7 +1153,7 @@
 	int error;
 
 	/*XXXUNCONST*/
-	error = sysctl_lookup(SYSCTLFN_CALL(__UNCONST(rnode)));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(__UNCONST(rnode)));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1187,7 +1187,7 @@
 
 	node = *rnode;
 	node.sysctl_data = &clkinfo;
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 
@@ -1256,7 +1256,7 @@
 	node = *rnode;
 	t = *(int*)node.sysctl_data;
 	node.sysctl_data = &t;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1300,7 +1300,7 @@
 		struct sysctlnode node = *rnode;
 		int msg_bufs = (int)msgbufp->msg_bufs;
 		node.sysctl_data = &msg_bufs;
-		return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+		return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 	}
 	case KERN_MSGBUF:
 		break;
@@ -1362,7 +1362,7 @@
 	node = *rnode;
 	node.sysctl_data = &newcorename[0];
 	memcpy(node.sysctl_data, rnode->sysctl_data, MAXPATHLEN);
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1400,7 +1400,7 @@
 	}
 	node.sysctl_data = curcpu()->ci_schedstate.spc_cp_time;
 	node.sysctl_size = sizeof(curcpu()->ci_schedstate.spc_cp_time);
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 
 #else /* MULTIPROCESSOR */
 
@@ -1472,7 +1472,7 @@
 			n--;
 	}
 
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	free(node.sysctl_data, M_TEMP);
 	return (error);
 
@@ -1684,7 +1684,7 @@
 
 	node = *rnode;
 	node.sysctl_data = &xmax;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1708,7 +1708,7 @@
 	new_sbmax = sb_max;
 	node = *rnode;
 	node.sysctl_data = &new_sbmax;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1730,7 +1730,7 @@
 	if (rnd_extract_data(&v, sizeof(v), RND_EXTRACT_ANY) == sizeof(v)) {
 		struct sysctlnode node = *rnode;
 		node.sysctl_data = &v;
-		return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+		return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 	}
 	else
 		return (EIO);	/*XXX*/
@@ -1816,7 +1816,7 @@
 	lsleep = forkfsleep * 1000 / hz;
 	node = *rnode;
 	node.sysctl_data = &lsleep;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1845,7 +1845,7 @@
 	struct sysctlnode node = *rnode;
 
 	node.sysctl_data = &rootpart;
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 /*
@@ -2420,7 +2420,7 @@
 	case VERIEXEC_ALGORITHMS:
 		node.sysctl_data = veriexec_fp_names;
 		node.sysctl_size = strlen(veriexec_fp_names) + 1;
-		return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+		return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 	default:
 		return (EINVAL);
 	}
@@ -2431,7 +2431,7 @@
 	newval = *var;
 
 	node.sysctl_data = &newval;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL) {
 		return (error);
 	}
@@ -2471,7 +2471,7 @@
 		return (EINVAL);
 	}
 
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 /*
@@ -2489,7 +2489,7 @@
 		cn_get_magic(magic, CNS_LEN);
 	node = *rnode;
 	node.sysctl_data = &magic[0];
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -2506,7 +2506,7 @@
 	node = *rnode;
 	node.sysctl_data = &ncpu;
 
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 
@@ -2529,7 +2529,7 @@
 	node = *rnode;
 	node.sysctl_data = root_device->dv_xname;
 	node.sysctl_size = strlen(root_device->dv_xname) + 1;
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 /*
@@ -2550,7 +2550,7 @@
 	node = *rnode;
 	node.sysctl_data = &consdev;
 	node.sysctl_size = sizeof(consdev);
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 /*
Index: sys/kern/kern_ntptime.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_ntptime.c,v
retrieving revision 1.28
diff -u -r1.28 kern_ntptime.c
--- sys/kern/kern_ntptime.c	26 Feb 2005 21:34:55 -0000	1.28
+++ sys/kern/kern_ntptime.c	8 Jun 2005 16:14:11 -0000
@@ -386,7 +386,7 @@
 	node = *rnode;
 	node.sysctl_data = &ntv;
 	node.sysctl_size = sizeof(ntv);
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 SYSCTL_SETUP(sysctl_kern_ntptime_setup, "sysctl kern.ntptime node setup")
Index: sys/kern/kern_resource.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_resource.c,v
retrieving revision 1.97
diff -u -r1.97 kern_resource.c
--- sys/kern/kern_resource.c	29 May 2005 22:24:15 -0000	1.97
+++ sys/kern/kern_resource.c	8 Jun 2005 16:14:11 -0000
@@ -665,7 +665,7 @@
 	node = *rnode;
 	strlcpy(cname, ptmp->p_limit->pl_corename, sizeof(cname));
 	node.sysctl_data = cname;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 
 	/*
 	 * if that failed, or they have nothing new to say, or we've
@@ -745,7 +745,7 @@
 	i = (ptmp->p_flag & f) ? 1 : 0;
 	node = *rnode;
 	node.sysctl_data = &i;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -796,7 +796,7 @@
 	else
 		node.sysctl_data = &alim.rlim_cur;
 
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/kern/subr_prof.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_prof.c,v
retrieving revision 1.31
diff -u -r1.31 subr_prof.c
--- sys/kern/subr_prof.c	8 Apr 2004 06:20:30 -0000	1.31
+++ sys/kern/subr_prof.c	8 Jun 2005 16:14:12 -0000
@@ -142,7 +142,7 @@
 		return (EOPNOTSUPP);
 	}
 
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/kern/uipc_mbuf.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_mbuf.c,v
retrieving revision 1.100
diff -u -r1.100 uipc_mbuf.c
--- sys/kern/uipc_mbuf.c	6 Jun 2005 06:06:50 -0000	1.100
+++ sys/kern/uipc_mbuf.c	8 Jun 2005 16:14:12 -0000
@@ -220,7 +220,7 @@
 		return (EOPNOTSUPP);
 	}
 
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 	if (newval < 0)
Index: sys/kern/uipc_socket.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_socket.c,v
retrieving revision 1.111
diff -u -r1.111 uipc_socket.c
--- sys/kern/uipc_socket.c	8 May 2005 18:44:39 -0000	1.111
+++ sys/kern/uipc_socket.c	8 Jun 2005 16:14:12 -0000
@@ -1754,7 +1754,7 @@
 	new_somaxkva = somaxkva;
 	node = *rnode;
 	node.sysctl_data = &new_somaxkva;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/kern/vfs_bio.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_bio.c,v
retrieving revision 1.145
diff -u -r1.145 vfs_bio.c
--- sys/kern/vfs_bio.c	29 May 2005 22:24:15 -0000	1.145
+++ sys/kern/vfs_bio.c	8 Jun 2005 16:14:13 -0000
@@ -1613,7 +1613,7 @@
 	node = *rnode;
 	node.sysctl_data = &t;
 	t = *(int *)rnode->sysctl_data;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/kern/vfs_subr.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_subr.c,v
retrieving revision 1.248
diff -u -r1.248 vfs_subr.c
--- sys/kern/vfs_subr.c	6 Jun 2005 12:09:19 -0000	1.248
+++ sys/kern/vfs_subr.c	8 Jun 2005 16:14:14 -0000
@@ -1960,7 +1960,7 @@
 
 	node = *rnode;
 	node.sysctl_data = &vfc;
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 #endif
 
Index: sys/net/bpf.c
===================================================================
RCS file: /cvsroot/src/sys/net/bpf.c,v
retrieving revision 1.107
diff -u -r1.107 bpf.c
--- sys/net/bpf.c	26 Feb 2005 22:45:09 -0000	1.107
+++ sys/net/bpf.c	8 Jun 2005 16:14:15 -0000
@@ -1680,7 +1680,7 @@
 	node = *rnode;
 	node.sysctl_data = &newsize;
 	newsize = bpf_maxbufsize;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/net/if_tap.c
===================================================================
RCS file: /cvsroot/src/sys/net/if_tap.c,v
retrieving revision 1.8
diff -u -r1.8 if_tap.c
--- sys/net/if_tap.c	17 May 2005 04:14:58 -0000	1.8
+++ sys/net/if_tap.c	8 Jun 2005 16:14:15 -0000
@@ -1270,7 +1270,7 @@
 	ifp = &sc->sc_ec.ec_if;
 	(void)tap_ether_sprintf(addr, LLADDR(ifp->if_sadl));
 	node.sysctl_data = addr;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/net80211/ieee80211.c
===================================================================
RCS file: /cvsroot/src/sys/net80211/ieee80211.c,v
retrieving revision 1.34
diff -u -r1.34 ieee80211.c
--- sys/net80211/ieee80211.c	30 May 2005 04:16:56 -0000	1.34
+++ sys/net80211/ieee80211.c	8 Jun 2005 16:14:15 -0000
@@ -947,7 +947,7 @@
 	node = *rnode;
 	t = *(int*)rnode->sysctl_data;
 	node.sysctl_data = &t;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/net80211/ieee80211_rssadapt.c
===================================================================
RCS file: /cvsroot/src/sys/net80211/ieee80211_rssadapt.c,v
retrieving revision 1.9
diff -u -r1.9 ieee80211_rssadapt.c
--- sys/net80211/ieee80211_rssadapt.c	26 Feb 2005 22:45:09 -0000	1.9
+++ sys/net80211/ieee80211_rssadapt.c	8 Jun 2005 16:14:15 -0000
@@ -90,7 +90,7 @@
 	node = *rnode;
 	t = *(int*)rnode->sysctl_data;
 	node.sysctl_data = &t;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -113,7 +113,7 @@
 	node = *rnode;
 	rc = *(struct ieee80211_rssadapt_expavgctl *)rnode->sysctl_data;
 	node.sysctl_data = &rc;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/netinet/ip_icmp.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/ip_icmp.c,v
retrieving revision 1.92
diff -u -r1.92 ip_icmp.c
--- sys/netinet/ip_icmp.c	29 Apr 2005 10:39:09 -0000	1.92
+++ sys/netinet/ip_icmp.c	8 Jun 2005 16:14:16 -0000
@@ -894,7 +894,7 @@
 	node = *rnode;
 	node.sysctl_data = &t;
 	t = icmpreturndatabytes;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -919,7 +919,7 @@
 	node = *rnode;
 	node.sysctl_data = &tmp;
 	tmp = icmp_redirtimeout;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 	if (tmp < 0)
Index: sys/netinet/ip_input.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/ip_input.c,v
retrieving revision 1.216
diff -u -r1.216 ip_input.c
--- sys/netinet/ip_input.c	1 Jun 2005 09:45:15 -0000	1.216
+++ sys/netinet/ip_input.c	8 Jun 2005 16:14:17 -0000
@@ -2115,7 +2115,7 @@
 	node = *rnode;
 	tmp = ip_mtudisc_timeout;
 	node.sysctl_data = &tmp;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 	if (tmp < 0)
@@ -2137,7 +2137,7 @@
 {
 	int s;
 
-	s = sysctl_lookup(SYSCTLFN_CALL(__UNCONST(rnode)));
+	s = sysctl_lookup(SYSCTLFN_RWCALL(__UNCONST(rnode)));
 	if (s)
 		return (s);
 
Index: sys/netinet/tcp_usrreq.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/tcp_usrreq.c,v
retrieving revision 1.104
diff -u -r1.104 tcp_usrreq.c
--- sys/netinet/tcp_usrreq.c	29 May 2005 21:41:23 -0000	1.104
+++ sys/netinet/tcp_usrreq.c	8 Jun 2005 16:14:17 -0000
@@ -942,7 +942,7 @@
 	mssdflt = tcp_mssdflt;
 	node = *rnode;
 	node.sysctl_data = &mssdflt;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
@@ -1006,7 +1006,7 @@
 	node = *rnode;
 	tmp = *(int*)rnode->sysctl_data;
 	node.sysctl_data = &tmp;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/netinet6/ipsec.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/ipsec.c,v
retrieving revision 1.102
diff -u -r1.102 ipsec.c
--- sys/netinet6/ipsec.c	7 May 2005 17:44:11 -0000	1.102
+++ sys/netinet6/ipsec.c	8 Jun 2005 16:14:18 -0000
@@ -3606,7 +3606,7 @@
 	else
 		t = *(int*)rnode->sysctl_data;
 	node.sysctl_data = &t;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/netipsec/ipsec_netbsd.c
===================================================================
RCS file: /cvsroot/src/sys/netipsec/ipsec_netbsd.c,v
retrieving revision 1.13
diff -u -r1.13 ipsec_netbsd.c
--- sys/netipsec/ipsec_netbsd.c	26 Feb 2005 22:45:13 -0000	1.13
+++ sys/netipsec/ipsec_netbsd.c	8 Jun 2005 16:14:18 -0000
@@ -330,7 +330,7 @@
 	node = *rnode;
 	t = *(int*)rnode->sysctl_data;
 	node.sysctl_data = &t;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 
Index: sys/nfs/nfs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_vfsops.c,v
retrieving revision 1.147
diff -u -r1.147 nfs_vfsops.c
--- sys/nfs/nfs_vfsops.c	29 May 2005 20:58:13 -0000	1.147
+++ sys/nfs/nfs_vfsops.c	8 Jun 2005 16:14:19 -0000
@@ -977,7 +977,7 @@
 
 	nfs_getset_niothreads(0);
 	/*XXXUNCONST*/
-        error = sysctl_lookup(SYSCTLFN_CALL(__UNCONST(rnode)));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(__UNCONST(rnode)));
 	if (error || newp == NULL)
 		return (error);
 	nfs_getset_niothreads(1);
Index: sys/sys/sysctl.h
===================================================================
RCS file: /cvsroot/src/sys/sys/sysctl.h,v
retrieving revision 1.135
diff -u -r1.135 sysctl.h
--- sys/sys/sysctl.h	29 May 2005 21:19:41 -0000	1.135
+++ sys/sys/sysctl.h	8 Jun 2005 16:14:19 -0000
@@ -950,6 +950,9 @@
 	const int *oname, struct lwp *l, struct sysctlnode *rnode
 #define SYSCTLFN_CALL(node) name, namelen, oldp, \
 	oldlenp, newp, newlen, \
+	oname, l, (const struct sysctlnode *)node
+#define SYSCTLFN_RWCALL(node) name, namelen, oldp, \
+	oldlenp, newp, newlen, \
 	oname, l, (struct sysctlnode *)node
 
 #ifdef _LKM
Index: sys/uvm/uvm_meter.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_meter.c,v
retrieving revision 1.34
diff -u -r1.34 uvm_meter.c
--- sys/uvm/uvm_meter.c	15 May 2005 08:01:06 -0000	1.34
+++ sys/uvm/uvm_meter.c	8 Jun 2005 16:14:19 -0000
@@ -131,7 +131,7 @@
 	node.sysctl_data = &vmtotals;
 	uvm_total(&vmtotals);
 
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 /*
@@ -146,7 +146,7 @@
 	if (oldp)
 		node.sysctl_size = min(*oldlenp, node.sysctl_size);
 
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 static int
@@ -235,7 +235,7 @@
 	node = *rnode;
 	node.sysctl_data = &u;
 	node.sysctl_size = sizeof(u);
-	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	return (sysctl_lookup(SYSCTLFN_RWCALL(&node)));
 }
 
 /*
@@ -252,7 +252,7 @@
 	node = *rnode;
 	node.sysctl_data = &t;
 	t = *(int*)rnode->sysctl_data;
-	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	error = sysctl_lookup(SYSCTLFN_RWCALL(&node));
 	if (error || newp == NULL)
 		return (error);
 

--wRRV7LY7NUeQGEoC--