Commit d5126959 authored by Christoph Hellwig's avatar Christoph Hellwig

hostap: switch to proc_create_{seq,single}_data

And use proc private data directly instead of doing a detour
through seq->private.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 7ceed065
...@@ -69,7 +69,7 @@ static void prism2_send_mgmt(struct net_device *dev, ...@@ -69,7 +69,7 @@ static void prism2_send_mgmt(struct net_device *dev,
#ifndef PRISM2_NO_PROCFS_DEBUG #ifndef PRISM2_NO_PROCFS_DEBUG
static int ap_debug_proc_show(struct seq_file *m, void *v) static int ap_debug_proc_show(struct seq_file *m, void *v)
{ {
struct ap_data *ap = m->private; struct ap_data *ap = PDE_DATA(file_inode(m->file));
seq_printf(m, "BridgedUnicastFrames=%u\n", ap->bridged_unicast); seq_printf(m, "BridgedUnicastFrames=%u\n", ap->bridged_unicast);
seq_printf(m, "BridgedMulticastFrames=%u\n", ap->bridged_multicast); seq_printf(m, "BridgedMulticastFrames=%u\n", ap->bridged_multicast);
...@@ -81,18 +81,6 @@ static int ap_debug_proc_show(struct seq_file *m, void *v) ...@@ -81,18 +81,6 @@ static int ap_debug_proc_show(struct seq_file *m, void *v)
seq_printf(m, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc); seq_printf(m, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc);
return 0; return 0;
} }
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 = single_release,
};
#endif /* PRISM2_NO_PROCFS_DEBUG */ #endif /* PRISM2_NO_PROCFS_DEBUG */
...@@ -333,7 +321,7 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap, ...@@ -333,7 +321,7 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap,
static int ap_control_proc_show(struct seq_file *m, void *v) static int ap_control_proc_show(struct seq_file *m, void *v)
{ {
struct ap_data *ap = m->private; struct ap_data *ap = PDE_DATA(file_inode(m->file));
char *policy_txt; char *policy_txt;
struct mac_entry *entry; struct mac_entry *entry;
...@@ -365,20 +353,20 @@ static int ap_control_proc_show(struct seq_file *m, void *v) ...@@ -365,20 +353,20 @@ static int ap_control_proc_show(struct seq_file *m, void *v)
static void *ap_control_proc_start(struct seq_file *m, loff_t *_pos) static void *ap_control_proc_start(struct seq_file *m, loff_t *_pos)
{ {
struct ap_data *ap = m->private; struct ap_data *ap = PDE_DATA(file_inode(m->file));
spin_lock_bh(&ap->mac_restrictions.lock); spin_lock_bh(&ap->mac_restrictions.lock);
return seq_list_start_head(&ap->mac_restrictions.mac_list, *_pos); return seq_list_start_head(&ap->mac_restrictions.mac_list, *_pos);
} }
static void *ap_control_proc_next(struct seq_file *m, void *v, loff_t *_pos) static void *ap_control_proc_next(struct seq_file *m, void *v, loff_t *_pos)
{ {
struct ap_data *ap = m->private; struct ap_data *ap = PDE_DATA(file_inode(m->file));
return seq_list_next(v, &ap->mac_restrictions.mac_list, _pos); return seq_list_next(v, &ap->mac_restrictions.mac_list, _pos);
} }
static void ap_control_proc_stop(struct seq_file *m, void *v) static void ap_control_proc_stop(struct seq_file *m, void *v)
{ {
struct ap_data *ap = m->private; struct ap_data *ap = PDE_DATA(file_inode(m->file));
spin_unlock_bh(&ap->mac_restrictions.lock); spin_unlock_bh(&ap->mac_restrictions.lock);
} }
...@@ -389,24 +377,6 @@ static const struct seq_operations ap_control_proc_seqops = { ...@@ -389,24 +377,6 @@ static const struct seq_operations ap_control_proc_seqops = {
.show = ap_control_proc_show, .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) int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac)
{ {
struct mac_entry *entry; struct mac_entry *entry;
...@@ -585,20 +555,20 @@ static int prism2_ap_proc_show(struct seq_file *m, void *v) ...@@ -585,20 +555,20 @@ static int prism2_ap_proc_show(struct seq_file *m, void *v)
static void *prism2_ap_proc_start(struct seq_file *m, loff_t *_pos) static void *prism2_ap_proc_start(struct seq_file *m, loff_t *_pos)
{ {
struct ap_data *ap = m->private; struct ap_data *ap = PDE_DATA(file_inode(m->file));
spin_lock_bh(&ap->sta_table_lock); spin_lock_bh(&ap->sta_table_lock);
return seq_list_start_head(&ap->sta_list, *_pos); return seq_list_start_head(&ap->sta_list, *_pos);
} }
static void *prism2_ap_proc_next(struct seq_file *m, void *v, loff_t *_pos) static void *prism2_ap_proc_next(struct seq_file *m, void *v, loff_t *_pos)
{ {
struct ap_data *ap = m->private; struct ap_data *ap = PDE_DATA(file_inode(m->file));
return seq_list_next(v, &ap->sta_list, _pos); return seq_list_next(v, &ap->sta_list, _pos);
} }
static void prism2_ap_proc_stop(struct seq_file *m, void *v) static void prism2_ap_proc_stop(struct seq_file *m, void *v)
{ {
struct ap_data *ap = m->private; struct ap_data *ap = PDE_DATA(file_inode(m->file));
spin_unlock_bh(&ap->sta_table_lock); spin_unlock_bh(&ap->sta_table_lock);
} }
...@@ -608,23 +578,6 @@ static const struct seq_operations prism2_ap_proc_seqops = { ...@@ -608,23 +578,6 @@ static const struct seq_operations prism2_ap_proc_seqops = {
.stop = prism2_ap_proc_stop, .stop = prism2_ap_proc_stop,
.show = prism2_ap_proc_show, .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 */ #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
...@@ -896,12 +849,13 @@ void hostap_init_ap_proc(local_info_t *local) ...@@ -896,12 +849,13 @@ void hostap_init_ap_proc(local_info_t *local)
return; return;
#ifndef PRISM2_NO_PROCFS_DEBUG #ifndef PRISM2_NO_PROCFS_DEBUG
proc_create_data("ap_debug", 0, ap->proc, &ap_debug_proc_fops, ap); proc_create_single_data("ap_debug", 0, ap->proc, ap_debug_proc_show, ap);
#endif /* PRISM2_NO_PROCFS_DEBUG */ #endif /* PRISM2_NO_PROCFS_DEBUG */
#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
proc_create_data("ap_control", 0, ap->proc, &ap_control_proc_fops, ap); proc_create_seq_data("ap_control", 0, ap->proc, &ap_control_proc_seqops,
proc_create_data("ap", 0, ap->proc, &prism2_ap_proc_fops, ap); ap);
proc_create_seq_data("ap", 0, ap->proc, &prism2_ap_proc_seqops, ap);
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
} }
......
...@@ -2951,19 +2951,6 @@ static int prism2_registers_proc_show(struct seq_file *m, void *v) ...@@ -2951,19 +2951,6 @@ static int prism2_registers_proc_show(struct seq_file *m, void *v)
return 0; 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 = single_release,
};
#endif /* PRISM2_NO_PROCFS_DEBUG */ #endif /* PRISM2_NO_PROCFS_DEBUG */
...@@ -3279,8 +3266,8 @@ static int hostap_hw_ready(struct net_device *dev) ...@@ -3279,8 +3266,8 @@ static int hostap_hw_ready(struct net_device *dev)
} }
hostap_init_proc(local); hostap_init_proc(local);
#ifndef PRISM2_NO_PROCFS_DEBUG #ifndef PRISM2_NO_PROCFS_DEBUG
proc_create_data("registers", 0, local->proc, proc_create_single_data("registers", 0, local->proc,
&prism2_registers_proc_fops, local); prism2_registers_proc_show, local);
#endif /* PRISM2_NO_PROCFS_DEBUG */ #endif /* PRISM2_NO_PROCFS_DEBUG */
hostap_init_ap_proc(local); hostap_init_ap_proc(local);
return 0; return 0;
......
...@@ -43,18 +43,6 @@ static int prism2_debug_proc_show(struct seq_file *m, void *v) ...@@ -43,18 +43,6 @@ static int prism2_debug_proc_show(struct seq_file *m, void *v)
return 0; 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 = single_release,
};
#endif /* PRISM2_NO_PROCFS_DEBUG */ #endif /* PRISM2_NO_PROCFS_DEBUG */
...@@ -95,19 +83,6 @@ static int prism2_stats_proc_show(struct seq_file *m, void *v) ...@@ -95,19 +83,6 @@ static int prism2_stats_proc_show(struct seq_file *m, void *v)
return 0; 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 = single_release,
};
static int prism2_wds_proc_show(struct seq_file *m, void *v) static int prism2_wds_proc_show(struct seq_file *m, void *v)
{ {
struct list_head *ptr = v; struct list_head *ptr = v;
...@@ -122,20 +97,20 @@ static int prism2_wds_proc_show(struct seq_file *m, void *v) ...@@ -122,20 +97,20 @@ static int prism2_wds_proc_show(struct seq_file *m, void *v)
static void *prism2_wds_proc_start(struct seq_file *m, loff_t *_pos) static void *prism2_wds_proc_start(struct seq_file *m, loff_t *_pos)
{ {
local_info_t *local = m->private; local_info_t *local = PDE_DATA(file_inode(m->file));
read_lock_bh(&local->iface_lock); read_lock_bh(&local->iface_lock);
return seq_list_start(&local->hostap_interfaces, *_pos); return seq_list_start(&local->hostap_interfaces, *_pos);
} }
static void *prism2_wds_proc_next(struct seq_file *m, void *v, loff_t *_pos) static void *prism2_wds_proc_next(struct seq_file *m, void *v, loff_t *_pos)
{ {
local_info_t *local = m->private; local_info_t *local = PDE_DATA(file_inode(m->file));
return seq_list_next(v, &local->hostap_interfaces, _pos); return seq_list_next(v, &local->hostap_interfaces, _pos);
} }
static void prism2_wds_proc_stop(struct seq_file *m, void *v) static void prism2_wds_proc_stop(struct seq_file *m, void *v)
{ {
local_info_t *local = m->private; local_info_t *local = PDE_DATA(file_inode(m->file));
read_unlock_bh(&local->iface_lock); read_unlock_bh(&local->iface_lock);
} }
...@@ -146,27 +121,9 @@ static const struct seq_operations prism2_wds_proc_seqops = { ...@@ -146,27 +121,9 @@ static const struct seq_operations prism2_wds_proc_seqops = {
.show = prism2_wds_proc_show, .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_show(struct seq_file *m, void *v) static int prism2_bss_list_proc_show(struct seq_file *m, void *v)
{ {
local_info_t *local = m->private; local_info_t *local = PDE_DATA(file_inode(m->file));
struct list_head *ptr = v; struct list_head *ptr = v;
struct hostap_bss_info *bss; struct hostap_bss_info *bss;
...@@ -193,20 +150,20 @@ static int prism2_bss_list_proc_show(struct seq_file *m, void *v) ...@@ -193,20 +150,20 @@ static int prism2_bss_list_proc_show(struct seq_file *m, void *v)
static void *prism2_bss_list_proc_start(struct seq_file *m, loff_t *_pos) static void *prism2_bss_list_proc_start(struct seq_file *m, loff_t *_pos)
{ {
local_info_t *local = m->private; local_info_t *local = PDE_DATA(file_inode(m->file));
spin_lock_bh(&local->lock); spin_lock_bh(&local->lock);
return seq_list_start_head(&local->bss_list, *_pos); return seq_list_start_head(&local->bss_list, *_pos);
} }
static void *prism2_bss_list_proc_next(struct seq_file *m, void *v, loff_t *_pos) static void *prism2_bss_list_proc_next(struct seq_file *m, void *v, loff_t *_pos)
{ {
local_info_t *local = m->private; local_info_t *local = PDE_DATA(file_inode(m->file));
return seq_list_next(v, &local->bss_list, _pos); return seq_list_next(v, &local->bss_list, _pos);
} }
static void prism2_bss_list_proc_stop(struct seq_file *m, void *v) static void prism2_bss_list_proc_stop(struct seq_file *m, void *v)
{ {
local_info_t *local = m->private; local_info_t *local = PDE_DATA(file_inode(m->file));
spin_unlock_bh(&local->lock); spin_unlock_bh(&local->lock);
} }
...@@ -217,24 +174,6 @@ static const struct seq_operations prism2_bss_list_proc_seqops = { ...@@ -217,24 +174,6 @@ static const struct seq_operations prism2_bss_list_proc_seqops = {
.show = prism2_bss_list_proc_show, .show = prism2_bss_list_proc_show,
}; };
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_show(struct seq_file *m, void *v) static int prism2_crypt_proc_show(struct seq_file *m, void *v)
{ {
local_info_t *local = m->private; local_info_t *local = m->private;
...@@ -252,19 +191,6 @@ static int prism2_crypt_proc_show(struct seq_file *m, void *v) ...@@ -252,19 +191,6 @@ static int prism2_crypt_proc_show(struct seq_file *m, void *v)
return 0; return 0;
} }
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 = single_release,
};
static ssize_t prism2_pda_proc_read(struct file *file, char __user *buf, static ssize_t prism2_pda_proc_read(struct file *file, char __user *buf,
size_t count, loff_t *_pos) size_t count, loff_t *_pos)
{ {
...@@ -342,7 +268,7 @@ static int prism2_io_debug_proc_read(char *page, char **start, off_t off, ...@@ -342,7 +268,7 @@ static int prism2_io_debug_proc_read(char *page, char **start, off_t off,
#ifndef PRISM2_NO_STATION_MODES #ifndef PRISM2_NO_STATION_MODES
static int prism2_scan_results_proc_show(struct seq_file *m, void *v) static int prism2_scan_results_proc_show(struct seq_file *m, void *v)
{ {
local_info_t *local = m->private; local_info_t *local = PDE_DATA(file_inode(m->file));
unsigned long entry; unsigned long entry;
int i, len; int i, len;
struct hfa384x_hostscan_result *scanres; struct hfa384x_hostscan_result *scanres;
...@@ -392,7 +318,7 @@ static int prism2_scan_results_proc_show(struct seq_file *m, void *v) ...@@ -392,7 +318,7 @@ static int prism2_scan_results_proc_show(struct seq_file *m, void *v)
static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos) static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos)
{ {
local_info_t *local = m->private; local_info_t *local = PDE_DATA(file_inode(m->file));
spin_lock_bh(&local->lock); spin_lock_bh(&local->lock);
/* We have a header (pos 0) + N results to show (pos 1...N) */ /* We have a header (pos 0) + N results to show (pos 1...N) */
...@@ -403,7 +329,7 @@ static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos) ...@@ -403,7 +329,7 @@ static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos)
static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t *_pos) static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t *_pos)
{ {
local_info_t *local = m->private; local_info_t *local = PDE_DATA(file_inode(m->file));
++*_pos; ++*_pos;
if (*_pos > local->last_scan_results_count) if (*_pos > local->last_scan_results_count)
...@@ -413,7 +339,7 @@ static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t * ...@@ -413,7 +339,7 @@ static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t *
static void prism2_scan_results_proc_stop(struct seq_file *m, void *v) static void prism2_scan_results_proc_stop(struct seq_file *m, void *v)
{ {
local_info_t *local = m->private; local_info_t *local = PDE_DATA(file_inode(m->file));
spin_unlock_bh(&local->lock); spin_unlock_bh(&local->lock);
} }
...@@ -423,25 +349,6 @@ static const struct seq_operations prism2_scan_results_proc_seqops = { ...@@ -423,25 +349,6 @@ static const struct seq_operations prism2_scan_results_proc_seqops = {
.stop = prism2_scan_results_proc_stop, .stop = prism2_scan_results_proc_stop,
.show = prism2_scan_results_proc_show, .show = prism2_scan_results_proc_show,
}; };
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,
};
#endif /* PRISM2_NO_STATION_MODES */ #endif /* PRISM2_NO_STATION_MODES */
...@@ -463,29 +370,29 @@ void hostap_init_proc(local_info_t *local) ...@@ -463,29 +370,29 @@ void hostap_init_proc(local_info_t *local)
} }
#ifndef PRISM2_NO_PROCFS_DEBUG #ifndef PRISM2_NO_PROCFS_DEBUG
proc_create_data("debug", 0, local->proc, proc_create_single_data("debug", 0, local->proc,
&prism2_debug_proc_fops, local); prism2_debug_proc_show, local);
#endif /* PRISM2_NO_PROCFS_DEBUG */ #endif /* PRISM2_NO_PROCFS_DEBUG */
proc_create_data("stats", 0, local->proc, proc_create_single_data("stats", 0, local->proc, prism2_stats_proc_show,
&prism2_stats_proc_fops, local); local);
proc_create_data("wds", 0, local->proc, proc_create_seq_data("wds", 0, local->proc,
&prism2_wds_proc_fops, local); &prism2_wds_proc_seqops, local);
proc_create_data("pda", 0, local->proc, proc_create_data("pda", 0, local->proc,
&prism2_pda_proc_fops, local); &prism2_pda_proc_fops, local);
proc_create_data("aux_dump", 0, local->proc, proc_create_data("aux_dump", 0, local->proc,
local->func->read_aux_fops ?: &prism2_aux_dump_proc_fops, local->func->read_aux_fops ?: &prism2_aux_dump_proc_fops,
local); local);
proc_create_data("bss_list", 0, local->proc, proc_create_seq_data("bss_list", 0, local->proc,
&prism2_bss_list_proc_fops, local); &prism2_bss_list_proc_seqops, local);
proc_create_data("crypt", 0, local->proc, proc_create_single_data("crypt", 0, local->proc, prism2_crypt_proc_show,
&prism2_crypt_proc_fops, local); local);
#ifdef PRISM2_IO_DEBUG #ifdef PRISM2_IO_DEBUG
proc_create_data("io_debug", 0, local->proc, proc_create_single_data("io_debug", 0, local->proc,
&prism2_io_debug_proc_fops, local); prism2_debug_proc_show, local);
#endif /* PRISM2_IO_DEBUG */ #endif /* PRISM2_IO_DEBUG */
#ifndef PRISM2_NO_STATION_MODES #ifndef PRISM2_NO_STATION_MODES
proc_create_data("scan_results", 0, local->proc, proc_create_seq_data("scan_results", 0, local->proc,
&prism2_scan_results_proc_fops, local); &prism2_scan_results_proc_seqops, local);
#endif /* PRISM2_NO_STATION_MODES */ #endif /* PRISM2_NO_STATION_MODES */
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment