Make ieee80211_unref_node compile.
#ifdef __FreeBSD__ a lot of lines, and put the NetBSDisms into the #else half. Add ieee80211_node_{dec,inc}ref to ieee80211_node.h.
This commit is contained in:
parent
1c4de65baa
commit
608fc21500
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee80211_node.c,v 1.3 2003/09/14 01:14:55 dyoung Exp $ */
|
||||
/* $NetBSD: ieee80211_node.c,v 1.4 2003/09/23 15:59:09 dyoung Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
|
||||
@ -35,7 +35,7 @@
|
||||
#ifdef __FreeBSD__
|
||||
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.6 2003/08/19 22:17:03 sam Exp $");
|
||||
#else
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.3 2003/09/14 01:14:55 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.4 2003/09/23 15:59:09 dyoung Exp $");
|
||||
#endif
|
||||
|
||||
#include "opt_inet.h"
|
||||
@ -49,7 +49,9 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.3 2003/09/14 01:14:55 dyoung Ex
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/errno.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/bus.h>
|
||||
#endif
|
||||
#include <sys/proc.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
@ -63,16 +65,23 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.3 2003/09/14 01:14:55 dyoung Ex
|
||||
#include <net/if_arp.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <net/ethernet.h>
|
||||
#else
|
||||
#include <net/if_ether.h>
|
||||
#endif
|
||||
#include <net/if_llc.h>
|
||||
|
||||
#include <net80211/ieee80211_var.h>
|
||||
#include <net80211/ieee80211_compat.h>
|
||||
|
||||
#include <net/bpf.h>
|
||||
|
||||
#ifdef INET
|
||||
#include <netinet/in.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <netinet/if_ether.h>
|
||||
#else
|
||||
#include <net/if_ether.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static struct ieee80211_node *ieee80211_node_alloc(struct ieee80211com *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee80211_node.h,v 1.3 2003/09/14 01:14:55 dyoung Exp $ */
|
||||
/* $NetBSD: ieee80211_node.h,v 1.4 2003/09/23 15:59:09 dyoung Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
|
||||
@ -104,6 +104,37 @@ struct ieee80211_node {
|
||||
int ni_txrate; /* index to ni_rates[] */
|
||||
};
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#define ieee80211_node_incref(ni) \
|
||||
do { \
|
||||
int _s = splnet(); \
|
||||
(ni)->ni_refcnt++; \
|
||||
splx(_s); \
|
||||
} while (0)
|
||||
|
||||
static __inline int
|
||||
ieee80211_node_decref(struct ieee80211_node *ni)
|
||||
{
|
||||
int refcnt, s;
|
||||
s = splnet();
|
||||
refcnt = --ni->ni_refcnt;
|
||||
splx(s);
|
||||
return refcnt;
|
||||
}
|
||||
|
||||
#else
|
||||
#define ieee80211_node_incref(ni) atomic_add_int(&(ni)->ni_refcnt, 1)
|
||||
static __inline int
|
||||
ieee80211_node_decref(struct ieee80211_node *ni)
|
||||
{
|
||||
int orefcnt;
|
||||
do {
|
||||
orefcnt = ni->ni_refcnt;
|
||||
} while (atomic_cmpset_int(&ni->ni_refcnt, orefcnt, orefcnt - 1) == 0);
|
||||
return orefcnt - 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static __inline struct ieee80211_node *
|
||||
ieee80211_ref_node(struct ieee80211_node *ni)
|
||||
{
|
||||
@ -114,7 +145,7 @@ ieee80211_ref_node(struct ieee80211_node *ni)
|
||||
static __inline void
|
||||
ieee80211_unref_node(struct ieee80211_node **ni)
|
||||
{
|
||||
ieee80211_node_decref(ni);
|
||||
ieee80211_node_decref(*ni);
|
||||
*ni = NULL; /* guard against use */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user