ck: simplify interface with libkvm consumers by defining ck_queue types

as their queue.h equivalents if !_KERNEL
This commit is contained in:
Matt Macy 2018-05-21 01:53:23 +00:00
parent 986a5bafb1
commit fd04260d3f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=333957
2 changed files with 17 additions and 9 deletions

View File

@ -76,10 +76,10 @@ struct netdump_methods;
#include <sys/mbuf.h> /* ifqueue only? */
#include <sys/buf_ring.h>
#include <net/vnet.h>
#include <ck_queue.h>
#include <sys/epoch.h>
#endif /* _KERNEL */
#include <sys/ck.h>
#include <sys/counter.h>
#include <sys/epoch.h>
#include <sys/lock.h> /* XXX */
#include <sys/mutex.h> /* struct ifqueue */
#include <sys/rwlock.h> /* XXX */
@ -90,13 +90,8 @@ struct netdump_methods;
#include <net/altq/if_altq.h>
TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */
#ifdef _KERNEL
CK_STAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */
CK_STAILQ_HEAD(ifmultihead, ifmultiaddr);
#else
STAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */
STAILQ_HEAD(ifmultihead, ifmultiaddr);
#endif
TAILQ_HEAD(ifgrouphead, ifg_group);
#ifdef _KERNEL
@ -522,7 +517,7 @@ struct ifaddr {
struct sockaddr *ifa_netmask; /* used to determine subnet */
struct ifnet *ifa_ifp; /* back-pointer to interface */
struct carp_softc *ifa_carp; /* pointer to CARP data */
STAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */
CK_STAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */
void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */
(int, struct rtentry *, struct rt_addrinfo *);
u_short ifa_flags; /* mostly rt_flags for cloning */
@ -546,7 +541,7 @@ void ifa_ref(struct ifaddr *ifa);
* structure except that it keeps track of multicast addresses.
*/
struct ifmultiaddr {
STAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */
CK_STAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */
struct sockaddr *ifma_addr; /* address this membership is for */
struct sockaddr *ifma_lladdr; /* link-layer translation, if any */
struct ifnet *ifma_ifp; /* back-pointer to interface */

13
sys/sys/ck.h Normal file
View File

@ -0,0 +1,13 @@
/*
* $FreeBSD$
*/
#ifdef _KERNEL
#include <ck_queue.h>
#include <ck_epoch.h>
#else
#include <sys/queue.h>
#define CK_STAILQ_HEAD STAILQ_HEAD
#define CK_STAILQ_ENTRY STAILQ_ENTRY
#define CK_LIST_HEAD LIST_HEAD
#define CK_LIST_ENTRY LIST_ENTRY
#endif