Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] hostap: don't #include C files in hostap_main.c

This patch contains an attempt to properly build hostap.o without
#include'ing C files.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Adrian Bunk and committed by
John W. Linville
5fad5a2e 8aec9383

+120 -77
+2 -1
drivers/net/wireless/hostap/Makefile
··· 1 - hostap-y := hostap_main.o 1 + hostap-y := hostap_80211_rx.o hostap_80211_tx.o hostap_ap.o hostap_info.o \ 2 + hostap_ioctl.o hostap_main.o hostap_proc.o 2 3 obj-$(CONFIG_HOSTAP) += hostap.o 3 4 4 5 obj-$(CONFIG_HOSTAP_CS) += hostap_cs.o
+37
drivers/net/wireless/hostap/hostap.h
··· 1 1 #ifndef HOSTAP_H 2 2 #define HOSTAP_H 3 3 4 + #include <linux/ethtool.h> 5 + 6 + #include "hostap_wlan.h" 7 + #include "hostap_ap.h" 8 + 9 + static const long freq_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, 10 + 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; 11 + #define FREQ_COUNT (sizeof(freq_list) / sizeof(freq_list[0])) 12 + 4 13 /* hostap.c */ 5 14 6 15 extern struct proc_dir_entry *hostap_proc; ··· 49 40 int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, 50 41 u8 *body, size_t bodylen); 51 42 int prism2_sta_deauth(local_info_t *local, u16 reason); 43 + int prism2_wds_add(local_info_t *local, u8 *remote_addr, 44 + int rtnl_locked); 45 + int prism2_wds_del(local_info_t *local, u8 *remote_addr, 46 + int rtnl_locked, int do_not_remove); 47 + 48 + 49 + /* hostap_ap.c */ 50 + 51 + int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac); 52 + int ap_control_del_mac(struct mac_restrictions *mac_restrictions, u8 *mac); 53 + void ap_control_flush_macs(struct mac_restrictions *mac_restrictions); 54 + int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac); 55 + void ap_control_kickall(struct ap_data *ap); 56 + void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, 57 + struct ieee80211_crypt_data ***crypt); 58 + int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], 59 + struct iw_quality qual[], int buf_size, 60 + int aplist); 61 + int prism2_ap_translate_scan(struct net_device *dev, char *buffer); 62 + int prism2_hostapd(struct ap_data *ap, struct prism2_hostapd_param *param); 52 63 53 64 54 65 /* hostap_proc.c */ ··· 81 52 82 53 void hostap_info_init(local_info_t *local); 83 54 void hostap_info_process(local_info_t *local, struct sk_buff *skb); 55 + 56 + 57 + /* hostap_ioctl.c */ 58 + 59 + extern const struct iw_handler_def hostap_iw_handler_def; 60 + extern struct ethtool_ops prism2_ethtool_ops; 61 + 62 + int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 84 63 85 64 86 65 #endif /* HOSTAP_H */
+3
drivers/net/wireless/hostap/hostap_80211.h
··· 1 1 #ifndef HOSTAP_80211_H 2 2 #define HOSTAP_80211_H 3 3 4 + #include <linux/types.h> 5 + #include <net/ieee80211_crypt.h> 6 + 4 7 struct hostap_ieee80211_mgmt { 5 8 u16 frame_control; 6 9 u16 duration;
+11
drivers/net/wireless/hostap/hostap_80211_rx.c
··· 1 1 #include <linux/etherdevice.h> 2 + #include <net/ieee80211_crypt.h> 2 3 3 4 #include "hostap_80211.h" 4 5 #include "hostap.h" 6 + #include "hostap_ap.h" 7 + 8 + /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ 9 + /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ 10 + static unsigned char rfc1042_header[] = 11 + { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; 12 + /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ 13 + static unsigned char bridge_tunnel_header[] = 14 + { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; 15 + /* No encapsulation header if EtherType < 0x600 (=length) */ 5 16 6 17 void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, 7 18 struct hostap_80211_rx_status *rx_stats)
+15
drivers/net/wireless/hostap/hostap_80211_tx.c
··· 1 + #include "hostap_80211.h" 2 + #include "hostap_common.h" 3 + #include "hostap_wlan.h" 4 + #include "hostap.h" 5 + #include "hostap_ap.h" 6 + 7 + /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ 8 + /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ 9 + static unsigned char rfc1042_header[] = 10 + { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; 11 + /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ 12 + static unsigned char bridge_tunnel_header[] = 13 + { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; 14 + /* No encapsulation header if EtherType < 0x600 (=length) */ 15 + 1 16 void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) 2 17 { 3 18 struct ieee80211_hdr_4addr *hdr;
+20 -16
drivers/net/wireless/hostap/hostap_ap.c
··· 16 16 * (8802.11: 5.5) 17 17 */ 18 18 19 + #include <linux/proc_fs.h> 20 + #include <linux/delay.h> 21 + #include <linux/random.h> 22 + 23 + #include "hostap_wlan.h" 24 + #include "hostap.h" 25 + #include "hostap_ap.h" 26 + 19 27 static int other_ap_policy[MAX_PARM_DEVICES] = { AP_OTHER_AP_SKIP_ALL, 20 28 DEF_INTS }; 21 29 module_param_array(other_ap_policy, int, NULL, 0444); ··· 368 360 } 369 361 370 362 371 - static int ap_control_add_mac(struct mac_restrictions *mac_restrictions, 372 - u8 *mac) 363 + int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac) 373 364 { 374 365 struct mac_entry *entry; 375 366 ··· 387 380 } 388 381 389 382 390 - static int ap_control_del_mac(struct mac_restrictions *mac_restrictions, 391 - u8 *mac) 383 + int ap_control_del_mac(struct mac_restrictions *mac_restrictions, u8 *mac) 392 384 { 393 385 struct list_head *ptr; 394 386 struct mac_entry *entry; ··· 439 433 } 440 434 441 435 442 - static void ap_control_flush_macs(struct mac_restrictions *mac_restrictions) 436 + void ap_control_flush_macs(struct mac_restrictions *mac_restrictions) 443 437 { 444 438 struct list_head *ptr, *n; 445 439 struct mac_entry *entry; ··· 460 454 } 461 455 462 456 463 - static int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, 464 - u8 *mac) 457 + int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac) 465 458 { 466 459 struct sta_info *sta; 467 460 u16 resp; ··· 491 486 #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 492 487 493 488 494 - static void ap_control_kickall(struct ap_data *ap) 489 + void ap_control_kickall(struct ap_data *ap) 495 490 { 496 491 struct list_head *ptr, *n; 497 492 struct sta_info *sta; ··· 2326 2321 } 2327 2322 2328 2323 2329 - static int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], 2330 - struct iw_quality qual[], int buf_size, 2331 - int aplist) 2324 + int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], 2325 + struct iw_quality qual[], int buf_size, 2326 + int aplist) 2332 2327 { 2333 2328 struct ap_data *ap = local->ap; 2334 2329 struct list_head *ptr; ··· 2368 2363 2369 2364 /* Translate our list of Access Points & Stations to a card independant 2370 2365 * format that the Wireless Tools will understand - Jean II */ 2371 - static int prism2_ap_translate_scan(struct net_device *dev, char *buffer) 2366 + int prism2_ap_translate_scan(struct net_device *dev, char *buffer) 2372 2367 { 2373 2368 struct hostap_interface *iface; 2374 2369 local_info_t *local; ··· 2613 2608 } 2614 2609 2615 2610 2616 - static int prism2_hostapd(struct ap_data *ap, 2617 - struct prism2_hostapd_param *param) 2611 + int prism2_hostapd(struct ap_data *ap, struct prism2_hostapd_param *param) 2618 2612 { 2619 2613 switch (param->cmd) { 2620 2614 case PRISM2_HOSTAPD_FLUSH: ··· 3211 3207 } 3212 3208 3213 3209 3214 - static void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, 3215 - struct ieee80211_crypt_data ***crypt) 3210 + void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, 3211 + struct ieee80211_crypt_data ***crypt) 3216 3212 { 3217 3213 struct sta_info *sta; 3218 3214
+2
drivers/net/wireless/hostap/hostap_ap.h
··· 1 1 #ifndef HOSTAP_AP_H 2 2 #define HOSTAP_AP_H 3 3 4 + #include "hostap_80211.h" 5 + 4 6 /* AP data structures for STAs */ 5 7 6 8 /* maximum number of frames to buffer per STA */
+3
drivers/net/wireless/hostap/hostap_common.h
··· 1 1 #ifndef HOSTAP_COMMON_H 2 2 #define HOSTAP_COMMON_H 3 3 4 + #include <linux/types.h> 5 + #include <linux/if_ether.h> 6 + 4 7 #define BIT(x) (1 << (x)) 5 8 6 9 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
+3
drivers/net/wireless/hostap/hostap_info.c
··· 1 1 /* Host AP driver Info Frame processing (part of hostap.o module) */ 2 2 3 + #include "hostap_wlan.h" 4 + #include "hostap.h" 5 + #include "hostap_ap.h" 3 6 4 7 /* Called only as a tasklet (software IRQ) */ 5 8 static void prism2_info_commtallies16(local_info_t *local, unsigned char *buf,
+7 -5
drivers/net/wireless/hostap/hostap_ioctl.c
··· 1 1 /* ioctl() (mostly Linux Wireless Extensions) routines for Host AP driver */ 2 2 3 - #ifdef in_atomic 4 - /* Get kernel_locked() for in_atomic() */ 3 + #include <linux/types.h> 5 4 #include <linux/smp_lock.h> 6 - #endif 7 5 #include <linux/ethtool.h> 6 + #include <net/ieee80211_crypt.h> 8 7 8 + #include "hostap_wlan.h" 9 + #include "hostap.h" 10 + #include "hostap_ap.h" 9 11 10 12 static struct iw_statistics *hostap_get_wireless_stats(struct net_device *dev) 11 13 { ··· 3912 3910 local->sta_fw_ver & 0xff); 3913 3911 } 3914 3912 3915 - static struct ethtool_ops prism2_ethtool_ops = { 3913 + struct ethtool_ops prism2_ethtool_ops = { 3916 3914 .get_drvinfo = prism2_get_drvinfo 3917 3915 }; 3918 3916 ··· 3987 3985 (iw_handler) prism2_ioctl_priv_readmif, /* 3 */ 3988 3986 }; 3989 3987 3990 - static const struct iw_handler_def hostap_iw_handler_def = 3988 + const struct iw_handler_def hostap_iw_handler_def = 3991 3989 { 3992 3990 .num_standard = sizeof(prism2_handler) / sizeof(iw_handler), 3993 3991 .num_private = sizeof(prism2_private_handler) / sizeof(iw_handler),
+5 -55
drivers/net/wireless/hostap/hostap_main.c
··· 24 24 #include <linux/kmod.h> 25 25 #include <linux/rtnetlink.h> 26 26 #include <linux/wireless.h> 27 + #include <linux/etherdevice.h> 27 28 #include <net/iw_handler.h> 28 29 #include <net/ieee80211.h> 29 30 #include <net/ieee80211_crypt.h> ··· 46 45 #define PRISM2_MIN_MTU 256 47 46 /* FIX: */ 48 47 #define PRISM2_MAX_MTU (PRISM2_MAX_FRAME_SIZE - (6 /* LLC */ + 8 /* WEP */)) 49 - 50 - 51 - /* hostap.c */ 52 - static int prism2_wds_add(local_info_t *local, u8 *remote_addr, 53 - int rtnl_locked); 54 - static int prism2_wds_del(local_info_t *local, u8 *remote_addr, 55 - int rtnl_locked, int do_not_remove); 56 - 57 - /* hostap_ap.c */ 58 - static int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], 59 - struct iw_quality qual[], int buf_size, 60 - int aplist); 61 - static int prism2_ap_translate_scan(struct net_device *dev, char *buffer); 62 - static int prism2_hostapd(struct ap_data *ap, 63 - struct prism2_hostapd_param *param); 64 - static void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, 65 - struct ieee80211_crypt_data ***crypt); 66 - static void ap_control_kickall(struct ap_data *ap); 67 - #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 68 - static int ap_control_add_mac(struct mac_restrictions *mac_restrictions, 69 - u8 *mac); 70 - static int ap_control_del_mac(struct mac_restrictions *mac_restrictions, 71 - u8 *mac); 72 - static void ap_control_flush_macs(struct mac_restrictions *mac_restrictions); 73 - static int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, 74 - u8 *mac); 75 - #endif /* !PRISM2_NO_KERNEL_IEEE80211_MGMT */ 76 - 77 - 78 - static const long freq_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, 79 - 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; 80 - #define FREQ_COUNT (sizeof(freq_list) / sizeof(freq_list[0])) 81 - 82 - 83 - /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ 84 - /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ 85 - static unsigned char rfc1042_header[] = 86 - { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; 87 - /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ 88 - static unsigned char bridge_tunnel_header[] = 89 - { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; 90 - /* No encapsulation header if EtherType < 0x600 (=length) */ 91 - 92 - 93 - /* FIX: these could be compiled separately and linked together to hostap.o */ 94 - #include "hostap_ap.c" 95 - #include "hostap_info.c" 96 - #include "hostap_ioctl.c" 97 - #include "hostap_proc.c" 98 - #include "hostap_80211_rx.c" 99 - #include "hostap_80211_tx.c" 100 48 101 49 102 50 struct net_device * hostap_add_interface(struct local_info *local, ··· 146 196 } 147 197 148 198 149 - static int prism2_wds_add(local_info_t *local, u8 *remote_addr, 150 - int rtnl_locked) 199 + int prism2_wds_add(local_info_t *local, u8 *remote_addr, 200 + int rtnl_locked) 151 201 { 152 202 struct net_device *dev; 153 203 struct list_head *ptr; ··· 208 258 } 209 259 210 260 211 - static int prism2_wds_del(local_info_t *local, u8 *remote_addr, 212 - int rtnl_locked, int do_not_remove) 261 + int prism2_wds_del(local_info_t *local, u8 *remote_addr, 262 + int rtnl_locked, int do_not_remove) 213 263 { 214 264 unsigned long flags; 215 265 struct list_head *ptr;
+7
drivers/net/wireless/hostap/hostap_proc.c
··· 1 1 /* /proc routines for Host AP driver */ 2 2 3 + #include <linux/types.h> 4 + #include <linux/proc_fs.h> 5 + #include <net/ieee80211_crypt.h> 6 + 7 + #include "hostap_wlan.h" 8 + #include "hostap.h" 9 + 3 10 #define PROC_LIMIT (PAGE_SIZE - 80) 4 11 5 12
+4
drivers/net/wireless/hostap/hostap_wlan.h
··· 1 1 #ifndef HOSTAP_WLAN_H 2 2 #define HOSTAP_WLAN_H 3 3 4 + #include <linux/wireless.h> 5 + #include <linux/netdevice.h> 6 + #include <net/iw_handler.h> 7 + 4 8 #include "hostap_config.h" 5 9 #include "hostap_common.h" 6 10
+1
include/net/ieee80211_crypt.h
··· 25 25 26 26 #include <linux/types.h> 27 27 #include <linux/list.h> 28 + #include <net/ieee80211.h> 28 29 #include <asm/atomic.h> 29 30 30 31 enum {