svn commit: r187492 - user/sam/wifi/sys/net80211

Sam Leffler sam at FreeBSD.org
Tue Jan 20 14:04:35 PST 2009


Author: sam
Date: Tue Jan 20 22:04:30 2009
New Revision: 187492
URL: http://svn.freebsd.org/changeset/base/187492

Log:
  Change ic_getradiocaps driver callback to include the max # channels
  so callers know the size of the array passed down (previously this
  was fixed to be IEEE80211_CHAN_MAX).

Modified:
  user/sam/wifi/sys/net80211/ieee80211_regdomain.c
  user/sam/wifi/sys/net80211/ieee80211_var.h

Modified: user/sam/wifi/sys/net80211/ieee80211_regdomain.c
==============================================================================
--- user/sam/wifi/sys/net80211/ieee80211_regdomain.c	Tue Jan 20 22:01:08 2009	(r187491)
+++ user/sam/wifi/sys/net80211/ieee80211_regdomain.c	Tue Jan 20 22:04:30 2009	(r187492)
@@ -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
@@ -69,7 +71,7 @@ ieee80211_regdomain_attach(struct ieee80
 		ic->ic_regdomain.location = ' ';		/* both */
 		ic->ic_regdomain.isocc[0] = 'U';		/* XXX */
 		ic->ic_regdomain.isocc[1] = 'S';		/* XXX */
-		/* XXX? too late to setup default channel list */
+		/* NB: driver calls ieee80211_init_channels or similar */
 	}
 	ic->ic_getradiocaps = null_getradiocaps;
 	ic->ic_setregdomain = null_setregdomain;

Modified: user/sam/wifi/sys/net80211/ieee80211_var.h
==============================================================================
--- user/sam/wifi/sys/net80211/ieee80211_var.h	Tue Jan 20 22:01:08 2009	(r187491)
+++ user/sam/wifi/sys/net80211/ieee80211_var.h	Tue Jan 20 22:04:30 2009	(r187492)
@@ -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-user mailing list