svn commit: r195782 - in head/sys: net netinet netinet6 netipsec

Robert Watson rwatson at FreeBSD.org
Mon Jul 20 13:55:34 UTC 2009


Author: rwatson
Date: Mon Jul 20 13:55:33 2009
New Revision: 195782
URL: http://svn.freebsd.org/changeset/base/195782

Log:
  Garbage collect vnet module registrations that have neither constructors
  nor destructors, as there's no actual work to do.
  
  In most cases, the constructors weren't needed because of the existing
  protocol initialization functions run by net_init_domain() as part of
  VNET_MOD_NET, or they were eliminated when support for static
  initialization of virtualized globals was added.
  
  Garbage collect dependency references to modules without constructors or
  destructors, notably VNET_MOD_INET and VNET_MOD_INET6.
  
  Reviewed by:	bz
  Approved by:	re (vimage blanket)

Modified:
  head/sys/net/flowtable.c
  head/sys/netinet/igmp.c
  head/sys/netinet/ip_input.c
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/mld6.c
  head/sys/netipsec/ipsec.c
  head/sys/netipsec/xform_ipcomp.c
  head/sys/netipsec/xform_ipip.c

Modified: head/sys/net/flowtable.c
==============================================================================
--- head/sys/net/flowtable.c	Mon Jul 20 11:17:54 2009	(r195781)
+++ head/sys/net/flowtable.c	Mon Jul 20 13:55:33 2009	(r195782)
@@ -180,7 +180,6 @@ static int	flowtable_idetach(const void 
 static const vnet_modinfo_t flowtable_modinfo = {
 	.vmi_id		= VNET_MOD_FLOWTABLE,
 	.vmi_name	= "flowtable",
-	.vmi_dependson	= VNET_MOD_INET,
 	.vmi_iattach    = flowtable_iattach,
 	.vmi_idetach    = flowtable_idetach
 };

Modified: head/sys/netinet/igmp.c
==============================================================================
--- head/sys/netinet/igmp.c	Mon Jul 20 11:17:54 2009	(r195781)
+++ head/sys/netinet/igmp.c	Mon Jul 20 13:55:33 2009	(r195782)
@@ -224,7 +224,10 @@ static VNET_DEFINE(int, current_state_ti
 #define	V_current_state_timers_running	VNET(current_state_timers_running)
 
 static VNET_DEFINE(LIST_HEAD(, igmp_ifinfo), igi_head);
-static VNET_DEFINE(struct igmpstat, igmpstat);
+static VNET_DEFINE(struct igmpstat, igmpstat) = {
+	.igps_version = IGPS_VERSION_3,
+	.igps_len = sizeof(struct igmpstat),
+};
 static VNET_DEFINE(struct timeval, igmp_gsrdelay) = {10, 0};
 
 #define	V_igi_head			VNET(igi_head)
@@ -3615,12 +3618,6 @@ vnet_igmp_iattach(const void *unused __u
 
 	LIST_INIT(&V_igi_head);
 
-	/*
-	 * Initialize sysctls to default values.
-	 */
-	V_igmpstat.igps_version = IGPS_VERSION_3;
-	V_igmpstat.igps_len = sizeof(struct igmpstat);
-
 	return (0);
 }
 
@@ -3640,7 +3637,6 @@ vnet_igmp_idetach(const void *unused __u
 static vnet_modinfo_t vnet_igmp_modinfo = {
 	.vmi_id		= VNET_MOD_IGMP,
 	.vmi_name	= "igmp",
-	.vmi_dependson	= VNET_MOD_INET,
 	.vmi_iattach	= vnet_igmp_iattach,
 	.vmi_idetach	= vnet_igmp_idetach
 };

Modified: head/sys/netinet/ip_input.c
==============================================================================
--- head/sys/netinet/ip_input.c	Mon Jul 20 11:17:54 2009	(r195781)
+++ head/sys/netinet/ip_input.c	Mon Jul 20 13:55:33 2009	(r195782)
@@ -236,24 +236,6 @@ VNET_DEFINE(int, fw_one_pass) = 1;
 
 static void	ip_freef(struct ipqhead *, struct ipq *);
 
-#ifdef VIMAGE
-/* XXX only has to stay for .vmi_dependson elsewhere. */
-static void vnet_inet_register(void);
- 
-static const vnet_modinfo_t vnet_inet_modinfo = {
-	.vmi_id		= VNET_MOD_INET,
-	.vmi_name	= "inet",
-};
- 
-static void vnet_inet_register()
-{
-  
-	vnet_mod_register(&vnet_inet_modinfo);
-}
- 
-SYSINIT(inet, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, vnet_inet_register, 0);
-#endif
-
 static int
 sysctl_netinet_intr_queue_maxlen(SYSCTL_HANDLER_ARGS)
 {
@@ -302,8 +284,6 @@ ip_init(void)
 	struct protosw *pr;
 	int i;
 
-	V_ip_id = time_second & 0xffff;
-
 	TAILQ_INIT(&V_in_ifaddrhead);
 	V_in_ifaddrhashtbl = hashinit(INADDR_NHASH, M_IFADDR, &V_in_ifaddrhmask);
 
@@ -362,6 +342,7 @@ ip_init(void)
 		NULL, EVENTHANDLER_PRI_ANY);
 
 	/* Initialize various other remaining things. */
+	V_ip_id = time_second & 0xffff;
 	IPQ_LOCK_INIT();
 	netisr_register(&ip_nh);
 }

Modified: head/sys/netinet6/ip6_input.c
==============================================================================
--- head/sys/netinet6/ip6_input.c	Mon Jul 20 11:17:54 2009	(r195781)
+++ head/sys/netinet6/ip6_input.c	Mon Jul 20 13:55:33 2009	(r195782)
@@ -162,26 +162,6 @@ static int ip6_hopopts_input(u_int32_t *
 static struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int);
 #endif
 
-#ifdef VIMAGE
-/* XXX only has to stay for .vmi_dependson elsewhere. */
-static void vnet_inet6_register(void);
- 
-static const vnet_modinfo_t vnet_inet6_modinfo = {
-	.vmi_id		= VNET_MOD_INET6,
-	.vmi_name	= "inet6",
-	.vmi_dependson	= VNET_MOD_INET	/* XXX revisit - TCP/UDP needs this? */
-};
- 
-static void
-vnet_inet6_register(void)
-{
-
-	vnet_mod_register(&vnet_inet6_modinfo);
-}
- 
-SYSINIT(inet6, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, vnet_inet6_register, 0);
-#endif
-
 /*
  * IP6 initialization: fill in IP6 protocol switch table.
  * All protocols not implemented in kernel go to raw IP6 protocol handler.

Modified: head/sys/netinet6/mld6.c
==============================================================================
--- head/sys/netinet6/mld6.c	Mon Jul 20 11:17:54 2009	(r195781)
+++ head/sys/netinet6/mld6.c	Mon Jul 20 13:55:33 2009	(r195782)
@@ -3253,7 +3253,6 @@ vnet_mld_idetach(const void *unused __un
 static vnet_modinfo_t vnet_mld_modinfo = {
 	.vmi_id		= VNET_MOD_MLD,
 	.vmi_name	= "mld",
-	.vmi_dependson	= VNET_MOD_INET6,
 	.vmi_iattach	= vnet_mld_iattach,
 	.vmi_idetach	= vnet_mld_idetach
 };

Modified: head/sys/netipsec/ipsec.c
==============================================================================
--- head/sys/netipsec/ipsec.c	Mon Jul 20 11:17:54 2009	(r195781)
+++ head/sys/netipsec/ipsec.c	Mon Jul 20 13:55:33 2009	(r195782)
@@ -245,7 +245,6 @@ static int ipsec_iattach(const void *);
 static const vnet_modinfo_t vnet_ipsec_modinfo = {
 	.vmi_id		= VNET_MOD_IPSEC,
 	.vmi_name	= "ipsec",
-	.vmi_dependson	= VNET_MOD_INET,	/* XXX revisit - INET6 ? */
 	.vmi_iattach	= ipsec_iattach,
 };
 #endif

Modified: head/sys/netipsec/xform_ipcomp.c
==============================================================================
--- head/sys/netipsec/xform_ipcomp.c	Mon Jul 20 11:17:54 2009	(r195781)
+++ head/sys/netipsec/xform_ipcomp.c	Mon Jul 20 13:55:33 2009	(r195782)
@@ -81,14 +81,6 @@ SYSCTL_VNET_STRUCT(_net_inet_ipcomp, IPS
 static int ipcomp_input_cb(struct cryptop *crp);
 static int ipcomp_output_cb(struct cryptop *crp);
 
-#ifdef VIMAGE
-static const vnet_modinfo_t vnet_ipcomp_modinfo = {
-	.vmi_id		= VNET_MOD_IPCOMP,
-	.vmi_name	= "ipsec_ipcomp",
-	.vmi_dependson	= VNET_MOD_IPSEC,
-};
-#endif
-
 struct comp_algo *
 ipcomp_algorithm_lookup(int alg)
 {
@@ -604,9 +596,6 @@ ipcomp_attach(void)
 {
 
 	xform_register(&ipcomp_xformsw);
-#ifdef VIMAGE
-	vnet_mod_register(&vnet_ipcomp_modinfo);
-#endif
 }
 
 SYSINIT(ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ipcomp_attach, NULL);

Modified: head/sys/netipsec/xform_ipip.c
==============================================================================
--- head/sys/netipsec/xform_ipip.c	Mon Jul 20 11:17:54 2009	(r195781)
+++ head/sys/netipsec/xform_ipip.c	Mon Jul 20 13:55:33 2009	(r195782)
@@ -105,14 +105,6 @@ SYSCTL_VNET_STRUCT(_net_inet_ipip, IPSEC
 
 static void _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp);
 
-#ifdef VIMAGE
-static const vnet_modinfo_t vnet_ipip_modinfo = {
-	.vmi_id		= VNET_MOD_IPIP,
-	.vmi_name	= "ipsec_ipip",
-	.vmi_dependson	= VNET_MOD_IPSEC,
-};
-#endif
-
 #ifdef INET6
 /*
  * Really only a wrapper for ipip_input(), for use with IPv6.
@@ -710,9 +702,6 @@ ipe4_attach(void)
 	(void) encap_attach_func(AF_INET6, -1,
 		ipe4_encapcheck, (struct protosw *)&ipe6_protosw, NULL);
 #endif
-#ifdef VIMAGE
-	vnet_mod_register(&vnet_ipip_modinfo);
-#endif
 }
 SYSINIT(ipe4_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ipe4_attach, NULL);
 #endif	/* IPSEC */


More information about the svn-src-all mailing list