PERFORCE change 153592 for review

Marko Zec zec at FreeBSD.org
Wed Nov 26 02:27:02 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=153592

Change 153592 by zec at zec_tpx32 on 2008/11/26 10:26:09

	Further reduce the diff between vimage and vimage_commit2 branches
	by merging over a few V_ / INIT_VNET / CURVNET_SET / SYSCTL_V /
	#ifdef VIMAGE_GLOBALS non-functional changes.

Affected files ...

.. //depot/projects/vimage-commit2/src/sys/kern/kern_poll.c#7 edit
.. //depot/projects/vimage-commit2/src/sys/kern/kern_sysctl.c#2 edit
.. //depot/projects/vimage-commit2/src/sys/net/bpf.c#7 edit
.. //depot/projects/vimage-commit2/src/sys/net/if.c#24 edit
.. //depot/projects/vimage-commit2/src/sys/net/if_loop.c#14 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/if_ether.c#20 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/in_pcb.c#25 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/in_rmx.c#19 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/vinet.h#13 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/icmp6.c#17 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/in6_ifattach.c#14 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/in6_proto.c#12 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/in6_src.c#13 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/nd6_rtr.c#14 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/raw_ip6.c#17 edit
.. //depot/projects/vimage-commit2/src/sys/netipsec/key.c#19 edit

Differences ...

==== //depot/projects/vimage-commit2/src/sys/kern/kern_poll.c#7 (text+ko) ====

