Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147923993
D50642.1784801749.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D50642.1784801749.diff
View Options
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -273,19 +273,6 @@
ic_printf(ic, "%s: need callback\n", __func__);
}
-int
-ic_printf(struct ieee80211com *ic, const char * fmt, ...)
-{
- va_list ap;
- int retval;
-
- retval = printf("%s: ", ic->ic_name);
- va_start(ap, fmt);
- retval += vprintf(fmt, ap);
- va_end(ap);
- return (retval);
-}
-
static LIST_HEAD(, ieee80211com) ic_head = LIST_HEAD_INITIALIZER(ic_head);
static struct mtx ic_list_mtx;
MTX_SYSINIT(ic_list, &ic_list_mtx, "ieee80211com list", MTX_DEF);
diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h
--- a/sys/net80211/ieee80211_freebsd.h
+++ b/sys/net80211/ieee80211_freebsd.h
@@ -549,6 +549,12 @@
void ieee80211_vap_ifp_set_running_state(struct ieee80211vap *, bool);
const uint8_t * ieee80211_vap_get_broadcast_address(struct ieee80211vap *);
+void net80211_printf(const char *fmt, ...) __printflike(1, 2);
+void net80211_vap_printf(const struct ieee80211vap *, const char *fmt, ...)
+ __printflike(2, 3);
+void net80211_ic_printf(const struct ieee80211com *, const char *fmt, ...)
+ __printflike(2, 3);
+
#endif /* _KERNEL */
/* XXX this stuff belongs elsewhere */
diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c
--- a/sys/net80211/ieee80211_freebsd.c
+++ b/sys/net80211/ieee80211_freebsd.c
@@ -42,6 +42,7 @@
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
+#include <sys/syslog.h>
#include <sys/socket.h>
@@ -58,6 +59,8 @@
#include <net/route.h>
#include <net/vnet.h>
+#include <machine/stdarg.h>
+
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_input.h>
@@ -275,8 +278,8 @@
ctx = (struct sysctl_ctx_list *) IEEE80211_MALLOC(sizeof(struct sysctl_ctx_list),
M_DEVBUF, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
if (ctx == NULL) {
- if_printf(ifp, "%s: cannot allocate sysctl context!\n",
- __func__);
+ net80211_vap_printf(vap,
+ "%s: cannot allocate sysctl context!\n", __func__);
return;
}
sysctl_ctx_init(ctx);
@@ -1326,6 +1329,51 @@
return (if_getbroadcastaddr(vap->iv_ifp));
}
+/**
+ * @brief net80211 printf() (not vap/ic related)
+ */
+void
+net80211_printf(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
+}
+
+/**
+ * @brief VAP specific printf()
+ */
+void
+net80211_vap_printf(const struct ieee80211vap *vap, const char *fmt, ...)
+{
+ char if_fmt[256];
+ va_list ap;
+
+ va_start(ap, fmt);
+ snprintf(if_fmt, sizeof(if_fmt), "%s: %s", if_name(vap->iv_ifp), fmt);
+ vlog(LOG_INFO, if_fmt, ap);
+ va_end(ap);
+}
+
+/**
+ * @brief ic specific printf()
+ */
+void
+net80211_ic_printf(const struct ieee80211com *ic, const char *fmt, ...)
+{
+ va_list ap;
+
+ /*
+ * TODO: do the vap_printf stuff above, use vlog(LOG_INFO, ...)
+ */
+ printf("%s: ", ic->ic_name);
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
+}
+
/*
* Module glue.
*
diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h
--- a/sys/net80211/ieee80211_var.h
+++ b/sys/net80211/ieee80211_var.h
@@ -765,7 +765,9 @@
#define IEEE80211_COM_REF_S 1
#define IEEE80211_COM_REF_MAX (IEEE80211_COM_REF >> IEEE80211_COM_REF_S)
-int ic_printf(struct ieee80211com *, const char *, ...) __printflike(2, 3);
+/* TODO: Transition macro */
+#define ic_printf net80211_ic_printf
+
void ieee80211_ifattach(struct ieee80211com *);
void ieee80211_ifdetach(struct ieee80211com *);
void ieee80211_set_software_ciphers(struct ieee80211com *,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 23, 10:15 AM (9 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29238133
Default Alt Text
D50642.1784801749.diff (3 KB)
Attached To
Mode
D50642: net80211: create ieee80211_vap_printf() / ieee80211_ic_printf() for printing
Attached
Detach File
Event Timeline
Log In to Comment