From 1b193af6101e6c1d10c6e2c5486bd4bbb7252fc2 Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Sat, 13 Dec 2008 19:13:03 +0000 Subject: [PATCH] Second round of putting global variables, which were virtualized but formerly missed under VIMAGE_GLOBAL. Put the extern declarations of the virtualized globals under VIMAGE_GLOBAL as the globals themsevles are already. This will help by the time when we are going to remove the globals entirely. Sponsored by: The FreeBSD Foundation --- sys/contrib/pf/net/pf_if.c | 2 ++ sys/net/if_var.h | 4 +++- sys/netinet/icmp6.h | 2 ++ sys/netinet/icmp_var.h | 2 ++ sys/netinet/in_var.h | 13 ++++++++++--- sys/netinet/ip_fw.h | 2 +- sys/netinet/ip_fw2.c | 7 ++++--- sys/netinet/tcp_var.h | 4 ++++ sys/netinet6/in6_var.h | 3 ++- sys/netinet6/ip6_input.c | 6 ++---- sys/netinet6/ip6_var.h | 11 ++++++----- sys/netinet6/raw_ip6.h | 2 ++ sys/netipsec/ipip_var.h | 2 ++ 13 files changed, 42 insertions(+), 18 deletions(-) diff --git a/sys/contrib/pf/net/pf_if.c b/sys/contrib/pf/net/pf_if.c index 62dbbf22f7c0..1972edc4326f 100644 --- a/sys/contrib/pf/net/pf_if.c +++ b/sys/contrib/pf/net/pf_if.c @@ -115,8 +115,10 @@ void pfi_change_group_event(void * __unused, char *); void pfi_detach_group_event(void * __unused, struct ifg_group *); void pfi_ifaddr_event(void * __unused, struct ifnet *); +#ifdef VIMAGE_GLOBALS extern struct ifgrouphead ifg_head; #endif +#endif RB_PROTOTYPE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 07244885d307..62c2b99f0c38 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -659,10 +659,12 @@ struct ifnet *ifnet_byindex(u_short idx); struct ifaddr *ifaddr_byindex(u_short idx); struct cdev *ifdev_byindex(u_short idx); +#ifdef VIMAGE_GLOBALS extern struct ifnethead ifnet; -extern int ifqmaxlen; extern struct ifnet *loif; /* first loopback interface */ extern int if_index; +#endif +extern int ifqmaxlen; int if_addgroup(struct ifnet *, const char *); int if_delgroup(struct ifnet *, const char *); diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h index 91b1658ad0f8..fcdc9ceb5e46 100644 --- a/sys/netinet/icmp6.h +++ b/sys/netinet/icmp6.h @@ -707,8 +707,10 @@ do { \ } \ } while (/*CONSTCOND*/ 0) +#ifdef VIMAGE_GLOBALS extern int icmp6_rediraccept; /* accept/process redirects */ extern int icmp6_redirtimeout; /* cache time for redirect routes */ +#endif #define ICMP6_NODEINFO_FQDNOK 0x1 #define ICMP6_NODEINFO_NODEADDROK 0x2 diff --git a/sys/netinet/icmp_var.h b/sys/netinet/icmp_var.h index dda84f20c8d7..cd9ee008643a 100644 --- a/sys/netinet/icmp_var.h +++ b/sys/netinet/icmp_var.h @@ -74,7 +74,9 @@ struct icmpstat { #ifdef _KERNEL SYSCTL_DECL(_net_inet_icmp); +#ifdef VIMAGE_GLOBALS extern struct icmpstat icmpstat; /* icmp statistics */ +#endif extern int badport_bandlim(int); #define BANDLIM_UNLIMITED -1 #define BANDLIM_ICMP_UNREACH 0 diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h index 1190826fb795..7facfa8269d5 100644 --- a/sys/netinet/in_var.h +++ b/sys/netinet/in_var.h @@ -84,9 +84,13 @@ extern u_char inetctlerrmap[]; /* * Hash table for IP addresses. */ -extern LIST_HEAD(in_ifaddrhashhead, in_ifaddr) *in_ifaddrhashtbl; -extern TAILQ_HEAD(in_ifaddrhead, in_ifaddr) in_ifaddrhead; +TAILQ_HEAD(in_ifaddrhead, in_ifaddr); +LIST_HEAD(in_ifaddrhashhead, in_ifaddr); +#ifdef VIMAGE_GLOBALS +extern struct in_ifaddrhashhead *in_ifaddrhashtbl; +extern struct in_ifaddrhead in_ifaddrhead; extern u_long in_ifaddrhmask; /* mask for hash table */ +#endif #define INADDR_NHASH_LOG2 9 #define INADDR_NHASH (1 << INADDR_NHASH_LOG2) @@ -227,7 +231,10 @@ SYSCTL_DECL(_net_inet_ip); SYSCTL_DECL(_net_inet_raw); #endif -extern LIST_HEAD(in_multihead, in_multi) in_multihead; +LIST_HEAD(in_multihead, in_multi); +#ifdef VIMAGE_GLOBALS +extern struct in_multihead in_multihead; +#endif /* * Lock macros for IPv4 layer multicast address lists. IPv4 lock goes diff --git a/sys/netinet/ip_fw.h b/sys/netinet/ip_fw.h index 6e7db9900269..831686dd01b7 100644 --- a/sys/netinet/ip_fw.h +++ b/sys/netinet/ip_fw.h @@ -637,7 +637,7 @@ void ipfw_nat_destroy(void); typedef int ip_fw_ctl_t(struct sockopt *); extern ip_fw_ctl_t *ip_fw_ctl_ptr; -#ifndef VIMAGE +#ifdef VIMAGE_GLOBALS extern int fw_one_pass; extern int fw_enable; #ifdef INET6 diff --git a/sys/netinet/ip_fw2.c b/sys/netinet/ip_fw2.c index 5c3ac591e335..826be2bdcfb2 100644 --- a/sys/netinet/ip_fw2.c +++ b/sys/netinet/ip_fw2.c @@ -128,8 +128,8 @@ struct vnet_ipfw vnet_ipfw_0; static u_int32_t set_disable; static int fw_verbose; static struct callout ipfw_timeout; -#endif static int verbose_limit; +#endif static uma_zone_t ipfw_dyn_rule_zone; @@ -190,8 +190,9 @@ SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, debug, CTLFLAG_RW, SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, verbose, CTLFLAG_RW | CTLFLAG_SECURE3, fw_verbose, 0, "Log matches to ipfw rules"); -SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, verbose_limit, CTLFLAG_RW, - &verbose_limit, 0, "Set upper limit of matches of ipfw rules logged"); +SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, verbose_limit, + CTLFLAG_RW, verbose_limit, 0, + "Set upper limit of matches of ipfw rules logged"); SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, default_rule, CTLFLAG_RD, NULL, IPFW_DEFAULT_RULE, "The default/max possible rule number."); SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, tables_max, CTLFLAG_RD, diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index ed872b92bd6e..a4392cb989b6 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -38,7 +38,9 @@ /* * Kernel variables for tcp. */ +#ifdef VIMAGE_GLOBALS extern int tcp_do_rfc1323; +#endif /* TCP segment queue entry */ struct tseg_qent { @@ -48,7 +50,9 @@ struct tseg_qent { struct mbuf *tqe_m; /* mbuf contains packet */ }; LIST_HEAD(tsegqe_head, tseg_qent); +#ifdef VIMAGE_GLOBALS extern int tcp_reass_qsize; +#endif extern struct uma_zone *tcp_reass_zone; struct sackblk { diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index e906d7c61981..957155a3777f 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -474,6 +474,8 @@ struct in6_rrenumreq { extern struct in6_ifaddr *in6_ifaddr; extern struct icmp6stat icmp6stat; + +extern unsigned long in6_maxmtu; #endif /* VIMAGE_GLOBALS */ #define in6_ifstat_inc(ifp, tag) \ do { \ @@ -483,7 +485,6 @@ do { \ extern struct in6_addr zeroin6_addr; extern u_char inet6ctlerrmap[]; -extern unsigned long in6_maxmtu; #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_IP6MADDR); #endif /* MALLOC_DECLARE */ diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 7edcaa396120..0c259e3e06e0 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -130,7 +130,6 @@ struct vnet_inet6 vnet_inet6_0; static int ip6qmaxlen; struct in6_ifaddr *in6_ifaddr; struct ip6stat ip6stat; -#endif extern struct callout in6_tmpaddrtimer_ch; @@ -144,7 +143,8 @@ extern int icmp6_nodeinfo; extern int udp6_sendspace; extern int udp6_recvspace; -#ifdef VIMAGE_GLOBALS +extern struct route_in6 ip6_forward_rt; + int ip6_forward_srcrt; /* XXX */ int ip6_sourcecheck; /* XXX */ int ip6_sourcecheck_interval; /* XXX */ @@ -301,8 +301,6 @@ ip6_init2(void *dummy) /* This must be after route_init(), which is now SI_ORDER_THIRD */ SYSINIT(netinet6init2, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ip6_init2, NULL); -extern struct route_in6 ip6_forward_rt; - void ip6_input(struct mbuf *m) { diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index e384da11bb55..5975cc93d5d6 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -313,16 +313,17 @@ extern int ip6_auto_linklocal; extern int ip6_use_tempaddr; /* whether to use temporary addresses. */ extern int ip6_prefer_tempaddr; /* whether to prefer temporary addresses in the source address selection */ -#endif /* VIMAGE_GLOBALS */ -extern int ip6_use_defzone; /* whether to use the default scope zone - when unspecified */ - -extern struct pfil_head inet6_pfil_hook; /* packet filter hooks */ #ifdef IPSTEALTH extern int ip6stealth; #endif +extern int ip6_use_defzone; /* whether to use the default scope zone + when unspecified */ +#endif /* VIMAGE_GLOBALS */ + +extern struct pfil_head inet6_pfil_hook; /* packet filter hooks */ + extern struct pr_usrreqs rip6_usrreqs; struct sockopt; diff --git a/sys/netinet6/raw_ip6.h b/sys/netinet6/raw_ip6.h index 9ebd823cad23..a57253e6623d 100644 --- a/sys/netinet6/raw_ip6.h +++ b/sys/netinet6/raw_ip6.h @@ -48,7 +48,9 @@ struct rip6stat { }; #ifdef _KERNEL +#ifdef VIMAGE_GLOBALS extern struct rip6stat rip6stat; #endif +#endif #endif diff --git a/sys/netipsec/ipip_var.h b/sys/netipsec/ipip_var.h index 7fbc64315f93..3d4ee15ff2f1 100644 --- a/sys/netipsec/ipip_var.h +++ b/sys/netipsec/ipip_var.h @@ -60,6 +60,8 @@ struct ipipstat #ifdef _KERNEL extern int ipip_allow; +#ifdef VIMAGE_GLOBALS extern struct ipipstat ipipstat; +#endif #endif /* _KERNEL */ #endif /* _NETINET_IPIP_H_ */