Re: svn commit: r361885 - head/sys/net80211

2020-06-09 Thread Mateusz Guzik
On 6/7/20, Adrian Chadd  wrote:
> Author: adrian
> Date: Sun Jun  7 04:57:48 2020
> New Revision: 361885
> URL: https://svnweb.freebsd.org/changeset/base/361885
>
> Log:
>   [net80211] Add a method to return the vap's ifname.
>
>   This removes the requirement to know what's in the ifp.
>
>   (If someone wants a quick clean-up task, it'd be nice to convert
> instances
>   of ifp dereferencing for if_xname over to this method.)
>
> Modified:
>   head/sys/net80211/ieee80211_freebsd.c
>   head/sys/net80211/ieee80211_freebsd.h
>
> Modified: head/sys/net80211/ieee80211_freebsd.c
> ==
> --- head/sys/net80211/ieee80211_freebsd.c Sun Jun  7 04:32:38
> 2020  (r361884)
> +++ head/sys/net80211/ieee80211_freebsd.c Sun Jun  7 04:57:48
> 2020  (r361885)
> @@ -1034,6 +1034,20 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp)
>  }
>
>  /*
> + * Fetch the VAP name.
> + *
> + * This returns a const char pointer suitable for debugging,
> + * but don't expect it to stick around for much longer.
> + */
> +const char *
> +ieee80211_get_vap_ifname(struct ieee80211vap *vap)
> +{
> + if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL))
> + return "(none)";
> + return vap->iv_ifp->if_xname;
> +}
> +

This gives me:

/usr/src/sys/net80211/ieee80211_freebsd.c:1045:45: warning: comparison
of array 'vap->iv_ifp->if_xname' equal to a null pointer is always
false [-Wtautological-pointer-compare]
if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL))

-- 
Mateusz Guzik 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361885 - head/sys/net80211

2020-06-06 Thread Adrian Chadd
Author: adrian
Date: Sun Jun  7 04:57:48 2020
New Revision: 361885
URL: https://svnweb.freebsd.org/changeset/base/361885

Log:
  [net80211] Add a method to return the vap's ifname.
  
  This removes the requirement to know what's in the ifp.
  
  (If someone wants a quick clean-up task, it'd be nice to convert instances
  of ifp dereferencing for if_xname over to this method.)

Modified:
  head/sys/net80211/ieee80211_freebsd.c
  head/sys/net80211/ieee80211_freebsd.h

Modified: head/sys/net80211/ieee80211_freebsd.c
==
--- head/sys/net80211/ieee80211_freebsd.c   Sun Jun  7 04:32:38 2020
(r361884)
+++ head/sys/net80211/ieee80211_freebsd.c   Sun Jun  7 04:57:48 2020
(r361885)
@@ -1034,6 +1034,20 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp)
 }
 
 /*
+ * Fetch the VAP name.
+ *
+ * This returns a const char pointer suitable for debugging,
+ * but don't expect it to stick around for much longer.
+ */
+const char *
+ieee80211_get_vap_ifname(struct ieee80211vap *vap)
+{
+   if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL))
+   return "(none)";
+   return vap->iv_ifp->if_xname;
+}
+
+/*
  * Module glue.
  *
  * NB: the module name is "wlan" for compatibility with NetBSD.

Modified: head/sys/net80211/ieee80211_freebsd.h
==
--- head/sys/net80211/ieee80211_freebsd.h   Sun Jun  7 04:32:38 2020
(r361884)
+++ head/sys/net80211/ieee80211_freebsd.h   Sun Jun  7 04:57:48 2020
(r361885)
@@ -245,6 +245,7 @@ voidieee80211_drain_ifq(struct ifqueue *);
 void   ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *);
 
 void   ieee80211_vap_destroy(struct ieee80211vap *);
+const char *   ieee80211_get_vap_ifname(struct ieee80211vap *);
 
 #defineIFNET_IS_UP_RUNNING(_ifp) \
(((_ifp)->if_flags & IFF_UP) && \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"