__VA_ARGS__izing IEEE80211_DPRINTF[2]()
From: Brian Fundakowski Feldman (green_at_FreeBSD.org)
Date: 11/05/03
- Previous message: Bruce Evans: "Re: newfs and mount vs. half-baked disks"
- Next in thread: Sam Leffler: "Re: __VA_ARGS__izing IEEE80211_DPRINTF[2]()"
- Reply: Sam Leffler: "Re: __VA_ARGS__izing IEEE80211_DPRINTF[2]()"
- Maybe reply: Brian F. Feldman: "Re: __VA_ARGS__izing IEEE80211_DPRINTF[2]()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: arch@FreeBSD.org Date: Wed, 05 Nov 2003 13:04:42 -0500
Would it be a problem to make the following change to src/sys/net80211 so
that the debug messages aren't totally useless for systems that have more
than one card (or confusing on systems that just have one)? Obviously, it
would also involve removing the extra parentheses in each of the callers as
well.
Old:
#define IEEE80211_DPRINTF(X) if (ieee80211_debug) printf X
#define IEEE80211_DPRINTF2(X) if (ieee80211_debug>1) printf X
New:
#define IEEE80211_DPRINTF(...) do { \
if (ieee80211_debug) \
if_printf(&ic->ic_ifp, __VA_ARGS__); \
while (0)
The only place this wouldn't work is ieee80211_decap(), so I'd change it to
add a local "ic" variable when compiled for debugging. There's an easy
fallback for non-C99 compilers, too; it just wouldn't print the interface:
static __inline void
IEEE80211_DPRINTF(const char *fmt, ...)
{
if (ieee80211_debug) {
va_list ap;
va_start(ap, fmt);
(void)vprintf(fmt, ap);
va_end(ap);
}
}
-- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\ _______________________________________________ freebsd-arch@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-arch To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
- Previous message: Bruce Evans: "Re: newfs and mount vs. half-baked disks"
- Next in thread: Sam Leffler: "Re: __VA_ARGS__izing IEEE80211_DPRINTF[2]()"
- Reply: Sam Leffler: "Re: __VA_ARGS__izing IEEE80211_DPRINTF[2]()"
- Maybe reply: Brian F. Feldman: "Re: __VA_ARGS__izing IEEE80211_DPRINTF[2]()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]