@@ -521,6 +521,7 @@
 static int
 poll_switch(SYSCTL_HANDLER_ARGS)
 {
+	INIT_VNET_INET(curvnet);
 	struct ifnet *ifp;
 	int error;
 	int val = polling;

==== //depot/projects/vimage-commit2/src/sys/kern/kern_sysctl.c#2 (text+ko) ====

@@ -1413,6 +1413,7 @@
 	req.lock = REQ_LOCKED;
 
 	SYSCTL_LOCK();
+	CURVNET_SET(TD_TO_VNET(curthread));
 
 	do {
 		req.oldidx = 0;
@@ -1423,6 +1424,7 @@
 	if (req.lock == REQ_WIRED && req.validlen > 0)
 		vsunlock(req.oldptr, req.validlen);
 
+	CURVNET_RESTORE();
 	SYSCTL_UNLOCK();
 
 	if (error && error != ENOMEM)

==== //depot/projects/vimage-commit2/src/sys/net/bpf.c#7 (text+ko) ====

@@ -566,7 +566,9 @@
 	 */
 	if (d->bd_promisc) {
 		d->bd_promisc = 0;
+		CURVNET_SET(ifp->if_vnet);
 		error = ifpromisc(ifp, 0);
+		CURVNET_RESTORE();
 		if (error != 0 && error != ENXIO) {
 			/*
 			 * ENXIO can happen if a pccard is unplugged
@@ -872,7 +874,9 @@
 
 #ifdef MAC
 	BPFD_LOCK(d);
+	CURVNET_SET(ifp->if_vnet);
 	mac_bpfdesc_create_mbuf(d, m);
+	CURVNET_RESTORE();
 	if (mc != NULL)
 		mac_bpfdesc_create_mbuf(d, mc);
 	BPFD_UNLOCK(d);
@@ -993,6 +997,7 @@
 			return (EPERM);
 		}
 	}
+	CURVNET_SET(TD_TO_VNET(td));
 	switch (cmd) {
 
 	default:
@@ -1322,6 +1327,7 @@
 	case BIOCROTZBUF:
 		return (bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr));
 	}
+	CURVNET_RESTORE();
 	return (error);
 }
 

==== //depot/projects/vimage-commit2/src/sys/net/if.c#24 (text+ko) ====

@@ -192,7 +192,6 @@
 struct ifaddr *
 ifaddr_byindex(u_short idx)
 {
-	INIT_VNET_NET(curvnet);
 	struct ifaddr *ifa;
 
 	IFNET_RLOCK();

==== //depot/projects/vimage-commit2/src/sys/net/if_loop.c#14 (text+ko) ====

@@ -105,6 +105,9 @@
 static void
 lo_clone_destroy(struct ifnet *ifp)
 {
+#ifdef INVARIANTS
+	INIT_VNET_NET(ifp->if_vnet);
+#endif
 
 	/* XXX: destroying lo0 will lead to panics. */
 	KASSERT(V_loif != ifp, ("%s: destroying lo0", __func__));

==== //depot/projects/vimage-commit2/src/sys/netinet/if_ether.c#20 (text+ko) ====

@@ -89,8 +89,8 @@
 static int	arp_proxyall;
 #endif
 
-SYSCTL_INT(_net_link_ether_inet, OID_AUTO, max_age, CTLFLAG_RW, 
-	   &arpt_keep, 0, "ARP entry lifetime in seconds");
+SYSCTL_V_INT(V_NET, vnet_inet, _net_link_ether_inet, OID_AUTO, max_age,
+    CTLFLAG_RW, arpt_keep, 0, "ARP entry lifetime in seconds");
 
 #define	rt_expire rt_rmx.rmx_expire
 

==== //depot/projects/vimage-commit2/src/sys/netinet/in_pcb.c#25 (text+ko) ====

@@ -1475,7 +1475,7 @@
 	struct inpcb *inp;
 
 	INP_INFO_RLOCK(&V_tcbinfo);
-	LIST_FOREACH(inp, tcbinfo.ipi_listhead, inp_list) {
+	LIST_FOREACH(inp, V_tcbinfo.ipi_listhead, inp_list) {
 		INP_WLOCK(inp);
 		func(inp, arg);
 		INP_WUNLOCK(inp);

==== //depot/projects/vimage-commit2/src/sys/netinet/in_rmx.c#19 (text+ko) ====

@@ -342,6 +342,7 @@
 	VNET_FOREACH(vnet_iter) {
 		CURVNET_SET(vnet_iter);
 		INIT_VNET_NET(vnet_iter);
+
 		for ( fibnum = 0; fibnum < rt_numfibs; fibnum++) {
 			rnh = V_rt_tables[fibnum][AF_INET];
 			arg.found = arg.killed = 0;

==== //depot/projects/vimage-commit2/src/sys/netinet/vinet.h#13 (text+ko) ====

@@ -210,7 +210,6 @@
 #define	V_arp_maxtries		VNET_INET(arp_maxtries)
 #define	V_arp_proxyall		VNET_INET(arp_proxyall)
 #define	V_arpt_keep		VNET_INET(arpt_keep)
-#define	V_arpt_prune		VNET_INET(arpt_prune)
 #define	V_blackhole		VNET_INET(blackhole)
 #define	V_divcb			VNET_INET(divcb)
 #define	V_divcbinfo		VNET_INET(divcbinfo)

==== //depot/projects/vimage-commit2/src/sys/netinet6/icmp6.c#17 (text+ko) ====

@@ -108,12 +108,13 @@
 #endif
 
 extern struct domain inet6domain;
+
+#ifdef VIMAGE_GLOBALS
 extern struct inpcbinfo ripcbinfo;
 extern struct inpcbhead ripcb;
 extern int icmp6errppslim;
 extern int icmp6_nodeinfo;
 
-#ifdef VIMAGE_GLOBALS
 struct icmp6stat icmp6stat;
 static int icmp6errpps_count;
 static struct timeval icmp6errppslim_last;

==== //depot/projects/vimage-commit2/src/sys/netinet6/in6_ifattach.c#14 (text+ko) ====

@@ -65,10 +65,9 @@
 unsigned long in6_maxmtu;
 int ip6_auto_linklocal;
 struct callout in6_tmpaddrtimer_ch;
-#endif
-
 extern struct inpcbinfo udbinfo;
 extern struct inpcbinfo ripcbinfo;
+#endif
 
 static int get_rand_ifid(struct ifnet *, struct in6_addr *);
 static int generate_tmp_ifid(u_int8_t *, const u_int8_t *, u_int8_t *);

==== //depot/projects/vimage-commit2/src/sys/netinet6/in6_proto.c#12 (text+ko) ====

@@ -563,6 +563,6 @@
 SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_DEBUG,
 	nd6_debug, CTLFLAG_RW,	nd6_debug,		0, "");
 
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_ONLINKNSRFC4861,
-	nd6_onlink_ns_rfc4861, CTLFLAG_RW, &nd6_onlink_ns_rfc4861, 0,
+SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_ONLINKNSRFC4861,
+	nd6_onlink_ns_rfc4861, CTLFLAG_RW, nd6_onlink_ns_rfc4861, 0,
 	"Accept 'on-link' nd6 NS in compliance with RFC 4861.");

==== //depot/projects/vimage-commit2/src/sys/netinet6/in6_src.c#13 (text+ko) ====

@@ -462,7 +462,6 @@
     struct ifnet **retifp, struct rtentry **retrt, int clone,
     int norouteok)
 {
-	INIT_VNET_NET(curvnet);
 	INIT_VNET_INET6(curvnet);
 	int error = 0;
 	struct ifnet *ifp = NULL;

==== //depot/projects/vimage-commit2/src/sys/netinet6/nd6_rtr.c#14 (text+ko) ====

@@ -85,9 +85,9 @@
 
 static int rt6_deleteroute(struct radix_node *, void *);
 
+#ifdef VIMAGE_GLOBALS
 extern int nd6_recalc_reachtm_interval;
 
-#ifdef VIMAGE_GLOBALS
 static struct ifnet *nd6_defifp;
 int nd6_defifindex;
 

==== //depot/projects/vimage-commit2/src/sys/netinet6/raw_ip6.c#17 (text+ko) ====

@@ -112,15 +112,15 @@
  * Raw interface to IP6 protocol.
  */
 
+#ifdef VIMAGE_GLOBALS
 extern struct	inpcbhead ripcb;
 extern struct	inpcbinfo ripcbinfo;
+struct rip6stat rip6stat;
+#endif
+
 extern u_long	rip_sendspace;
 extern u_long	rip_recvspace;
 
-#ifdef VIMAGE_GLOBALS
-struct rip6stat rip6stat;
-#endif
-
 /*
  * Hooks for multicast forwarding.
  */

==== //depot/projects/vimage-commit2/src/sys/netipsec/key.c#19 (text+ko) ====

@@ -4336,6 +4336,7 @@
 	VNET_ITERATOR_DECL(vnet_iter);
 	time_t now = time_second;
 
+	VNET_LIST_RLOCK();
 	VNET_FOREACH(vnet_iter) {
 		CURVNET_SET(vnet_iter);
 		key_flush_spd(now);
@@ -4344,6 +4345,7 @@
 		key_flush_spacq(now);
 		CURVNET_RESTORE();
 	}
+	VNET_LIST_RUNLOCK();
 
 #ifndef IPSEC_DEBUG2
 	/* do exchange to tick time !! */


More information about the p4-projects mailing list