From 1afbcbacb38bccc3bac01ae24420658b4b8346c7 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 7 Jun 2011 19:09:32 -0700 Subject: [PATCH] world - Fix buildworld after ifnet changes * Use the _KERNEL_STRUCTURES mechanic to conditionalize struct ifnet and related structures needed by buildworld. Reported-by: matthiasr --- sys/net/if_var.h | 6 ++++++ sys/net/pf/if_pflog.h | 4 ++++ sys/net/sl/if_slvar.h | 5 ++++- sys/netinet6/ip6_mroute.h | 4 ++-- usr.bin/netstat/if.c | 1 + usr.bin/netstat/mroute6.c | 3 +-- usr.sbin/slstat/slstat.c | 2 ++ 7 files changed, 20 insertions(+), 5 deletions(-) diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 5f63cd8736..114eb5f9dd 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -148,6 +148,8 @@ enum ifnet_serialize { #define IFNET_SERIALIZE_TX IFNET_SERIALIZE_TX_BASE #define IFNET_SERIALIZE_RX(i) (IFNET_SERIALIZE_RX_BASE + (i)) +#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES) + /* * Structure defining a network interface. * @@ -315,6 +317,7 @@ typedef void if_init_f_t (void *); /* for compatibility with other BSDs */ #define if_list if_link +#endif /* * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) @@ -326,6 +329,7 @@ typedef void if_init_f_t (void *); #define IF_DROP(ifq) ((ifq)->ifq_drops++) #define IF_QLEN(ifq) ((ifq)->ifq_len) #define IF_QEMPTY(ifq) (IF_QLEN(ifq) == 0) + #define IF_ENQUEUE(ifq, m) do { \ (m)->m_nextpkt = 0; \ if ((ifq)->ifq_tail == 0) \ @@ -335,6 +339,7 @@ typedef void if_init_f_t (void *); (ifq)->ifq_tail = m; \ (ifq)->ifq_len++; \ } while (0) + #define IF_PREPEND(ifq, m) do { \ (m)->m_nextpkt = (ifq)->ifq_head; \ if ((ifq)->ifq_tail == 0) \ @@ -342,6 +347,7 @@ typedef void if_init_f_t (void *); (ifq)->ifq_head = (m); \ (ifq)->ifq_len++; \ } while (0) + #define IF_DEQUEUE(ifq, m) do { \ (m) = (ifq)->ifq_head; \ if (m) { \ diff --git a/sys/net/pf/if_pflog.h b/sys/net/pf/if_pflog.h index c6557dd9bc..4870f3e0b8 100644 --- a/sys/net/pf/if_pflog.h +++ b/sys/net/pf/if_pflog.h @@ -31,12 +31,16 @@ #define PFLOGIFS_MAX 16 +#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES) + struct pflog_softc { struct ifnet sc_if; /* the interface */ int sc_unit; LIST_ENTRY(pflog_softc) sc_list; }; +#endif + #define PFLOG_RULESET_NAME_SIZE 16 struct pfloghdr { diff --git a/sys/net/sl/if_slvar.h b/sys/net/sl/if_slvar.h index 60b2ef8001..cb0363c5a7 100644 --- a/sys/net/sl/if_slvar.h +++ b/sys/net/sl/if_slvar.h @@ -41,6 +41,8 @@ #include +#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES) + /* * Definitions for SLIP interface data structures * @@ -70,6 +72,8 @@ struct sl_softc { struct slcompress sc_comp; /* tcp compression data */ }; +#endif + /* internal flags */ #define SC_ERROR 0x0001 /* had an input error */ #define SC_OUTWAIT 0x0002 /* waiting for output fill */ @@ -81,5 +85,4 @@ struct sl_softc { #define SC_NOICMP IFF_LINK1 /* suppress ICMP traffic */ #define SC_AUTOCOMP IFF_LINK2 /* auto-enable TCP compression */ - #endif diff --git a/sys/netinet6/ip6_mroute.h b/sys/netinet6/ip6_mroute.h index 64222ae1fa..73594d0525 100644 --- a/sys/netinet6/ip6_mroute.h +++ b/sys/netinet6/ip6_mroute.h @@ -64,7 +64,7 @@ /* * Multicast Routing set/getsockopt commands. */ -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES) #define MRT6_OINIT 100 /* initialize forwarder (omrt6msg) */ #endif #define MRT6_DONE 101 /* shut down forwarder */ @@ -216,7 +216,7 @@ struct sioc_mif_req6 { u_quad_t obytes; /* Output byte count on mif */ }; -#if defined(_KERNEL) || defined(KERNEL) +#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES) || defined(KERNEL) /* * The kernel's multicast-interface structure. */ diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index 4938c282a9..9390f5ac3c 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -35,6 +35,7 @@ * $DragonFly: src/usr.bin/netstat/if.c,v 1.12 2008/03/07 11:34:21 sephe Exp $ */ +#define _KERNEL_STRUCTURES #include #include #include diff --git a/usr.bin/netstat/mroute6.c b/usr.bin/netstat/mroute6.c index 4bd79f0cdc..5fb65d2c2c 100644 --- a/usr.bin/netstat/mroute6.c +++ b/usr.bin/netstat/mroute6.c @@ -68,6 +68,7 @@ * $DragonFly: src/usr.bin/netstat/mroute6.c,v 1.3 2005/08/04 17:31:23 drhodus Exp $ */ +#define _KERNEL_STRUCTURES #ifdef INET6 #include #include @@ -83,9 +84,7 @@ #include -#define KERNEL 1 #include -#undef KERNEL #include "netstat.h" diff --git a/usr.sbin/slstat/slstat.c b/usr.sbin/slstat/slstat.c index cfb3a50360..28d108b371 100644 --- a/usr.sbin/slstat/slstat.c +++ b/usr.sbin/slstat/slstat.c @@ -24,6 +24,7 @@ * $DragonFly: src/usr.sbin/slstat/slstat.c,v 1.5 2004/03/20 17:46:48 cpressey Exp $ */ +#define _KERNEL_STRUCTURES #include #include #include @@ -54,6 +55,7 @@ static void intpr(void); static void catchalarm(int); #define INTERFACE_PREFIX "sl%d" + char interface[IFNAMSIZ]; int rflag; -- 2.41.0