Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net80211 Make if_printf more nearly match FreeBSD's, and...



details:   https://anonhg.NetBSD.org/src/rev/5fee601c3045
branches:  trunk
changeset: 552335:5fee601c3045
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Tue Sep 23 15:57:25 2003 +0000

description:
Make if_printf more nearly match FreeBSD's, and make it compile.
Remove ieee80211_node_{dec,inc}ref (they go to ieee80211_node.h).

diffstat:

 sys/net80211/ieee80211_compat.c |  19 +++++++++--------
 sys/net80211/ieee80211_compat.h |  42 +++++++---------------------------------
 2 files changed, 18 insertions(+), 43 deletions(-)

diffs (104 lines):

diff -r 0db5b59cd130 -r 5fee601c3045 sys/net80211/ieee80211_compat.c
--- a/sys/net80211/ieee80211_compat.c   Tue Sep 23 15:30:22 2003 +0000
+++ b/sys/net80211/ieee80211_compat.c   Tue Sep 23 15:57:25 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ieee80211_compat.c,v 1.2 2003/09/14 01:14:54 dyoung Exp $      */
+/*     $NetBSD: ieee80211_compat.c,v 1.3 2003/09/23 15:57:25 dyoung Exp $      */
 /*-
  * Copyright (c) 2003, 2004 David Young
  * All rights reserved.
@@ -27,20 +27,21 @@
  */
 #include <net/if.h>
 #include <sys/systm.h>
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_compat.c,v 1.2 2003/09/14 01:14:54 dyoung Exp $");
+#include <machine/stdarg.h>
+#include <net80211/ieee80211_compat.h>
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_compat.c,v 1.3 2003/09/23 15:57:25 dyoung Exp $");
 
 #ifdef __NetBSD__
-int
+void
 if_printf(struct ifnet *ifp, const char *fmt, ...)
 {
-       int rc;
        va_list ap;
-
        va_start(ap, fmt);
-       if (printf("%s: ", ifp->if_xname) == -1)
-               return -1;
-       rc = vprintf(fmt, ap);
+
+       printf("%s: ", ifp->if_xname);
+       vprintf(fmt, ap);
+
        va_end(ap);
-       return rc;
+       return;
 }
 #endif /* __NetBSD__ */
diff -r 0db5b59cd130 -r 5fee601c3045 sys/net80211/ieee80211_compat.h
--- a/sys/net80211/ieee80211_compat.h   Tue Sep 23 15:30:22 2003 +0000
+++ b/sys/net80211/ieee80211_compat.h   Tue Sep 23 15:57:25 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ieee80211_compat.h,v 1.2 2003/09/14 01:14:54 dyoung Exp $      */
+/*     $NetBSD: ieee80211_compat.h,v 1.3 2003/09/23 15:57:25 dyoung Exp $      */
 /*-
  * Copyright (c) 2003, 2004 David Young
  * All rights reserved.
@@ -29,12 +29,17 @@
 #define _NET80211_IEEE80211_COMPAT_H_
 
 #ifdef __NetBSD__
-extern int if_printf(struct ifnet *ifp, const char *fmt, ...);
+#undef KASSERT
+#define KASSERT(cond, complaint) if (!(cond)) panic complaint
+#endif
+
+#ifdef __NetBSD__
+void if_printf(struct ifnet *, const char *, ...);
 #endif
 
 #ifdef __NetBSD__
 #define ieee80211_node_critsec_decl(v) int v
-#define ieee80211_node_critsec_begin(ic, v) do { v = splnet() } while (0)
+#define ieee80211_node_critsec_begin(ic, v) do { v = splnet(); } while (0)
 #define ieee80211_node_critsec_end(ic, v) splx(v)
 #else
 #define ieee80211_node_critsec_decl(v) /* empty */
@@ -42,35 +47,4 @@
 #define ieee80211_node_critsec_end(ic, v) mtx_unlock(&ic->ic_nodelock)
 #endif
 
-#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
-
 #endif /* _NET80211_IEEE80211_COMPAT_H_ */



Home | Main Index | Thread Index | Old Index