svn commit: r257244 - head/sys/net

Gleb Smirnoff glebius at FreeBSD.org
Mon Oct 28 08:03:41 UTC 2013


Author: glebius
Date: Mon Oct 28 08:03:40 2013
New Revision: 257244
URL: http://svnweb.freebsd.org/changeset/base/257244

Log:
  - Make the prophecy from 1997 happen and remove if_var.h inclusion
    from if.h.
  - Remove unnecessary includes and declarations from if.h
  - Remove unnecessary includes and declarations from if_var.h [1]
  - Mark some declarations that are about to be removed in near
    future with comments, explaning why this declaration is still
    necessary.
  - Protect eventhandler declarations with #ifdef SYS_EVENTHANDLER_H.
  
  Obtained from:	bdeBSD [1]
  Sponsored by:	Netflix
  Sponsored by:	Nginx, Inc.

Modified:
  head/sys/net/if.h
  head/sys/net/if_var.h

Modified: head/sys/net/if.h
==============================================================================
--- head/sys/net/if.h	Mon Oct 28 07:47:52 2013	(r257243)
+++ head/sys/net/if.h	Mon Oct 28 08:03:40 2013	(r257244)
@@ -35,10 +35,6 @@
 
 #include <sys/cdefs.h>
 
-#ifdef _KERNEL
-#include <sys/queue.h>
-#endif
-
 #if __BSD_VISIBLE
 /*
  * <net/if.h> does not depend on <sys/time.h> on most other systems.  This
@@ -49,8 +45,6 @@
 #include <sys/time.h>
 #include <sys/socket.h>
 #endif
-
-struct ifnet;
 #endif
 
 /*
@@ -537,10 +531,4 @@ struct if_nameindex	*if_nameindex(void);
 unsigned int		 if_nametoindex(const char *);
 __END_DECLS
 #endif
-
-#ifdef _KERNEL
-/* XXX - this should go away soon. */
-#include <net/if_var.h>
-#endif
-
 #endif /* !_NET_IF_H_ */

Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h	Mon Oct 28 07:47:52 2013	(r257243)
+++ head/sys/net/if_var.h	Mon Oct 28 08:03:40 2013	(r257244)
@@ -58,38 +58,26 @@
  * interfaces.  These routines live in the files if.c and route.c
  */
 
-#ifdef __STDC__
-/*
- * Forward structure declarations for function prototypes [sic].
- */
-struct	mbuf;
-struct	thread;
-struct	rtentry;
-struct	rt_addrinfo;
+struct	rtentry;		/* ifa_rtrequest */
+struct	rt_addrinfo;		/* ifa_rtrequest */
 struct	socket;
-struct	ether_header;
 struct	carp_if;
 struct	carp_softc;
 struct  ifvlantrunk;
-struct	route;
+struct	route;			/* if_output */
 struct	vnet;
-#endif
-
-#include <sys/queue.h>		/* get TAILQ macros */
 
 #ifdef _KERNEL
-#include <sys/mbuf.h>
-#include <sys/eventhandler.h>
+#include <sys/mbuf.h>		/* ifqueue only? */
 #include <sys/buf_ring.h>
 #include <net/vnet.h>
 #endif /* _KERNEL */
 #include <sys/counter.h>
 #include <sys/lock.h>		/* XXX */
-#include <sys/mutex.h>		/* XXX */
+#include <sys/mutex.h>		/* struct ifqueue */
 #include <sys/rwlock.h>		/* XXX */
 #include <sys/sx.h>		/* XXX */
-#include <sys/event.h>		/* XXX */
-#include <sys/_task.h>
+#include <sys/_task.h>		/* if_link_task */
 
 #define	IF_DUNIT_NONE	-1
 
@@ -220,8 +208,6 @@ struct ifnet {
 	void	*if_pspare[8];		/* 1 netmap, 7 TDB */
 };
 
-typedef void if_init_f_t(void *);
-
 /*
  * XXX These aliases are terribly dangerous because they could apply
  * to anything.
@@ -367,6 +353,7 @@ void	if_maddr_runlock(struct ifnet *ifp)
 } while(0)
 
 #ifdef _KERNEL
+#ifdef SYS_EVENTHANDLER_H
 /* interface link layer address change event */
 typedef void (*iflladdr_event_handler_t)(void *, struct ifnet *);
 EVENTHANDLER_DECLARE(iflladdr_event, iflladdr_event_handler_t);
@@ -382,6 +369,7 @@ EVENTHANDLER_DECLARE(ifnet_departure_eve
 /* Interface link state change event */
 typedef void (*ifnet_link_event_handler_t)(void *, struct ifnet *, int);
 EVENTHANDLER_DECLARE(ifnet_link_event, ifnet_link_event_handler_t);
+#endif /* SYS_EVENTHANDLER_H */
 
 /*
  * interface groups
@@ -404,6 +392,7 @@ struct ifg_list {
 	TAILQ_ENTRY(ifg_list)	 ifgl_next;
 };
 
+#ifdef SYS_EVENTHANDLER_H
 /* group attach event */
 typedef void (*group_attach_event_handler_t)(void *, struct ifg_group *);
 EVENTHANDLER_DECLARE(group_attach_event, group_attach_event_handler_t);
@@ -413,6 +402,7 @@ EVENTHANDLER_DECLARE(group_detach_event,
 /* group change event */
 typedef void (*group_change_event_handler_t)(void *, const char *);
 EVENTHANDLER_DECLARE(group_change_event, group_change_event_handler_t);
+#endif /* SYS_EVENTHANDLER_H */
 
 #define	IF_AFDATA_LOCK_INIT(ifp)	\
 	rw_init(&(ifp)->if_afdata_lock, "if_afdata")


More information about the svn-src-all mailing list