On 12/04/13(Fri) 12:26, Martin Pieuchot wrote:
> Simple diff to move all the redundant extern declaration into their
> corresponding header.
I just realized that this diff is missing the sys/ part, here's the
full diff, everything goes under #ifdef _KERNEL anyway. ok?
Index: netinet/in_proto.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/in_proto.c,v
retrieving revision 1.58
diff -u -p -r1.58 in_proto.c
--- netinet/in_proto.c 17 Jan 2013 16:30:10 -0000 1.58
+++ netinet/in_proto.c 15 Apr 2013 09:55:41 -0000
@@ -176,7 +176,7 @@
#include <netinet/ip_divert.h>
#endif
-extern struct domain inetdomain;
+u_char ip_protox[IPPROTO_MAX];
struct protosw inetsw[] = {
{ 0, &inetdomain, 0, 0,
Index: netinet/ip_icmp.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_icmp.c,v
retrieving revision 1.97
diff -u -p -r1.97 ip_icmp.c
--- netinet/ip_icmp.c 10 Apr 2013 08:50:59 -0000 1.97
+++ netinet/ip_icmp.c 15 Apr 2013 09:55:41 -0000
@@ -125,11 +125,6 @@ void icmp_mtudisc_timeout(struct rtentry
int icmp_ratelimit(const struct in_addr *, const int, const int);
void icmp_redirect_timeout(struct rtentry *, struct rttimer *);
-/* from ip_input.c */
-extern u_char ip_protox[];
-
-extern struct protosw inetsw[];
-
void
icmp_init(void)
{
Index: netinet/ip_input.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.208
diff -u -p -r1.208 ip_input.c
--- netinet/ip_input.c 10 Apr 2013 08:50:59 -0000 1.208
+++ netinet/ip_input.c 15 Apr 2013 09:55:41 -0000
@@ -121,9 +121,6 @@ extern struct baddynamicports baddynamic
int *ipctl_vars[IPCTL_MAXID] = IPCTL_VARS;
-extern struct domain inetdomain;
-extern struct protosw inetsw[];
-u_char ip_protox[IPPROTO_MAX];
struct in_ifaddrhead in_ifaddr;
struct ifqueue ipintrq;
Index: netinet/ipsec_input.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ipsec_input.c,v
retrieving revision 1.113
diff -u -p -r1.113 ipsec_input.c
--- netinet/ipsec_input.c 11 Apr 2013 12:06:25 -0000 1.113
+++ netinet/ipsec_input.c 15 Apr 2013 09:55:41 -0000
@@ -110,11 +110,6 @@ int *espctl_vars[ESPCTL_MAXID] = ESPCTL_
int *ahctl_vars[AHCTL_MAXID] = AHCTL_VARS;
int *ipcompctl_vars[IPCOMPCTL_MAXID] = IPCOMPCTL_VARS;
-#ifdef INET6
-extern struct ip6protosw inet6sw[];
-extern u_char ip6_protox[];
-#endif
-
/*
* ipsec_common_input() gets called when we receive an IPsec-protected packet
* in IPv4 or IPv6. All it does is find the right TDB and call the appropriate
Index: netinet6/icmp6.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet6/icmp6.c,v
retrieving revision 1.125
diff -u -p -r1.125 icmp6.c
--- netinet6/icmp6.c 10 Apr 2013 01:35:55 -0000 1.125
+++ netinet6/icmp6.c 15 Apr 2013 09:55:41 -0000
@@ -129,10 +129,6 @@
*/
#define in6p_ip6_nxt inp_ipv6.ip6_nxt
-extern struct domain inet6domain;
-extern struct ip6protosw inet6sw[];
-extern u_char ip6_protox[];
-
struct icmp6stat icmp6stat;
extern struct inpcbtable rawin6pcbtable;
Index: netinet6/in6_proto.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet6/in6_proto.c,v
retrieving revision 1.66
diff -u -p -r1.66 in6_proto.c
--- netinet6/in6_proto.c 1 Apr 2013 22:58:29 -0000 1.66
+++ netinet6/in6_proto.c 15 Apr 2013 09:55:41 -0000
@@ -122,8 +122,7 @@
/*
* TCP/IP protocol family: IP6, ICMP6, UDP, TCP.
*/
-
-extern struct domain inet6domain;
+u_char ip6_protox[IPPROTO_MAX];
struct ip6protosw inet6sw[] = {
{ 0, &inet6domain, IPPROTO_IPV6, 0,
Index: netinet6/ip6_input.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet6/ip6_input.c,v
retrieving revision 1.111
diff -u -p -r1.111 ip6_input.c
--- netinet6/ip6_input.c 28 Mar 2013 23:10:06 -0000 1.111
+++ netinet6/ip6_input.c 15 Apr 2013 09:55:41 -0000
@@ -117,10 +117,6 @@
#include <netinet/ip_carp.h>
#endif
-extern struct domain inet6domain;
-extern struct ip6protosw inet6sw[];
-
-u_char ip6_protox[IPPROTO_MAX];
struct in6_ifaddrhead in6_ifaddr;
struct ifqueue ip6intrq;
Index: netinet6/ip6protosw.h
===================================================================
RCS file: /home/ncvs/src/sys/netinet6/ip6protosw.h,v
retrieving revision 1.7
diff -u -p -r1.7 ip6protosw.h
--- netinet6/ip6protosw.h 2 Jun 2003 23:28:16 -0000 1.7
+++ netinet6/ip6protosw.h 15 Apr 2013 09:55:41 -0000
@@ -142,4 +142,9 @@ struct ip6protosw {
int (*pr_sysctl)(int *, u_int, void *, size_t *, void *, size_t);
};
+#ifdef _KERNEL
+extern u_char ip6_protox[];
+extern struct ip6protosw inet6sw[];
+#endif
+
#endif /* !_NETINET6_IP6PROTOSW_H_ */
Index: sys/domain.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/domain.h,v
retrieving revision 1.10
diff -u -p -r1.10 domain.h
--- sys/domain.h 15 Sep 2012 00:47:08 -0000 1.10
+++ sys/domain.h 15 Apr 2013 09:55:41 -0000
@@ -69,4 +69,13 @@ struct domain {
#ifdef _KERNEL
extern struct domain *domains;
void domaininit(void);
+
+#ifdef INET
+extern struct domain inetdomain;
#endif
+
+#ifdef INET6
+extern struct domain inet6domain;
+#endif
+
+#endif /* _KERNEL */
Index: sys/protosw.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/protosw.h,v
retrieving revision 1.17
diff -u -p -r1.17 protosw.h
--- sys/protosw.h 4 Jul 2011 16:02:07 -0000 1.17
+++ sys/protosw.h 15 Apr 2013 09:55:41 -0000
@@ -230,4 +230,7 @@ struct sockaddr;
struct protosw *pffindproto(int, int, int);
struct protosw *pffindtype(int, int);
void pfctlinput(int, struct sockaddr *);
+
+extern u_char ip_protox[];
+extern struct protosw inetsw[];
#endif