[PATCH] libertas: fix wlanconfig

Arnd Bergmann arnd at arndb.de
Wed Jul 5 16:21:37 EDT 2006


Some of the cleanups broke the shared header files for use by
user space wlanconfig. This does enough to get it to compile
without warnings again.

Signed-off-by: Arnd Bergmann <arnd at arndb.de>

Index: linus-2.6/drivers/net/wireless/libertas/wlan_11d.h
===================================================================
--- linus-2.6.orig/drivers/net/wireless/libertas/wlan_11d.h
+++ linus-2.6/drivers/net/wireless/libertas/wlan_11d.h
@@ -27,8 +27,10 @@ Change log:
 #ifndef _WLAN_11D_
 #define _WLAN_11D_
 
+#ifdef __KERNEL__
 #include "wlan_types.h"
 #include "wlan_defs.h"
+#endif
 
 #define MAX_CHAN_NUM				255
 
@@ -132,6 +134,7 @@ int wlan_parse_domain_info_11d(struct IE
 				*parsed_region_chan);
 #endif
 
+#ifdef __KERNEL__
 u8 libertas_get_scan_type_11d(u8 chan,
 			  struct parsed_region_chan_11d *parsed_region_chan);
 
@@ -157,4 +160,6 @@ int libertas_parse_dnld_countryinfo_11d(
 
 int libertas_create_dnld_countryinfo_11d(wlan_private * priv);
 
+#endif
+
 #endif				/* _WLAN_11D_ */
Index: linus-2.6/drivers/net/wireless/libertas/wlan_defs.h
===================================================================
--- linus-2.6.orig/drivers/net/wireless/libertas/wlan_defs.h
+++ linus-2.6/drivers/net/wireless/libertas/wlan_defs.h
@@ -370,6 +370,7 @@ static inline void HEXDUMP(char *prompt,
 #define wlan_cpu_to_le32(x) x
 #define wlan_cpu_to_le64(x) x
 
+#ifdef __KERNEL__
 /** Global Varibale Declaration */
 typedef struct _wlan_private wlan_private;
 typedef struct _wlan_adapter wlan_adapter;
@@ -385,6 +386,7 @@ extern u8 libertas_supported_rates[G_SUP
 extern u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES];
 
 extern u8 libertas_adhoc_rates_b[4];
+#endif
 
 /** ENUM definition*/
 /** SNRNF_TYPE */
Index: linus-2.6/drivers/net/wireless/libertas/wlan_scan.h
===================================================================
--- linus-2.6.orig/drivers/net/wireless/libertas/wlan_scan.h
+++ linus-2.6/drivers/net/wireless/libertas/wlan_scan.h
@@ -236,6 +236,7 @@ struct wlan_ioctl_get_scan_table_info {
 
 } __attribute__ ((packed));
 
+#ifdef __KERNEL__
 /**
  *  @brief Structure used to store information for each beacon/probe response
  */
@@ -306,7 +307,6 @@ extern int libertas_ret_80211_scan(wlan_
 struct ifreq;
 extern int libertas_extscan_ioctl(wlan_private * priv, struct ifreq *req);
 
-#ifdef __KERNEL__
 struct iw_point;
 struct iw_param;
 struct iw_request_info;
Index: linus-2.6/drivers/net/wireless/libertas/wlan_types.h
===================================================================
--- linus-2.6.orig/drivers/net/wireless/libertas/wlan_types.h
+++ linus-2.6/drivers/net/wireless/libertas/wlan_types.h
@@ -31,7 +31,9 @@ Change log:
 #ifndef _WLAN_TYPES_
 #define _WLAN_TYPES_
 
+#ifdef __KERNEL__
 #include <linux/if_ether.h>
+#endif
 
 /** IEEE Type definitions  */
 enum IEEEtypes_ElementId {
@@ -305,7 +307,7 @@ struct MrvlIEtypes_FailureCount {
 } __attribute__ ((packed));
 
 /** MrvlIEtypes_BeaconsMissed */
-struct _rvlIEtypes_BeaconsMissed {
+struct MrvlIEtypes_BeaconsMissed {
 	struct MrvlIEtypesHeader Header;
 	u8 BeaconMissed;
 	u8 Reserved;
Index: linus-2.6/drivers/net/wireless/libertas/wlanconfig/wlanconfig.c
===================================================================
--- linus-2.6.orig/drivers/net/wireless/libertas/wlanconfig/wlanconfig.c
+++ linus-2.6/drivers/net/wireless/libertas/wlanconfig/wlanconfig.c
@@ -577,7 +577,9 @@ static int wlan_get_hostcmd_data(FILE *f
 			}
 			*pos3 = '\0';
 			memset(buf, 0, len);
-			memmove(buf, pos2, min(strlen(pos2),len));
+			if (len > strlen(pos2))
+				len = strlen(pos2);
+			memmove(buf, pos2, len);
 			buf += len;
 		}
 		else if (*pos2 == '\'') {
@@ -704,53 +706,53 @@ static int process_host_cmd(int argc, ch
 				int len = S_DS_GEN + sizeof(struct HostCmd_DS_802_11_SUBSCRIBE_EVENT);
 				printf("\nEvent\t\tValue\tFreq\tsubscribed\n\n");
 				while (len < hostcmd->Size) {
-					MrvlIEtypesHeader_t *header = (MrvlIEtypesHeader_t *)(buf + len);
+					struct MrvlIEtypesHeader *header = (struct MrvlIEtypesHeader *)(buf + len);
 					switch (header->Type) {
 					case TLV_TYPE_RSSI_LOW:
 					{
-						MrvlIEtypes_RssiParamSet_t *LowRssi = (MrvlIEtypes_RssiParamSet_t *)(buf + len);
+						struct MrvlIEtypes_RssiThreshold *LowRssi = (struct MrvlIEtypes_RssiThreshold *)(buf + len);
 						printf("Low RSSI\t%d\t%d\t%s\n",LowRssi->RSSIValue,LowRssi->RSSIFreq,(se->Events & 0x0001)?"yes":"no");
-						len += sizeof(MrvlIEtypes_RssiParamSet_t);
+						len += sizeof(struct MrvlIEtypes_RssiThreshold);
 						break;
 					}
 					case TLV_TYPE_SNR_LOW:
 					{
-						MrvlIEtypes_SnrThreshold_t *LowSnr = (MrvlIEtypes_SnrThreshold_t *)(buf + len);
+						struct MrvlIEtypes_SnrThreshold *LowSnr = (struct MrvlIEtypes_SnrThreshold *)(buf + len);
 						printf("Low SNR\t\t%d\t%d\t%s\n",LowSnr->SNRValue,LowSnr->SNRFreq,(se->Events & 0x0002)?"yes":"no");
-						len += sizeof(MrvlIEtypes_SnrThreshold_t);
+						len += sizeof(struct MrvlIEtypes_SnrThreshold);
 						break;
 					}
 					case TLV_TYPE_FAILCOUNT:
 					{
-						MrvlIEtypes_FailureCount_t *FailureCount = (MrvlIEtypes_FailureCount_t *)(buf + len);
+						struct MrvlIEtypes_FailureCount *FailureCount = (struct MrvlIEtypes_FailureCount *)(buf + len);
 						printf("Failure Count\t%d\t%d\t%s\n",FailureCount->FailValue,FailureCount->FailFreq,(se->Events & 0x0004)?"yes":"no");
-						len += sizeof(MrvlIEtypes_FailureCount_t);
+						len += sizeof(struct MrvlIEtypes_FailureCount);
 						break;
 					}
 					case TLV_TYPE_BCNMISS:
 					{
-						MrvlIEtypes_BeaconsMissed_t *BcnMissed = (MrvlIEtypes_BeaconsMissed_t *)(buf + len);
+						struct MrvlIEtypes_BeaconsMissed *BcnMissed = (struct MrvlIEtypes_BeaconsMissed *)(buf + len);
 						printf("Beacon Missed\t%d\tN/A\t%s\n",BcnMissed->BeaconMissed,(se->Events & 0x0008)?"yes":"no");
-						len += sizeof(MrvlIEtypes_BeaconsMissed_t);
+						len += sizeof(struct MrvlIEtypes_BeaconsMissed);
 						break;
 					}
 					case TLV_TYPE_RSSI_HIGH:
 					{
-						MrvlIEtypes_RssiParamSet_t *HighRssi = (MrvlIEtypes_RssiParamSet_t *)(buf + len);
+						struct MrvlIEtypes_RssiThreshold *HighRssi = (struct MrvlIEtypes_RssiThreshold *)(buf + len);
 						printf("High RSSI\t%d\t%d\t%s\n",HighRssi->RSSIValue,HighRssi->RSSIFreq,(se->Events & 0x0010)?"yes":"no");
-						len += sizeof(MrvlIEtypes_RssiParamSet_t);
+						len += sizeof(struct MrvlIEtypes_RssiThreshold);
 						break;
 					}
 					case TLV_TYPE_SNR_HIGH:
 					{
-						MrvlIEtypes_SnrThreshold_t *HighSnr = (MrvlIEtypes_SnrThreshold_t *)(buf + len);
+						struct MrvlIEtypes_SnrThreshold *HighSnr = (struct MrvlIEtypes_SnrThreshold *)(buf + len);
 						printf("High SNR\t%d\t%d\t%s\n",HighSnr->SNRValue,HighSnr->SNRFreq,(se->Events & 0x0020)?"yes":"no");
-						len += sizeof(MrvlIEtypes_SnrThreshold_t);
+						len += sizeof(struct MrvlIEtypes_SnrThreshold);
 						break;
 					}
 					default:
 						printf("unknown subscribed event TLV Type=%#x, Len=%d\n", header->Type, header->Len);
-						len += sizeof(MrvlIEtypesHeader_t) + header->Len;
+						len += sizeof(struct MrvlIEtypesHeader) + header->Len;
 						break;
 					}
 				}
@@ -1083,21 +1085,21 @@ static int process_getscantable(int argc
 
     u8* pCurrent;
     u8* pNext;
-    IEEEtypes_ElementId_e* pElementId;
+    enum IEEEtypes_ElementId* pElementId;
     u8* pElementLen;
     int bssInfoLen;
     int ssidIdx;
     u16 tmpCap;
     u8* pByte;
 
-    IEEEtypes_CapInfo_t capInfo;
+    struct IEEEtypes_CapInfo capInfo;
     u8 tsf[8];
     u16 beaconInterval;
 
-    wlan_ioctl_get_scan_table_info* pRspInfo;
-    wlan_ioctl_get_scan_table_entry* pRspEntry;
+    struct wlan_ioctl_get_scan_table_info* pRspInfo;
+    struct wlan_ioctl_get_scan_table_entry* pRspEntry;
 
-    pRspInfo = (wlan_ioctl_get_scan_table_info*)scanRspBuffer;
+    pRspInfo = (struct wlan_ioctl_get_scan_table_info*)scanRspBuffer;
     
     if (get_priv_ioctl("getscantable", 
                        &ioctl_val, &subioctl_val) == WLAN_STATUS_FAILURE) {
@@ -1139,7 +1141,7 @@ static int process_getscantable(int argc
              */
             pCurrent = pNext;  
 
-            pRspEntry = (wlan_ioctl_get_scan_table_entry*)pCurrent;
+            pRspEntry = (struct wlan_ioctl_get_scan_table_entry*)pCurrent;
             
             printf("%02u| %03d | %03d | %02x:%02x:%02x:%02x:%02x:%02x |",
                    scanStart + idx,
@@ -1194,7 +1196,7 @@ static int process_getscantable(int argc
             }
 
             while (bssInfoLen >= 2) {
-                pElementId  = (IEEEtypes_ElementId_e*)pCurrent;
+                pElementId  = (enum IEEEtypes_ElementId*)pCurrent;
                 pElementLen = pCurrent + 1;
                 pCurrent   += 2;
                 
@@ -1275,7 +1277,7 @@ static int process_getscantable(int argc
  */
 static int process_setuserscan(int argc, char *argv[]) 
 {
-    wlan_ioctl_user_scan_cfg scanReq;
+    struct wlan_ioctl_user_scan_cfg scanReq;
     int ioctl_val, subioctl_val;
 	struct iwreq iwr;
     char* pArgTok;



More information about the libertas-dev mailing list