svn commit: r187800 - in head/sys: dev/ath net80211

Sam Leffler sam at FreeBSD.org
Tue Jan 27 15:19:38 PST 2009


Author: sam
Date: Tue Jan 27 23:19:36 2009
New Revision: 187800
URL: http://svn.freebsd.org/changeset/base/187800

Log:
  change ic_getradiocaps driver callback to include the max # channels
  so callers know the size of the array passed down

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_regdomain.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Tue Jan 27 23:09:55 2009	(r187799)
+++ head/sys/dev/ath/if_ath.c	Tue Jan 27 23:19:36 2009	(r187800)
@@ -205,7 +205,7 @@ static void	ath_newassoc(struct ieee8021
 static int	ath_setregdomain(struct ieee80211com *,
 		    struct ieee80211_regdomain *, int,
 		    struct ieee80211_channel []);
-static void	ath_getradiocaps(struct ieee80211com *, int *,
+static void	ath_getradiocaps(struct ieee80211com *, int, int *,
 		    struct ieee80211_channel []);
 static int	ath_getchannels(struct ath_softc *);
 static void	ath_led_event(struct ath_softc *, int);
@@ -6332,7 +6332,7 @@ ath_setregdomain(struct ieee80211com *ic
 
 static void
 ath_getradiocaps(struct ieee80211com *ic,
-	int *nchans, struct ieee80211_channel chans[])
+	int maxchans, int *nchans, struct ieee80211_channel chans[])
 {
 	struct ath_softc *sc = ic->ic_ifp->if_softc;
 	struct ath_hal *ah = sc->sc_ah;

Modified: head/sys/net80211/ieee80211_ioctl.c
==============================================================================
--- head/sys/net80211/ieee80211_ioctl.c	Tue Jan 27 23:09:55 2009	(r187799)
+++ head/sys/net80211/ieee80211_ioctl.c	Tue Jan 27 23:19:36 2009	(r187800)
@@ -708,7 +708,7 @@ ieee80211_ioctl_getdevcaps(struct ieee80
 	dc->dc_cryptocaps = ic->ic_cryptocaps;
 	dc->dc_htcaps = ic->ic_htcaps;
 	ci = &dc->dc_chaninfo;
-	ic->ic_getradiocaps(ic, &ci->ic_nchans, ci->ic_chans);
+	ic->ic_getradiocaps(ic, IEEE80211_CHAN_MAX, &ci->ic_nchans, ci->ic_chans);
 	ieee80211_sort_channels(ci->ic_chans, ci->ic_nchans);
 	error = copyout(dc, ireq->i_data, sizeof(*dc));
 	free(dc, M_TEMP);

Modified: head/sys/net80211/ieee80211_regdomain.c
==============================================================================
--- head/sys/net80211/ieee80211_regdomain.c	Tue Jan 27 23:09:55 2009	(r187799)
+++ head/sys/net80211/ieee80211_regdomain.c	Tue Jan 27 23:19:36 2009	(r187800)
@@ -44,12 +44,14 @@ __FBSDID("$FreeBSD$");
 #include <net80211/ieee80211_regdomain.h>
 
 static void
-null_getradiocaps(struct ieee80211com *ic, int *n, struct ieee80211_channel *c)
+null_getradiocaps(struct ieee80211com *ic, int maxchan,
+	int *n, struct ieee80211_channel *c)
 {
 	/* just feed back the current channel list */
-	*n = ic->ic_nchans;
-	memcpy(c, ic->ic_channels,
-	    ic->ic_nchans*sizeof(struct ieee80211_channel));
+	*n = ic->ic_nchans;		/* XXX return count copied? */
+	if (maxchan > ic->ic_nchans)
+		maxchan = ic->ic_nchans;
+	memcpy(c, ic->ic_channels, maxchan*sizeof(struct ieee80211_channel));
 }
 
 static int

Modified: head/sys/net80211/ieee80211_var.h
==============================================================================
--- head/sys/net80211/ieee80211_var.h	Tue Jan 27 23:09:55 2009	(r187799)
+++ head/sys/net80211/ieee80211_var.h	Tue Jan 27 23:19:36 2009	(r187800)
@@ -208,7 +208,7 @@ struct ieee80211com {
 	ieee80211vap_attach	ic_vattach[IEEE80211_OPMODE_MAX];
 	/* return hardware/radio capabilities */
 	void			(*ic_getradiocaps)(struct ieee80211com *,
-				    int *, struct ieee80211_channel []);
+				    int, int *, struct ieee80211_channel []);
 	/* check and/or prepare regdomain state change */
 	int			(*ic_setregdomain)(struct ieee80211com *,
 				    struct ieee80211_regdomain *,


More information about the svn-src-head mailing list