diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bonding/bond_procfs.c | 4 | ||||
-rw-r--r-- | drivers/net/irda/vlsi_ir.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/airo.c | 116 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/debugfs.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/atmel.c | 69 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ap.c | 375 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_download.c | 68 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_hw.c | 38 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_proc.c | 609 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_wlan.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ray_cs.c | 2 |
11 files changed, 701 insertions, 591 deletions
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index 3cea38d..94d06f1 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c @@ -218,15 +218,13 @@ static const struct seq_operations bond_info_seq_ops = { static int bond_info_open(struct inode *inode, struct file *file) { struct seq_file *seq; - struct proc_dir_entry *proc; int res; res = seq_open(file, &bond_info_seq_ops); if (!res) { /* recover the pointer buried in proc_dir_entry data */ seq = file->private_data; - proc = PDE(inode); - seq->private = proc->data; + seq->private = PDE_DATA(inode); } return res; diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c index 2f99f88..5f47584 100644 --- a/drivers/net/irda/vlsi_ir.c +++ b/drivers/net/irda/vlsi_ir.c @@ -383,7 +383,7 @@ static int vlsi_seq_show(struct seq_file *seq, void *v) static int vlsi_seq_open(struct inode *inode, struct file *file) { - return single_open(file, vlsi_seq_show, PDE(inode)->data); + return single_open(file, vlsi_seq_show, PDE_DATA(inode)); } static const struct file_operations vlsi_proc_fops = { @@ -1678,7 +1678,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id) IRDA_WARNING("%s: failed to create proc entry\n", __func__); } else { - ent->size = 0; + proc_set_size(ent, 0); } idev->proc_entry = ent; } diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 5329541..6125adb 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -4506,108 +4506,75 @@ static int setup_proc_entry( struct net_device *dev, apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm, airo_entry); if (!apriv->proc_entry) - goto fail; - apriv->proc_entry->uid = proc_kuid; - apriv->proc_entry->gid = proc_kgid; + return -ENOMEM; + proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid); /* Setup the StatsDelta */ entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm, apriv->proc_entry, &proc_statsdelta_ops, dev); if (!entry) - goto fail_stats_delta; - entry->uid = proc_kuid; - entry->gid = proc_kgid; + goto fail; + proc_set_user(entry, proc_kuid, proc_kgid); /* Setup the Stats */ entry = proc_create_data("Stats", S_IRUGO & proc_perm, apriv->proc_entry, &proc_stats_ops, dev); if (!entry) - goto fail_stats; - entry->uid = proc_kuid; - entry->gid = proc_kgid; + goto fail; + proc_set_user(entry, proc_kuid, proc_kgid); /* Setup the Status */ entry = proc_create_data("Status", S_IRUGO & proc_perm, apriv->proc_entry, &proc_status_ops, dev); if (!entry) - goto fail_status; - entry->uid = proc_kuid; - entry->gid = proc_kgid; + goto fail; + proc_set_user(entry, proc_kuid, proc_kgid); /* Setup the Config */ entry = proc_create_data("Config", proc_perm, apriv->proc_entry, &proc_config_ops, dev); if (!entry) - goto fail_config; - entry->uid = proc_kuid; - entry->gid = proc_kgid; + goto fail; + proc_set_user(entry, proc_kuid, proc_kgid); /* Setup the SSID */ entry = proc_create_data("SSID", proc_perm, apriv->proc_entry, &proc_SSID_ops, dev); if (!entry) - goto fail_ssid; - entry->uid = proc_kuid; - entry->gid = proc_kgid; + goto fail; + proc_set_user(entry, proc_kuid, proc_kgid); /* Setup the APList */ entry = proc_create_data("APList", proc_perm, apriv->proc_entry, &proc_APList_ops, dev); if (!entry) - goto fail_aplist; - entry->uid = proc_kuid; - entry->gid = proc_kgid; + goto fail; + proc_set_user(entry, proc_kuid, proc_kgid); /* Setup the BSSList */ entry = proc_create_data("BSSList", proc_perm, apriv->proc_entry, &proc_BSSList_ops, dev); if (!entry) - goto fail_bsslist; - entry->uid = proc_kuid; - entry->gid = proc_kgid; + goto fail; + proc_set_user(entry, proc_kuid, proc_kgid); /* Setup the WepKey */ entry = proc_create_data("WepKey", proc_perm, apriv->proc_entry, &proc_wepkey_ops, dev); if (!entry) - goto fail_wepkey; - entry->uid = proc_kuid; - entry->gid = proc_kgid; - + goto fail; + proc_set_user(entry, proc_kuid, proc_kgid); return 0; -fail_wepkey: - remove_proc_entry("BSSList", apriv->proc_entry); -fail_bsslist: - remove_proc_entry("APList", apriv->proc_entry); -fail_aplist: - remove_proc_entry("SSID", apriv->proc_entry); -fail_ssid: - remove_proc_entry("Config", apriv->proc_entry); -fail_config: - remove_proc_entry("Status", apriv->proc_entry); -fail_status: - remove_proc_entry("Stats", apriv->proc_entry); -fail_stats: - remove_proc_entry("StatsDelta", apriv->proc_entry); -fail_stats_delta: - remove_proc_entry(apriv->proc_name, airo_entry); fail: + remove_proc_subtree(apriv->proc_name, airo_entry); return -ENOMEM; } static int takedown_proc_entry( struct net_device *dev, - struct airo_info *apriv ) { - if ( !apriv->proc_entry->namelen ) return 0; - remove_proc_entry("Stats",apriv->proc_entry); - remove_proc_entry("StatsDelta",apriv->proc_entry); - remove_proc_entry("Status",apriv->proc_entry); - remove_proc_entry("Config",apriv->proc_entry); - remove_proc_entry("SSID",apriv->proc_entry); - remove_proc_entry("APList",apriv->proc_entry); - remove_proc_entry("BSSList",apriv->proc_entry); - remove_proc_entry("WepKey",apriv->proc_entry); - remove_proc_entry(apriv->proc_name,airo_entry); + struct airo_info *apriv ) +{ + remove_proc_subtree(apriv->proc_name, airo_entry); return 0; } @@ -4663,8 +4630,7 @@ static ssize_t proc_write( struct file *file, static int proc_status_open(struct inode *inode, struct file *file) { struct proc_data *data; - struct proc_dir_entry *dp = PDE(inode); - struct net_device *dev = dp->data; + struct net_device *dev = PDE_DATA(inode); struct airo_info *apriv = dev->ml_priv; CapabilityRid cap_rid; StatusRid status_rid; @@ -4746,8 +4712,7 @@ static int proc_stats_rid_open( struct inode *inode, u16 rid ) { struct proc_data *data; - struct proc_dir_entry *dp = PDE(inode); - struct net_device *dev = dp->data; + struct net_device *dev = PDE_DATA(inode); struct airo_info *apriv = dev->ml_priv; StatsRid stats; int i, j; @@ -4809,8 +4774,7 @@ static inline int sniffing_mode(struct airo_info *ai) static void proc_config_on_close(struct inode *inode, struct file *file) { struct proc_data *data = file->private_data; - struct proc_dir_entry *dp = PDE(inode); - struct net_device *dev = dp->data; + struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; char *line; @@ -5021,8 +4985,7 @@ static const char *get_rmode(__le16 mode) static int proc_config_open(struct inode *inode, struct file *file) { struct proc_data *data; - struct proc_dir_entry *dp = PDE(inode); - struct net_device *dev = dp->data; + struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; int i; __le16 mode; @@ -5112,8 +5075,7 @@ static int proc_config_open(struct inode *inode, struct file *file) static void proc_SSID_on_close(struct inode *inode, struct file *file) { struct proc_data *data = file->private_data; - struct proc_dir_entry *dp = PDE(inode); - struct net_device *dev = dp->data; + struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; SsidRid SSID_rid; int i; @@ -5148,8 +5110,7 @@ static void proc_SSID_on_close(struct inode *inode, struct file *file) static void proc_APList_on_close( struct inode *inode, struct file *file ) { struct proc_data *data = file->private_data; - struct proc_dir_entry *dp = PDE(inode); - struct net_device *dev = dp->data; + struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; APListRid APList_rid; int i; @@ -5283,8 +5244,7 @@ static int set_wep_tx_idx(struct airo_info *ai, u16 index, int perm, int lock) static void proc_wepkey_on_close( struct inode *inode, struct file *file ) { struct proc_data *data; - struct proc_dir_entry *dp = PDE(inode); - struct net_device *dev = dp->data; + struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; int i, rc; char key[16]; @@ -5335,8 +5295,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) { static int proc_wepkey_open( struct inode *inode, struct file *file ) { struct proc_data *data; - struct proc_dir_entry *dp = PDE(inode); - struct net_device *dev = dp->data; + struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; char *ptr; WepKeyRid wkr; @@ -5384,8 +5343,7 @@ static int proc_wepkey_open( struct inode *inode, struct file *file ) static int proc_SSID_open(struct inode *inode, struct file *file) { struct proc_data *data; - struct proc_dir_entry *dp = PDE(inode); - struct net_device *dev = dp->data; + struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; int i; char *ptr; @@ -5428,8 +5386,7 @@ static int proc_SSID_open(struct inode *inode, struct file *file) static int proc_APList_open( struct inode *inode, struct file *file ) { struct proc_data *data; - struct proc_dir_entry *dp = PDE(inode); - struct net_device *dev = dp->data; + struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; int i; char *ptr; @@ -5468,8 +5425,7 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { static int proc_BSSList_open( struct inode *inode, struct file *file ) { struct proc_data *data; - struct proc_dir_entry *dp = PDE(inode); - struct net_device *dev = dp->data; + struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; char *ptr; BSSListRid BSSList_rid; @@ -5706,10 +5662,8 @@ static int __init airo_init_module( void ) airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL); - if (airo_entry) { - airo_entry->uid = proc_kuid; - airo_entry->gid = proc_kgid; - } + if (airo_entry) + proc_set_user(airo_entry, proc_kuid, proc_kgid); for (i = 0; i < 4 && io[i] && irq[i]; i++) { airo_print_info("", "Trying to configure ISA adapter at irq=%d " diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index 4be07f5..727b1f5 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -216,7 +216,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_iomem_x32, wil_debugfs_iomem_x32_get, wil_debugfs_iomem_x32_set, "0x%08llx\n"); static struct dentry *wil_debugfs_create_iomem_x32(const char *name, - mode_t mode, + umode_t mode, struct dentry *parent, void __iomem *value) { @@ -359,7 +359,7 @@ static const struct file_operations fops_ioblob = { static struct dentry *wil_debugfs_create_ioblob(const char *name, - mode_t mode, + umode_t mode, struct dentry *parent, struct debugfs_blob_wrapper *blob) { diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 4374079..23a3498 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c @@ -63,6 +63,7 @@ #include <net/iw_handler.h> #include <linux/crc32.h> #include <linux/proc_fs.h> +#include <linux/seq_file.h> #include <linux/device.h> #include <linux/moduleparam.h> #include <linux/firmware.h> @@ -1409,30 +1410,28 @@ static int atmel_validate_channel(struct atmel_private *priv, int channel) return 0; } -static int atmel_proc_output (char *buf, struct atmel_private *priv) +static int atmel_proc_show(struct seq_file *m, void *v) { + struct atmel_private *priv = m->private; int i; - char *p = buf; char *s, *r, *c; - p += sprintf(p, "Driver version:\t\t%d.%d\n", - DRIVER_MAJOR, DRIVER_MINOR); + seq_printf(m, "Driver version:\t\t%d.%d\n", DRIVER_MAJOR, DRIVER_MINOR); if (priv->station_state != STATION_STATE_DOWN) { - p += sprintf(p, "Firmware version:\t%d.%d build %d\n" - "Firmware location:\t", - priv->host_info.major_version, - priv->host_info.minor_version, - priv->host_info.build_version); + seq_printf(m, + "Firmware version:\t%d.%d build %d\n" + "Firmware location:\t", + priv->host_info.major_version, + priv->host_info.minor_version, + priv->host_info.build_version); if (priv->card_type != CARD_TYPE_EEPROM) - p += sprintf(p, "on card\n"); + seq_puts(m, "on card\n"); else if (priv->firmware) - p += sprintf(p, "%s loaded by host\n", - priv->firmware_id); + seq_printf(m, "%s loaded by host\n", priv->firmware_id); else - p += sprintf(p, "%s loaded by hotplug\n", - priv->firmware_id); + seq_printf(m, "%s loaded by hotplug\n", priv->firmware_id); switch (priv->card_type) { case CARD_TYPE_PARALLEL_FLASH: @@ -1453,12 +1452,12 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) if (priv->reg_domain == channel_table[i].reg_domain) r = channel_table[i].name; - p += sprintf(p, "MAC memory type:\t%s\n", c); - p += sprintf(p, "Regulatory domain:\t%s\n", r); - p += sprintf(p, "Host CRC checking:\t%s\n", - priv->do_rx_crc ? "On" : "Off"); - p += sprintf(p, "WPA-capable firmware:\t%s\n", - priv->use_wpa ? "Yes" : "No"); + seq_printf(m, "MAC memory type:\t%s\n", c); + seq_printf(m, "Regulatory domain:\t%s\n", r); + seq_printf(m, "Host CRC checking:\t%s\n", + priv->do_rx_crc ? "On" : "Off"); + seq_printf(m, "WPA-capable firmware:\t%s\n", + priv->use_wpa ? "Yes" : "No"); } switch (priv->station_state) { @@ -1490,26 +1489,22 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) s = "<unknown>"; } - p += sprintf(p, "Current state:\t\t%s\n", s); - return p - buf; + seq_printf(m, "Current state:\t\t%s\n", s); + return 0; } -static int atmel_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int atmel_proc_open(struct inode *inode, struct file *file) { - struct atmel_private *priv = data; - int len = atmel_proc_output (page, priv); - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; + return single_open(file, atmel_proc_show, PDE_DATA(inode)); } +static const struct file_operations atmel_proc_fops = { + .open = atmel_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; + static const struct net_device_ops atmel_netdev_ops = { .ndo_open = atmel_open, .ndo_stop = atmel_close, @@ -1525,7 +1520,6 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, struct device *sys_dev, int (*card_present)(void *), void *card) { - struct proc_dir_entry *ent; struct net_device *dev; struct atmel_private *priv; int rc; @@ -1630,8 +1624,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, netif_carrier_off(dev); - ent = create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); - if (!ent) + if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)); printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index dd9a18f..19c45e3 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c @@ -17,6 +17,7 @@ */ #include <linux/proc_fs.h> +#include <linux/seq_file.h> #include <linux/delay.h> #include <linux/random.h> #include <linux/if_arp.h> @@ -64,28 +65,32 @@ static void prism2_send_mgmt(struct net_device *dev, #ifndef PRISM2_NO_PROCFS_DEBUG -static int ap_debug_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - char *p = page; - struct ap_data *ap = (struct ap_data *) data; - - if (off != 0) { - *eof = 1; - return 0; - } - - p += sprintf(p, "BridgedUnicastFrames=%u\n", ap->bridged_unicast); - p += sprintf(p, "BridgedMulticastFrames=%u\n", ap->bridged_multicast); - p += sprintf(p, "max_inactivity=%u\n", ap->max_inactivity / HZ); - p += sprintf(p, "bridge_packets=%u\n", ap->bridge_packets); - p += sprintf(p, "nullfunc_ack=%u\n", ap->nullfunc_ack); - p += sprintf(p, "autom_ap_wds=%u\n", ap->autom_ap_wds); - p += sprintf(p, "auth_algs=%u\n", ap->local->auth_algs); - p += sprintf(p, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc); +static int ap_debug_proc_show(struct seq_file *m, void *v) +{ + struct ap_data *ap = m->private; + + seq_printf(m, "BridgedUnicastFrames=%u\n", ap->bridged_unicast); + seq_printf(m, "BridgedMulticastFrames=%u\n", ap->bridged_multicast); + seq_printf(m, "max_inactivity=%u\n", ap->max_inactivity / HZ); + seq_printf(m, "bridge_packets=%u\n", ap->bridge_packets); + seq_printf(m, "nullfunc_ack=%u\n", ap->nullfunc_ack); + seq_printf(m, "autom_ap_wds=%u\n", ap->autom_ap_wds); + seq_printf(m, "auth_algs=%u\n", ap->local->auth_algs); + seq_printf(m, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc); + return 0; +} - return (p - page); +static int ap_debug_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, ap_debug_proc_show, PDE_DATA(inode)); } + +static const struct file_operations ap_debug_proc_fops = { + .open = ap_debug_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; #endif /* PRISM2_NO_PROCFS_DEBUG */ @@ -325,50 +330,81 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap, } -static int ap_control_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int ap_control_proc_show(struct seq_file *m, void *v) { - char *p = page; - struct ap_data *ap = (struct ap_data *) data; + struct ap_data *ap = m->private; char *policy_txt; struct mac_entry *entry; - if (off != 0) { - *eof = 1; + if (v == SEQ_START_TOKEN) { + switch (ap->mac_restrictions.policy) { + case MAC_POLICY_OPEN: + policy_txt = "open"; + break; + case MAC_POLICY_ALLOW: + policy_txt = "allow"; + break; + case MAC_POLICY_DENY: + policy_txt = "deny"; + break; + default: + policy_txt = "unknown"; + break; + } + seq_printf(m, "MAC policy: %s\n", policy_txt); + seq_printf(m, "MAC entries: %u\n", ap->mac_restrictions.entries); + seq_puts(m, "MAC list:\n"); return 0; } - switch (ap->mac_restrictions.policy) { - case MAC_POLICY_OPEN: - policy_txt = "open"; - break; - case MAC_POLICY_ALLOW: - policy_txt = "allow"; - break; - case MAC_POLICY_DENY: - policy_txt = "deny"; - break; - default: - policy_txt = "unknown"; - break; - } - p += sprintf(p, "MAC policy: %s\n", policy_txt); - p += sprintf(p, "MAC entries: %u\n", ap->mac_restrictions.entries); - p += sprintf(p, "MAC list:\n"); + entry = v; + seq_printf(m, "%pM\n", entry->addr); + return 0; +} + +static void *ap_control_proc_start(struct seq_file *m, loff_t *_pos) +{ + struct ap_data *ap = m->private; spin_lock_bh(&ap->mac_restrictions.lock); - list_for_each_entry(entry, &ap->mac_restrictions.mac_list, list) { - if (p - page > PAGE_SIZE - 80) { - p += sprintf(p, "All entries did not fit one page.\n"); - break; - } + return seq_list_start_head(&ap->mac_restrictions.mac_list, *_pos); +} - p += sprintf(p, "%pM\n", entry->addr); - } +static void *ap_control_proc_next(struct seq_file *m, void *v, loff_t *_pos) +{ + struct ap_data *ap = m->private; + return seq_list_next(v, &ap->mac_restrictions.mac_list, _pos); +} + +static void ap_control_proc_stop(struct seq_file *m, void *v) +{ + struct ap_data *ap = m->private; spin_unlock_bh(&ap->mac_restrictions.lock); +} - return (p - page); +static const struct seq_operations ap_control_proc_seqops = { + .start = ap_control_proc_start, + .next = ap_control_proc_next, + .stop = ap_control_proc_stop, + .show = ap_control_proc_show, +}; + +static int ap_control_proc_open(struct inode *inode, struct file *file) +{ + int ret = seq_open(file, &ap_control_proc_seqops); + if (ret == 0) { + struct seq_file *m = file->private_data; + m->private = PDE_DATA(inode); + } + return ret; } +static const struct file_operations ap_control_proc_fops = { + .open = ap_control_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; + int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac) { @@ -510,61 +546,84 @@ void ap_control_kickall(struct ap_data *ap) #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT -#define PROC_LIMIT (PAGE_SIZE - 80) - -static int prism2_ap_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int prism2_ap_proc_show(struct seq_file *m, void *v) { - char *p = page; - struct ap_data *ap = (struct ap_data *) data; - struct sta_info *sta; + struct sta_info *sta = v; int i; - if (off > PROC_LIMIT) { - *eof = 1; + if (v == SEQ_START_TOKEN) { + seq_printf(m, "# BSSID CHAN SIGNAL NOISE RATE SSID FLAGS\n"); return 0; } - p += sprintf(p, "# BSSID CHAN SIGNAL NOISE RATE SSID FLAGS\n"); - spin_lock_bh(&ap->sta_table_lock); - list_for_each_entry(sta, &ap->sta_list, list) { - if (!sta->ap) - continue; + if (!sta->ap) + return 0; - p += sprintf(p, "%pM %d %d %d %d '", - sta->addr, - sta->u.ap.channel, sta->last_rx_signal, - sta->last_rx_silence, sta->last_rx_rate); - for (i = 0; i < sta->u.ap.ssid_len; i++) - p += sprintf(p, ((sta->u.ap.ssid[i] >= 32 && - sta->u.ap.ssid[i] < 127) ? - "%c" : "<%02x>"), - sta->u.ap.ssid[i]); - p += sprintf(p, "'"); - if (sta->capability & WLAN_CAPABILITY_ESS) - p += sprintf(p, " [ESS]"); - if (sta->capability & WLAN_CAPABILITY_IBSS) - p += sprintf(p, " [IBSS]"); - if (sta->capability & WLAN_CAPABILITY_PRIVACY) - p += sprintf(p, " [WEP]"); - p += sprintf(p, "\n"); - - if ((p - page) > PROC_LIMIT) { - printk(KERN_DEBUG "hostap: ap proc did not fit\n"); - break; - } - } - spin_unlock_bh(&ap->sta_table_lock); + seq_printf(m, "%pM %d %d %d %d '", + sta->addr, + sta->u.ap.channel, sta->last_rx_signal, + sta->last_rx_silence, sta->last_rx_rate); - if ((p - page) <= off) { - *eof = 1; - return 0; + for (i = 0; i < sta->u.ap.ssid_len; i++) { + if (sta->u.ap.ssid[i] >= 32 && sta->u.ap.ssid[i] < 127) + seq_putc(m, sta->u.ap.ssid[i]); + else + seq_printf(m, "<%02x>", sta->u.ap.ssid[i]); } - *start = page + off; + seq_putc(m, '\''); + if (sta->capability & WLAN_CAPABILITY_ESS) + seq_puts(m, " [ESS]"); + if (sta->capability & WLAN_CAPABILITY_IBSS) + seq_puts(m, " [IBSS]"); + if (sta->capability & WLAN_CAPABILITY_PRIVACY) + seq_puts(m, " [WEP]"); + seq_putc(m, '\n'); + return 0; +} + +static void *prism2_ap_proc_start(struct seq_file *m, loff_t *_pos) +{ + struct ap_data *ap = m->private; + spin_lock_bh(&ap->sta_table_lock); + return seq_list_start_head(&ap->sta_list, *_pos); +} - return (p - page - off); +static void *prism2_ap_proc_next(struct seq_file *m, void *v, loff_t *_pos) +{ + struct ap_data *ap = m->private; + return seq_list_next(v, &ap->sta_list, _pos); } + +static void prism2_ap_proc_stop(struct seq_file *m, void *v) +{ + struct ap_data *ap = m->private; + spin_unlock_bh(&ap->sta_table_lock); +} + +static const struct seq_operations prism2_ap_proc_seqops = { + .start = prism2_ap_proc_start, + .next = prism2_ap_proc_next, + .stop = prism2_ap_proc_stop, + .show = prism2_ap_proc_show, +}; + +static int prism2_ap_proc_open(struct inode *inode, struct file *file) +{ + int ret = seq_open(file, &prism2_ap_proc_seqops); + if (ret == 0) { + struct seq_file *m = file->private_data; + m->private = PDE_DATA(inode); + } + return ret; +} + +static const struct file_operations prism2_ap_proc_fops = { + .open = prism2_ap_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ @@ -836,15 +895,12 @@ void hostap_init_ap_proc(local_info_t *local) return; #ifndef PRISM2_NO_PROCFS_DEBUG - create_proc_read_entry("ap_debug", 0, ap->proc, - ap_debug_proc_read, ap); + proc_create_data("ap_debug", 0, ap->proc, &ap_debug_proc_fops, ap); #endif /* PRISM2_NO_PROCFS_DEBUG */ #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - create_proc_read_entry("ap_control", 0, ap->proc, - ap_control_proc_read, ap); - create_proc_read_entry("ap", 0, ap->proc, - prism2_ap_proc_read, ap); + proc_create_data("ap_control", 0, ap->proc, &ap_control_proc_fops, ap); + proc_create_data("ap", 0, ap->proc, &prism2_ap_proc_fops, ap); #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ } @@ -982,79 +1038,86 @@ static void prism2_send_mgmt(struct net_device *dev, #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ -static int prism2_sta_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int prism2_sta_proc_show(struct seq_file *m, void *v) { - char *p = page; - struct sta_info *sta = (struct sta_info *) data; + struct sta_info *sta = m->private; int i; /* FIX: possible race condition.. the STA data could have just expired, * but proc entry was still here so that the read could have started; * some locking should be done here.. */ - if (off != 0) { - *eof = 1; - return 0; - } - - p += sprintf(p, "%s=%pM\nusers=%d\naid=%d\n" - "flags=0x%04x%s%s%s%s%s%s%s\n" - "capability=0x%02x\nlisten_interval=%d\nsupported_rates=", - sta->ap ? "AP" : "STA", - sta->addr, atomic_read(&sta->users), sta->aid, - sta->flags, - sta->flags & WLAN_STA_AUTH ? " AUTH" : "", - sta->flags & WLAN_STA_ASSOC ? " ASSOC" : "", - sta->flags & WLAN_STA_PS ? " PS" : "", - sta->flags & WLAN_STA_TIM ? " TIM" : "", - sta->flags & WLAN_STA_PERM ? " PERM" : "", - sta->flags & WLAN_STA_AUTHORIZED ? " AUTHORIZED" : "", - sta->flags & WLAN_STA_PENDING_POLL ? " POLL" : "", - sta->capability, sta->listen_interval); + seq_printf(m, + "%s=%pM\nusers=%d\naid=%d\n" + "flags=0x%04x%s%s%s%s%s%s%s\n" + "capability=0x%02x\nlisten_interval=%d\nsupported_rates=", + sta->ap ? "AP" : "STA", + sta->addr, atomic_read(&sta->users), sta->aid, + sta->flags, + sta->flags & WLAN_STA_AUTH ? " AUTH" : "", + sta->flags & WLAN_STA_ASSOC ? " ASSOC" : "", + sta->flags & WLAN_STA_PS ? " PS" : "", + sta->flags & WLAN_STA_TIM ? " TIM" : "", + sta->flags & WLAN_STA_PERM ? " PERM" : "", + sta->flags & WLAN_STA_AUTHORIZED ? " AUTHORIZED" : "", + sta->flags & WLAN_STA_PENDING_POLL ? " POLL" : "", + sta->capability, sta->listen_interval); /* supported_rates: 500 kbit/s units with msb ignored */ for (i = 0; i < sizeof(sta->supported_rates); i++) if (sta->supported_rates[i] != 0) - p += sprintf(p, "%d%sMbps ", - (sta->supported_rates[i] & 0x7f) / 2, - sta->supported_rates[i] & 1 ? ".5" : ""); - p += sprintf(p, "\njiffies=%lu\nlast_auth=%lu\nlast_assoc=%lu\n" - "last_rx=%lu\nlast_tx=%lu\nrx_packets=%lu\n" - "tx_packets=%lu\n" - "rx_bytes=%lu\ntx_bytes=%lu\nbuffer_count=%d\n" - "last_rx: silence=%d dBm signal=%d dBm rate=%d%s Mbps\n" - "tx_rate=%d\ntx[1M]=%d\ntx[2M]=%d\ntx[5.5M]=%d\n" - "tx[11M]=%d\n" - "rx[1M]=%d\nrx[2M]=%d\nrx[5.5M]=%d\nrx[11M]=%d\n", - jiffies, sta->last_auth, sta->last_assoc, sta->last_rx, - sta->last_tx, - sta->rx_packets, sta->tx_packets, sta->rx_bytes, - sta->tx_bytes, skb_queue_len(&sta->tx_buf), - sta->last_rx_silence, - sta->last_rx_signal, sta->last_rx_rate / 10, - sta->last_rx_rate % 10 ? ".5" : "", - sta->tx_rate, sta->tx_count[0], sta->tx_count[1], - sta->tx_count[2], sta->tx_count[3], sta->rx_count[0], - sta->rx_count[1], sta->rx_count[2], sta->rx_count[3]); + seq_printf(m, "%d%sMbps ", + (sta->supported_rates[i] & 0x7f) / 2, + sta->supported_rates[i] & 1 ? ".5" : ""); + seq_printf(m, + "\njiffies=%lu\nlast_auth=%lu\nlast_assoc=%lu\n" + "last_rx=%lu\nlast_tx=%lu\nrx_packets=%lu\n" + "tx_packets=%lu\n" + "rx_bytes=%lu\ntx_bytes=%lu\nbuffer_count=%d\n" + "last_rx: silence=%d dBm signal=%d dBm rate=%d%s Mbps\n" + "tx_rate=%d\ntx[1M]=%d\ntx[2M]=%d\ntx[5.5M]=%d\n" + "tx[11M]=%d\n" + "rx[1M]=%d\nrx[2M]=%d\nrx[5.5M]=%d\nrx[11M]=%d\n", + jiffies, sta->last_auth, sta->last_assoc, sta->last_rx, + sta->last_tx, + sta->rx_packets, sta->tx_packets, sta->rx_bytes, + sta->tx_bytes, skb_queue_len(&sta->tx_buf), + sta->last_rx_silence, + sta->last_rx_signal, sta->last_rx_rate / 10, + sta->last_rx_rate % 10 ? ".5" : "", + sta->tx_rate, sta->tx_count[0], sta->tx_count[1], + sta->tx_count[2], sta->tx_count[3], sta->rx_count[0], + sta->rx_count[1], sta->rx_count[2], sta->rx_count[3]); if (sta->crypt && sta->crypt->ops && sta->crypt->ops->print_stats) - p = sta->crypt->ops->print_stats(p, sta->crypt->priv); + sta->crypt->ops->print_stats(m, sta->crypt->priv); #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT if (sta->ap) { if (sta->u.ap.channel >= 0) - p += sprintf(p, "channel=%d\n", sta->u.ap.channel); - p += sprintf(p, "ssid="); - for (i = 0; i < sta->u.ap.ssid_len; i++) - p += sprintf(p, ((sta->u.ap.ssid[i] >= 32 && - sta->u.ap.ssid[i] < 127) ? - "%c" : "<%02x>"), - sta->u.ap.ssid[i]); - p += sprintf(p, "\n"); + seq_printf(m, "channel=%d\n", sta->u.ap.channel); + seq_puts(m, "ssid="); + for (i = 0; i < sta->u.ap.ssid_len; i++) { + if (sta->u.ap.ssid[i] >= 32 && sta->u.ap.ssid[i] < 127) + seq_putc(m, sta->u.ap.ssid[i]); + else + seq_printf(m, "<%02x>", sta->u.ap.ssid[i]); + } + seq_putc(m, '\n'); } #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - return (p - page); + return 0; +} + +static int prism2_sta_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, prism2_sta_proc_show, PDE_DATA(inode)); } +static const struct file_operations prism2_sta_proc_fops = { + .open = prism2_sta_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; static void handle_add_proc_queue(struct work_struct *work) { @@ -1076,9 +1139,9 @@ static void handle_add_proc_queue(struct work_struct *work) if (sta) { sprintf(name, "%pM", sta->addr); - sta->proc = create_proc_read_entry( + sta->proc = proc_create_data( name, 0, ap->proc, - prism2_sta_proc_read, sta); + &prism2_sta_proc_fops, sta); atomic_dec(&sta->users); } diff --git a/drivers/net/wireless/hostap/hostap_download.c b/drivers/net/wireless/hostap/hostap_download.c index e73bf73..705fe66 100644 --- a/drivers/net/wireless/hostap/hostap_download.c +++ b/drivers/net/wireless/hostap/hostap_download.c @@ -174,20 +174,70 @@ static int prism2_pda_ok(u8 *buf) } -static int prism2_download_aux_dump(struct net_device *dev, - unsigned int addr, int len, u8 *buf) -{ - int res; +#define prism2_download_aux_dump_npages 65536 - prism2_enable_aux_port(dev, 1); - res = hfa384x_from_aux(dev, addr, len, buf); - prism2_enable_aux_port(dev, 0); - if (res) - return -1; +struct prism2_download_aux_dump { + local_info_t *local; + u16 page[0x80]; +}; + +static int prism2_download_aux_dump_proc_show(struct seq_file *m, void *v) +{ + struct prism2_download_aux_dump *ctx = m->private; + hfa384x_from_aux(ctx->local->dev, (unsigned long)v - 1, 0x80, ctx->page); + seq_write(m, ctx->page, 0x80); return 0; } +static void *prism2_download_aux_dump_proc_start(struct seq_file *m, loff_t *_pos) +{ + struct prism2_download_aux_dump *ctx = m->private; + prism2_enable_aux_port(ctx->local->dev, 1); + if (*_pos >= prism2_download_aux_dump_npages) + return NULL; + return (void *)((unsigned long)*_pos + 1); +} + +static void *prism2_download_aux_dump_proc_next(struct seq_file *m, void *v, loff_t *_pos) +{ + ++*_pos; + if (*_pos >= prism2_download_aux_dump_npages) + return NULL; + return (void *)((unsigned long)*_pos + 1); +} + +static void prism2_download_aux_dump_proc_stop(struct seq_file *m, void *v) +{ + struct prism2_download_aux_dump *ctx = m->private; + prism2_enable_aux_port(ctx->local->dev, 0); +} + +static const struct seq_operations prism2_download_aux_dump_proc_seqops = { + .start = prism2_download_aux_dump_proc_start, + .next = prism2_download_aux_dump_proc_next, + .stop = prism2_download_aux_dump_proc_stop, + .show = prism2_download_aux_dump_proc_show, +}; + +static int prism2_download_aux_dump_proc_open(struct inode *inode, struct file *file) +{ + int ret = seq_open_private(file, &prism2_download_aux_dump_proc_seqops, + sizeof(struct prism2_download_aux_dump)); + if (ret == 0) { + struct seq_file *m = file->private_data; + m->private = PDE_DATA(inode); + } + return ret; +} + +static const struct file_operations prism2_download_aux_dump_proc_fops = { + .open = prism2_download_aux_dump_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release_private, +}; + static u8 * prism2_read_pda(struct net_device *dev) { diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 8e7000f..507ab99 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c @@ -38,6 +38,7 @@ #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/proc_fs.h> +#include <linux/seq_file.h> #include <linux/if_arp.h> #include <linux/delay.h> #include <linux/random.h> @@ -129,8 +130,7 @@ static void prism2_check_sta_fw_version(local_info_t *local); #ifdef PRISM2_DOWNLOAD_SUPPORT /* hostap_download.c */ -static int prism2_download_aux_dump(struct net_device *dev, - unsigned int addr, int len, u8 *buf); +static const struct file_operations prism2_download_aux_dump_proc_fops; static u8 * prism2_read_pda(struct net_device *dev); static int prism2_download(local_info_t *local, struct prism2_download_param *param); @@ -2894,19 +2894,12 @@ static void hostap_tick_timer(unsigned long data) #ifndef PRISM2_NO_PROCFS_DEBUG -static int prism2_registers_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int prism2_registers_proc_show(struct seq_file *m, void *v) { - char *p = page; - local_info_t *local = (local_info_t *) data; - - if (off != 0) { - *eof = 1; - return 0; - } + local_info_t *local = m->private; #define SHOW_REG(n) \ -p += sprintf(p, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF)) + seq_printf(m, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF)) SHOW_REG(CMD); SHOW_REG(PARAM0); @@ -2952,8 +2945,21 @@ p += sprintf(p, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF)) SHOW_REG(PCI_M1_CTL); #endif /* PRISM2_PCI */ - return (p - page); + return 0; } + +static int prism2_registers_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, prism2_registers_proc_show, PDE_DATA(inode)); +} + +static const struct file_operations prism2_registers_proc_fops = { + .open = prism2_registers_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; + #endif /* PRISM2_NO_PROCFS_DEBUG */ @@ -3128,7 +3134,7 @@ prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx, local->func->reset_port = prism2_reset_port; local->func->schedule_reset = prism2_schedule_reset; #ifdef PRISM2_DOWNLOAD_SUPPORT - local->func->read_aux = prism2_download_aux_dump; + local->func->read_aux_fops = &prism2_download_aux_dump_proc_fops; local->func->download = prism2_download; #endif /* PRISM2_DOWNLOAD_SUPPORT */ local->func->tx = prism2_tx_80211; @@ -3274,8 +3280,8 @@ static int hostap_hw_ready(struct net_device *dev) } hostap_init_proc(local); #ifndef PRISM2_NO_PROCFS_DEBUG - create_proc_read_entry("registers", 0, local->proc, - prism2_registers_proc_read, local); + proc_create_data("registers", 0, local->proc, + &prism2_registers_proc_fops, local); #endif /* PRISM2_NO_PROCFS_DEBUG */ hostap_init_ap_proc(local); return 0; diff --git a/drivers/net/wireless/hostap/hostap_proc.c b/drivers/net/wireless/hostap/hostap_proc.c index dc447c1..7491dab 100644 --- a/drivers/net/wireless/hostap/hostap_proc.c +++ b/drivers/net/wireless/hostap/hostap_proc.c @@ -12,259 +12,297 @@ #ifndef PRISM2_NO_PROCFS_DEBUG -static int prism2_debug_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int prism2_debug_proc_show(struct seq_file *m, void *v) { - char *p = page; - local_info_t *local = (local_info_t *) data; + local_info_t *local = m->private; int i; - if (off != 0) { - *eof = 1; - return 0; - } - - p += sprintf(p, "next_txfid=%d next_alloc=%d\n", - local->next_txfid, local->next_alloc); + seq_printf(m, "next_txfid=%d next_alloc=%d\n", + local->next_txfid, local->next_alloc); for (i = 0; i < PRISM2_TXFID_COUNT; i++) - p += sprintf(p, "FID: tx=%04X intransmit=%04X\n", - local->txfid[i], local->intransmitfid[i]); - p += sprintf(p, "FW TX rate control: %d\n", local->fw_tx_rate_control); - p += sprintf(p, "beacon_int=%d\n", local->beacon_int); - p += sprintf(p, "dtim_period=%d\n", local->dtim_period); - p += sprintf(p, "wds_max_connections=%d\n", - local->wds_max_connections); - p += sprintf(p, "dev_enabled=%d\n", local->dev_enabled); - p += sprintf(p, "sw_tick_stuck=%d\n", local->sw_tick_stuck); + seq_printf(m, "FID: tx=%04X intransmit=%04X\n", + local->txfid[i], local->intransmitfid[i]); + seq_printf(m, "FW TX rate control: %d\n", local->fw_tx_rate_control); + seq_printf(m, "beacon_int=%d\n", local->beacon_int); + seq_printf(m, "dtim_period=%d\n", local->dtim_period); + seq_printf(m, "wds_max_connections=%d\n", local->wds_max_connections); + seq_printf(m, "dev_enabled=%d\n", local->dev_enabled); + seq_printf(m, "sw_tick_stuck=%d\n", local->sw_tick_stuck); for (i = 0; i < WEP_KEYS; i++) { if (local->crypt_info.crypt[i] && local->crypt_info.crypt[i]->ops) { - p += sprintf(p, "crypt[%d]=%s\n", i, - local->crypt_info.crypt[i]->ops->name); + seq_printf(m, "crypt[%d]=%s\n", i, + local->crypt_info.crypt[i]->ops->name); } } - p += sprintf(p, "pri_only=%d\n", local->pri_only); - p += sprintf(p, "pci=%d\n", local->func->hw_type == HOSTAP_HW_PCI); - p += sprintf(p, "sram_type=%d\n", local->sram_type); - p += sprintf(p, "no_pri=%d\n", local->no_pri); + seq_printf(m, "pri_only=%d\n", local->pri_only); + seq_printf(m, "pci=%d\n", local->func->hw_type == HOSTAP_HW_PCI); + seq_printf(m, "sram_type=%d\n", local->sram_type); + seq_printf(m, "no_pri=%d\n", local->no_pri); - return (p - page); + return 0; } + +static int prism2_debug_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, prism2_debug_proc_show, PDE_DATA(inode)); +} + +static const struct file_operations prism2_debug_proc_fops = { + .open = prism2_debug_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; #endif /* PRISM2_NO_PROCFS_DEBUG */ -static int prism2_stats_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int prism2_stats_proc_show(struct seq_file *m, void *v) { - char *p = page; - local_info_t *local = (local_info_t *) data; + local_info_t *local = m->private; struct comm_tallies_sums *sums = &local->comm_tallies; - if (off != 0) { - *eof = 1; - return 0; - } - - p += sprintf(p, "TxUnicastFrames=%u\n", sums->tx_unicast_frames); - p += sprintf(p, "TxMulticastframes=%u\n", sums->tx_multicast_frames); - p += sprintf(p, "TxFragments=%u\n", sums->tx_fragments); - p += sprintf(p, "TxUnicastOctets=%u\n", sums->tx_unicast_octets); - p += sprintf(p, "TxMulticastOctets=%u\n", sums->tx_multicast_octets); - p += sprintf(p, "TxDeferredTransmissions=%u\n", - sums->tx_deferred_transmissions); - p += sprintf(p, "TxSingleRetryFrames=%u\n", - sums->tx_single_retry_frames); - p += sprintf(p, "TxMultipleRetryFrames=%u\n", - sums->tx_multiple_retry_frames); - p += sprintf(p, "TxRetryLimitExceeded=%u\n", - sums->tx_retry_limit_exceeded); - p += sprintf(p, "TxDiscards=%u\n", sums->tx_discards); - p += sprintf(p, "RxUnicastFrames=%u\n", sums->rx_unicast_frames); - p += sprintf(p, "RxMulticastFrames=%u\n", sums->rx_multicast_frames); - p += sprintf(p, "RxFragments=%u\n", sums->rx_fragments); - p += sprintf(p, "RxUnicastOctets=%u\n", sums->rx_unicast_octets); - p += sprintf(p, "RxMulticastOctets=%u\n", sums->rx_multicast_octets); - p += sprintf(p, "RxFCSErrors=%u\n", sums->rx_fcs_errors); - p += sprintf(p, "RxDiscardsNoBuffer=%u\n", - sums->rx_discards_no_buffer); - p += sprintf(p, "TxDiscardsWrongSA=%u\n", sums->tx_discards_wrong_sa); - p += sprintf(p, "RxDiscardsWEPUndecryptable=%u\n", - sums->rx_discards_wep_undecryptable); - p += sprintf(p, "RxMessageInMsgFragments=%u\n", - sums->rx_message_in_msg_fragments); - p += sprintf(p, "RxMessageInBadMsgFragments=%u\n", - sums->rx_message_in_bad_msg_fragments); + seq_printf(m, "TxUnicastFrames=%u\n", sums->tx_unicast_frames); + seq_printf(m, "TxMulticastframes=%u\n", sums->tx_multicast_frames); + seq_printf(m, "TxFragments=%u\n", sums->tx_fragments); + seq_printf(m, "TxUnicastOctets=%u\n", sums->tx_unicast_octets); + seq_printf(m, "TxMulticastOctets=%u\n", sums->tx_multicast_octets); + seq_printf(m, "TxDeferredTransmissions=%u\n", + sums->tx_deferred_transmissions); + seq_printf(m, "TxSingleRetryFrames=%u\n", sums->tx_single_retry_frames); + seq_printf(m, "TxMultipleRetryFrames=%u\n", + sums->tx_multiple_retry_frames); + seq_printf(m, "TxRetryLimitExceeded=%u\n", + sums->tx_retry_limit_exceeded); + seq_printf(m, "TxDiscards=%u\n", sums->tx_discards); + seq_printf(m, "RxUnicastFrames=%u\n", sums->rx_unicast_frames); + seq_printf(m, "RxMulticastFrames=%u\n", sums->rx_multicast_frames); + seq_printf(m, "RxFragments=%u\n", sums->rx_fragments); + seq_printf(m, "RxUnicastOctets=%u\n", sums->rx_unicast_octets); + seq_printf(m, "RxMulticastOctets=%u\n", sums->rx_multicast_octets); + seq_printf(m, "RxFCSErrors=%u\n", sums->rx_fcs_errors); + seq_printf(m, "RxDiscardsNoBuffer=%u\n", sums->rx_discards_no_buffer); + seq_printf(m, "TxDiscardsWrongSA=%u\n", sums->tx_discards_wrong_sa); + seq_printf(m, "RxDiscardsWEPUndecryptable=%u\n", + sums->rx_discards_wep_undecryptable); + seq_printf(m, "RxMessageInMsgFragments=%u\n", + sums->rx_message_in_msg_fragments); + seq_printf(m, "RxMessageInBadMsgFragments=%u\n", + sums->rx_message_in_bad_msg_fragments); /* FIX: this may grow too long for one page(?) */ - return (p - page); + return 0; +} + +static int prism2_stats_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, prism2_stats_proc_show, PDE_DATA(inode)); } +static const struct file_operations prism2_stats_proc_fops = { + .open = prism2_stats_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; -static int prism2_wds_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) + +static int prism2_wds_proc_show(struct seq_file *m, void *v) { - char *p = page; - local_info_t *local = (local_info_t *) data; - struct list_head *ptr; + struct list_head *ptr = v; struct hostap_interface *iface; - if (off > PROC_LIMIT) { - *eof = 1; - return 0; - } + iface = list_entry(ptr, struct hostap_interface, list); + if (iface->type == HOSTAP_INTERFACE_WDS) + seq_printf(m, "%s\t%pM\n", + iface->dev->name, iface->u.wds.remote_addr); + return 0; +} +static void *prism2_wds_proc_start(struct seq_file *m, loff_t *_pos) +{ + local_info_t *local = m->private; read_lock_bh(&local->iface_lock); - list_for_each(ptr, &local->hostap_interfaces) { - iface = list_entry(ptr, struct hostap_interface, list); - if (iface->type != HOSTAP_INTERFACE_WDS) - continue; - p += sprintf(p, "%s\t%pM\n", - iface->dev->name, - iface->u.wds.remote_addr); - if ((p - page) > PROC_LIMIT) { - printk(KERN_DEBUG "%s: wds proc did not fit\n", - local->dev->name); - break; - } - } - read_unlock_bh(&local->iface_lock); + return seq_list_start(&local->hostap_interfaces, *_pos); +} - if ((p - page) <= off) { - *eof = 1; - return 0; - } +static void *prism2_wds_proc_next(struct seq_file *m, void *v, loff_t *_pos) +{ + local_info_t *local = m->private; + return seq_list_next(v, &local->hostap_interfaces, _pos); +} - *start = page + off; +static void prism2_wds_proc_stop(struct seq_file *m, void *v) +{ + local_info_t *local = m->private; + read_unlock_bh(&local->iface_lock); +} - return (p - page - off); +static const struct seq_operations prism2_wds_proc_seqops = { + .start = prism2_wds_proc_start, + .next = prism2_wds_proc_next, + .stop = prism2_wds_proc_stop, + .show = prism2_wds_proc_show, +}; + +static int prism2_wds_proc_open(struct inode *inode, struct file *file) +{ + int ret = seq_open(file, &prism2_wds_proc_seqops); + if (ret == 0) { + struct seq_file *m = file->private_data; + m->private = PDE_DATA(inode); + } + return ret; } +static const struct file_operations prism2_wds_proc_fops = { + .open = prism2_wds_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; -static int prism2_bss_list_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) + +static int prism2_bss_list_proc_show(struct seq_file *m, void *v) { - char *p = page; - local_info_t *local = (local_info_t *) data; - struct list_head *ptr; + local_info_t *local = m->private; + struct list_head *ptr = v; struct hostap_bss_info *bss; int i; - if (off > PROC_LIMIT) { - *eof = 1; + if (ptr == &local->bss_list) { + seq_printf(m, "#BSSID\tlast_update\tcount\tcapab_info\tSSID(txt)\t" + "SSID(hex)\tWPA IE\n"); return 0; } - p += sprintf(p, "#BSSID\tlast_update\tcount\tcapab_info\tSSID(txt)\t" - "SSID(hex)\tWPA IE\n"); + bss = list_entry(ptr, struct hostap_bss_info, list); + seq_printf(m, "%pM\t%lu\t%u\t0x%x\t", + bss->bssid, bss->last_update, + bss->count, bss->capab_info); + + for (i = 0; i < bss->ssid_len; i++) + seq_putc(m,bss->ssid[i] >= 32 && bss->ssid[i] < 127 ? + bss->ssid[i] : '_'); + + seq_putc(m, '\t'); + for (i = 0; i < bss->ssid_len; i++) + seq_printf(m, "%02x", bss->ssid[i]); + seq_putc(m, '\t'); + for (i = 0; i < bss->wpa_ie_len; i++) + seq_printf(m, "%02x", bss->wpa_ie[i]); + seq_putc(m, '\n'); + return 0; +} + +static void *prism2_bss_list_proc_start(struct seq_file *m, loff_t *_pos) +{ + local_info_t *local = m->private; spin_lock_bh(&local->lock); - list_for_each(ptr, &local->bss_list) { - bss = list_entry(ptr, struct hostap_bss_info, list); - p += sprintf(p, "%pM\t%lu\t%u\t0x%x\t", - bss->bssid, bss->last_update, - bss->count, bss->capab_info); - for (i = 0; i < bss->ssid_len; i++) { - p += sprintf(p, "%c", - bss->ssid[i] >= 32 && bss->ssid[i] < 127 ? - bss->ssid[i] : '_'); - } - p += sprintf(p, "\t"); - for (i = 0; i < bss->ssid_len; i++) { - p += sprintf(p, "%02x", bss->ssid[i]); - } - p += sprintf(p, "\t"); - for (i = 0; i < bss->wpa_ie_len; i++) { - p += sprintf(p, "%02x", bss->wpa_ie[i]); - } - p += sprintf(p, "\n"); - if ((p - page) > PROC_LIMIT) { - printk(KERN_DEBUG "%s: BSS proc did not fit\n", - local->dev->name); - break; - } - } - spin_unlock_bh(&local->lock); + return seq_list_start_head(&local->bss_list, *_pos); +} - if ((p - page) <= off) { - *eof = 1; - return 0; - } +static void *prism2_bss_list_proc_next(struct seq_file *m, void *v, loff_t *_pos) +{ + local_info_t *local = m->private; + return seq_list_next(v, &local->bss_list, _pos); +} - *start = page + off; +static void prism2_bss_list_proc_stop(struct seq_file *m, void *v) +{ + local_info_t *local = m->private; + spin_unlock_bh(&local->lock); +} + +static const struct seq_operations prism2_bss_list_proc_seqops = { + .start = prism2_bss_list_proc_start, + .next = prism2_bss_list_proc_next, + .stop = prism2_bss_list_proc_stop, + .show = prism2_bss_list_proc_show, +}; - return (p - page - off); +static int prism2_bss_list_proc_open(struct inode *inode, struct file *file) +{ + int ret = seq_open(file, &prism2_bss_list_proc_seqops); + if (ret == 0) { + struct seq_file *m = file->private_data; + m->private = PDE_DATA(inode); + } + return ret; } +static const struct file_operations prism2_bss_list_proc_fops = { + .open = prism2_bss_list_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; -static int prism2_crypt_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) + +static int prism2_crypt_proc_show(struct seq_file *m, void *v) { - char *p = page; - local_info_t *local = (local_info_t *) data; + local_info_t *local = m->private; int i; - if (off > PROC_LIMIT) { - *eof = 1; - return 0; - } - - p += sprintf(p, "tx_keyidx=%d\n", local->crypt_info.tx_keyidx); + seq_printf(m, "tx_keyidx=%d\n", local->crypt_info.tx_keyidx); for (i = 0; i < WEP_KEYS; i++) { if (local->crypt_info.crypt[i] && local->crypt_info.crypt[i]->ops && local->crypt_info.crypt[i]->ops->print_stats) { - p = local->crypt_info.crypt[i]->ops->print_stats( - p, local->crypt_info.crypt[i]->priv); + local->crypt_info.crypt[i]->ops->print_stats( + m, local->crypt_info.crypt[i]->priv); } } + return 0; +} - if ((p - page) <= off) { - *eof = 1; - return 0; - } - - *start = page + off; - - return (p - page - off); +static int prism2_crypt_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, prism2_crypt_proc_show, PDE_DATA(inode)); } +static const struct file_operations prism2_crypt_proc_fops = { + .open = prism2_crypt_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; -static int prism2_pda_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) + +static ssize_t prism2_pda_proc_read(struct file *file, char __user *buf, + size_t count, loff_t *_pos) { - local_info_t *local = (local_info_t *) data; + local_info_t *local = PDE_DATA(file_inode(file)); + size_t off; - if (local->pda == NULL || off >= PRISM2_PDA_SIZE) { - *eof = 1; + if (local->pda == NULL || *_pos >= PRISM2_PDA_SIZE) return 0; - } - if (off + count > PRISM2_PDA_SIZE) + off = *_pos; + if (count > PRISM2_PDA_SIZE - off) count = PRISM2_PDA_SIZE - off; - - memcpy(page, local->pda + off, count); + if (copy_to_user(buf, local->pda + off, count) != 0) + return -EFAULT; + *_pos += count; return count; } +static const struct file_operations prism2_pda_proc_fops = { + .read = prism2_pda_proc_read, + .llseek = generic_file_llseek, +}; -static int prism2_aux_dump_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - local_info_t *local = (local_info_t *) data; - - if (local->func->read_aux == NULL) { - *eof = 1; - return 0; - } - if (local->func->read_aux(local->dev, off, count, page)) { - *eof = 1; - return 0; - } - *start = page; - - return count; +static ssize_t prism2_aux_dump_proc_no_read(struct file *file, char __user *buf, + size_t bufsize, loff_t *_pos) +{ + return 0; } +static const struct file_operations prism2_aux_dump_proc_fops = { + .read = prism2_aux_dump_proc_no_read, +}; + #ifdef PRISM2_IO_DEBUG static int prism2_io_debug_proc_read(char *page, char **start, off_t off, @@ -306,82 +344,108 @@ static int prism2_io_debug_proc_read(char *page, char **start, off_t off, #ifndef PRISM2_NO_STATION_MODES -static int prism2_scan_results_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int prism2_scan_results_proc_show(struct seq_file *m, void *v) { - char *p = page; - local_info_t *local = (local_info_t *) data; - int entry, i, len, total = 0; + local_info_t *local = m->private; + unsigned long entry; + int i, len; struct hfa384x_hostscan_result *scanres; - u8 *pos; + u8 *p; - p += sprintf(p, "CHID ANL SL BcnInt Capab Rate BSSID ATIM SupRates " - "SSID\n"); + if (v == SEQ_START_TOKEN) { + seq_printf(m, + "CHID ANL SL BcnInt Capab Rate BSSID ATIM SupRates SSID\n"); + return 0; + } + entry = (unsigned long)v - 2; + scanres = &local->last_scan_results[entry]; + + seq_printf(m, "%d %d %d %d 0x%02x %d %pM %d ", + le16_to_cpu(scanres->chid), + (s16) le16_to_cpu(scanres->anl), + (s16) le16_to_cpu(scanres->sl), + le16_to_cpu(scanres->beacon_interval), + le16_to_cpu(scanres->capability), + le16_to_cpu(scanres->rate), + scanres->bssid, + le16_to_cpu(scanres->atim)); + + p = scanres->sup_rates; + for (i = 0; i < sizeof(scanres->sup_rates); i++) { + if (p[i] == 0) + break; + seq_printf(m, "<%02x>", p[i]); + } + seq_putc(m, ' '); + + p = scanres->ssid; + len = le16_to_cpu(scanres->ssid_len); + if (len > 32) + len = 32; + for (i = 0; i < len; i++) { + unsigned char c = p[i]; + if (c >= 32 && c < 127) + seq_putc(m, c); + else + seq_printf(m, "<%02x>", c); + } + seq_putc(m, '\n'); + return 0; +} + +static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos) +{ + local_info_t *local = m->private; spin_lock_bh(&local->lock); - for (entry = 0; entry < local->last_scan_results_count; entry++) { - scanres = &local->last_scan_results[entry]; - if (total + (p - page) <= off) { - total += p - page; - p = page; - } - if (total + (p - page) > off + count) - break; - if ((p - page) > (PAGE_SIZE - 200)) - break; + /* We have a header (pos 0) + N results to show (pos 1...N) */ + if (*_pos > local->last_scan_results_count) + return NULL; + return (void *)(unsigned long)(*_pos + 1); /* 0 would be EOF */ +} - p += sprintf(p, "%d %d %d %d 0x%02x %d %pM %d ", - le16_to_cpu(scanres->chid), - (s16) le16_to_cpu(scanres->anl), - (s16) le16_to_cpu(scanres->sl), - le16_to_cpu(scanres->beacon_interval), - le16_to_cpu(scanres->capability), - le16_to_cpu(scanres->rate), - scanres->bssid, - le16_to_cpu(scanres->atim)); - - pos = scanres->sup_rates; - for (i = 0; i < sizeof(scanres->sup_rates); i++) { - if (pos[i] == 0) - break; - p += sprintf(p, "<%02x>", pos[i]); - } - p += sprintf(p, " "); - - pos = scanres->ssid; - len = le16_to_cpu(scanres->ssid_len); - if (len > 32) - len = 32; - for (i = 0; i < len; i++) { - unsigned char c = pos[i]; - if (c >= 32 && c < 127) - p += sprintf(p, "%c", c); - else - p += sprintf(p, "<%02x>", c); - } - p += sprintf(p, "\n"); - } +static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t *_pos) +{ + local_info_t *local = m->private; + + ++*_pos; + if (*_pos > local->last_scan_results_count) + return NULL; + return (void *)(unsigned long)(*_pos + 1); /* 0 would be EOF */ +} + +static void prism2_scan_results_proc_stop(struct seq_file *m, void *v) +{ + local_info_t *local = m->private; spin_unlock_bh(&local->lock); +} - total += (p - page); - if (total >= off + count) - *eof = 1; +static const struct seq_operations prism2_scan_results_proc_seqops = { + .start = prism2_scan_results_proc_start, + .next = prism2_scan_results_proc_next, + .stop = prism2_scan_results_proc_stop, + .show = prism2_scan_results_proc_show, +}; - if (total < off) { - *eof = 1; - return 0; +static int prism2_scan_results_proc_open(struct inode *inode, struct file *file) +{ + int ret = seq_open(file, &prism2_scan_results_proc_seqops); + if (ret == 0) { + struct seq_file *m = file->private_data; + m->private = PDE_DATA(inode); } + return ret; +} + +static const struct file_operations prism2_scan_results_proc_fops = { + .open = prism2_scan_results_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; - len = total - off; - if (len > (p - page)) - len = p - page; - *start = p - len; - if (len > count) - len = count; - return len; -} #endif /* PRISM2_NO_STATION_MODES */ @@ -403,53 +467,36 @@ void hostap_init_proc(local_info_t *local) } #ifndef PRISM2_NO_PROCFS_DEBUG - create_proc_read_entry("debug", 0, local->proc, - prism2_debug_proc_read, local); + proc_create_data("debug", 0, local->proc, + &prism2_debug_proc_fops, local); #endif /* PRISM2_NO_PROCFS_DEBUG */ - create_proc_read_entry("stats", 0, local->proc, - prism2_stats_proc_read, local); - create_proc_read_entry("wds", 0, local->proc, - prism2_wds_proc_read, local); - create_proc_read_entry("pda", 0, local->proc, - prism2_pda_proc_read, local); - create_proc_read_entry("aux_dump", 0, local->proc, - prism2_aux_dump_proc_read, local); - create_proc_read_entry("bss_list", 0, local->proc, - prism2_bss_list_proc_read, local); - create_proc_read_entry("crypt", 0, local->proc, - prism2_crypt_proc_read, local); + proc_create_data("stats", 0, local->proc, + &prism2_stats_proc_fops, local); + proc_create_data("wds", 0, local->proc, + &prism2_wds_proc_fops, local); + proc_create_data("pda", 0, local->proc, + &prism2_pda_proc_fops, local); + proc_create_data("aux_dump", 0, local->proc, + local->func->read_aux_fops ?: &prism2_aux_dump_proc_fops, + local); + proc_create_data("bss_list", 0, local->proc, + &prism2_bss_list_proc_fops, local); + proc_create_data("crypt", 0, local->proc, + &prism2_crypt_proc_fops, local); #ifdef PRISM2_IO_DEBUG - create_proc_read_entry("io_debug", 0, local->proc, - prism2_io_debug_proc_read, local); + proc_create_data("io_debug", 0, local->proc, + &prism2_io_debug_proc_fops, local); #endif /* PRISM2_IO_DEBUG */ #ifndef PRISM2_NO_STATION_MODES - create_proc_read_entry("scan_results", 0, local->proc, - prism2_scan_results_proc_read, local); + proc_create_data("scan_results", 0, local->proc, + &prism2_scan_results_proc_fops, local); #endif /* PRISM2_NO_STATION_MODES */ } void hostap_remove_proc(local_info_t *local) { - if (local->proc != NULL) { -#ifndef PRISM2_NO_STATION_MODES - remove_proc_entry("scan_results", local->proc); -#endif /* PRISM2_NO_STATION_MODES */ -#ifdef PRISM2_IO_DEBUG - remove_proc_entry("io_debug", local->proc); -#endif /* PRISM2_IO_DEBUG */ - remove_proc_entry("pda", local->proc); - remove_proc_entry("aux_dump", local->proc); - remove_proc_entry("wds", local->proc); - remove_proc_entry("stats", local->proc); - remove_proc_entry("bss_list", local->proc); - remove_proc_entry("crypt", local->proc); -#ifndef PRISM2_NO_PROCFS_DEBUG - remove_proc_entry("debug", local->proc); -#endif /* PRISM2_NO_PROCFS_DEBUG */ - if (hostap_proc != NULL) - remove_proc_entry(local->proc->name, hostap_proc); - } + remove_proc_subtree(local->ddev->name, hostap_proc); } diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h index 7bb0b4b..5790401 100644 --- a/drivers/net/wireless/hostap/hostap_wlan.h +++ b/drivers/net/wireless/hostap/hostap_wlan.h @@ -596,8 +596,7 @@ struct prism2_helper_functions { struct prism2_download_param *param); int (*tx)(struct sk_buff *skb, struct net_device *dev); int (*set_tim)(struct net_device *dev, int aid, int set); - int (*read_aux)(struct net_device *dev, unsigned addr, int len, - u8 *buf); + const struct file_operations *read_aux_fops; int need_tx_headroom; /* number of bytes of headroom needed before * IEEE 802.11 header */ diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index ebada81..9b557a1 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -2778,7 +2778,7 @@ static ssize_t int_proc_write(struct file *file, const char __user *buffer, nr = nr * 10 + c; p++; } while (--len); - *(int *)PDE(file_inode(file))->data = nr; + *(int *)PDE_DATA(file_inode(file)) = nr; return count; } |