- 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.
This commit is contained in:
glebius 2013-10-28 08:03:40 +00:00
parent 9c54cb7e8e
commit c829949efa
2 changed files with 10 additions and 32 deletions

View File

@ -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_ */

View File

@ -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); /* if_multiaddrs */
} 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_event, ifnet_departure_event_handler_t);
/* 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_detach_event_handler_t);
/* 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")