mirror of https://github.com/proski/madwifi
Fix compatibility with procfs API changes in Linux 3.10
This commit is contained in:
parent
f83c3d758e
commit
4f4d17ea6e
|
@ -1032,8 +1032,7 @@ static int
|
|||
ath_proc_ratesample_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct proc_ieee80211_priv *pv = NULL;
|
||||
struct proc_dir_entry *dp = PDE(inode);
|
||||
struct ieee80211vap *vap = dp->data;
|
||||
struct ieee80211vap *vap = PDE_DATA(inode);
|
||||
|
||||
if (!(file->private_data = kzalloc(sizeof(struct proc_ieee80211_priv),
|
||||
GFP_KERNEL)))
|
||||
|
|
|
@ -1045,10 +1045,15 @@ static int
|
|||
proc_ratesample_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct proc_ieee80211_priv *pv;
|
||||
struct proc_dir_entry *dp = PDE(inode);
|
||||
struct ieee80211vap *vap = dp->data;
|
||||
struct ieee80211vap *vap = PDE_DATA(inode);
|
||||
unsigned long size;
|
||||
|
||||
/* Determine what size packets to get stats for based on proc filename */
|
||||
size = simple_strtoul(file->f_dentry->d_name.name +
|
||||
sizeof("ratestats_"), NULL, 0);
|
||||
if (size < 250 || size > 3000)
|
||||
return -ENOENT;
|
||||
|
||||
if (!(file->private_data = kzalloc(sizeof(struct proc_ieee80211_priv),
|
||||
GFP_KERNEL)))
|
||||
return -ENOMEM;
|
||||
|
@ -1071,9 +1076,6 @@ proc_ratesample_open(struct inode *inode, struct file *file)
|
|||
pv->max_wlen = MAX_PROC_IEEE80211_SIZE;
|
||||
pv->max_rlen = MAX_PROC_IEEE80211_SIZE;
|
||||
|
||||
/* Determine what size packets to get stats for based on proc filename */
|
||||
size = simple_strtoul(dp->name + 10, NULL, 0);
|
||||
|
||||
/* now read the data into the buffer */
|
||||
pv->rlen = proc_read_nodes(vap, size, pv->rbuf, MAX_PROC_IEEE80211_SIZE);
|
||||
return 0;
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <linux/netdevice.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#endif
|
||||
|
||||
#include <linux/version.h>
|
||||
|
@ -242,6 +243,36 @@ typedef unsigned long resource_size_t;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
|
||||
static inline struct proc_dir_entry *proc_create_data(const char *name,
|
||||
umode_t mode, struct proc_dir_entry *parent,
|
||||
struct file_operations *fops, void *data)
|
||||
{
|
||||
struct proc_dir_entry *de;
|
||||
|
||||
de = create_proc_entry(name, mode, parent);
|
||||
if (de) {
|
||||
de->data = data;
|
||||
de->proc_fops = fops;
|
||||
}
|
||||
|
||||
return de;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
|
||||
static inline void proc_remove(struct proc_dir_entry *de)
|
||||
{
|
||||
if (de)
|
||||
remove_proc_entry(de->name, de->parent);
|
||||
}
|
||||
|
||||
static inline void *PDE_DATA(const struct inode *inode)
|
||||
{
|
||||
return PDE(inode)->data;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
|
||||
#define netdev_notifier_info_to_dev(ptr) ((struct net_device *)(ptr))
|
||||
#endif
|
||||
|
|
|
@ -607,8 +607,7 @@ static int
|
|||
proc_ieee80211_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct proc_ieee80211_priv *pv = NULL;
|
||||
struct proc_dir_entry *dp = PDE(inode);
|
||||
struct ieee80211vap *vap = dp->data;
|
||||
struct ieee80211vap *vap = PDE_DATA(inode);
|
||||
int result;
|
||||
|
||||
result = proc_common_open(inode, file);
|
||||
|
@ -625,8 +624,7 @@ static int
|
|||
proc_doth_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct proc_ieee80211_priv *pv = NULL;
|
||||
struct proc_dir_entry *dp = PDE(inode);
|
||||
struct ieee80211vap *vap = dp->data;
|
||||
struct ieee80211vap *vap = PDE_DATA(inode);
|
||||
int result;
|
||||
|
||||
result = proc_common_open(inode, file);
|
||||
|
@ -643,8 +641,7 @@ static int
|
|||
proc_doth_state_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct proc_ieee80211_priv *pv = NULL;
|
||||
struct proc_dir_entry *dp = PDE(inode);
|
||||
struct ieee80211vap *vap = dp->data;
|
||||
struct ieee80211vap *vap = PDE_DATA(inode);
|
||||
int result;
|
||||
|
||||
result = proc_common_open(inode, file);
|
||||
|
@ -662,8 +659,7 @@ static int
|
|||
proc_iv_bss_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct proc_ieee80211_priv *pv = NULL;
|
||||
struct proc_dir_entry *dp = PDE(inode);
|
||||
struct ieee80211vap *vap = dp->data;
|
||||
struct ieee80211vap *vap = PDE_DATA(inode);
|
||||
int result;
|
||||
|
||||
result = proc_common_open(inode, file);
|
||||
|
@ -1037,10 +1033,9 @@ ieee80211_virtfs_latevattach(struct ieee80211vap *vap)
|
|||
|
||||
while (tmp) {
|
||||
if (!tmp->entry) {
|
||||
tmp->entry = create_proc_entry(tmp->name,
|
||||
PROC_IEEE80211_PERM, vap->iv_proc);
|
||||
tmp->entry->data = vap;
|
||||
tmp->entry->proc_fops = tmp->fileops;
|
||||
tmp->entry = proc_create_data(tmp->name,
|
||||
PROC_IEEE80211_PERM, vap->iv_proc,
|
||||
tmp->fileops, vap);
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
@ -1110,10 +1105,9 @@ ieee80211_proc_vcreate(struct ieee80211vap *vap,
|
|||
|
||||
/* Create the actual proc entry */
|
||||
if (vap->iv_proc) {
|
||||
entry->entry = create_proc_entry(entry->name,
|
||||
PROC_IEEE80211_PERM, vap->iv_proc);
|
||||
entry->entry->data = vap;
|
||||
entry->entry->proc_fops = entry->fileops;
|
||||
entry->entry = proc_create_data(entry->name,
|
||||
PROC_IEEE80211_PERM, vap->iv_proc,
|
||||
entry->fileops, vap);
|
||||
}
|
||||
|
||||
/* Add it to the list */
|
||||
|
@ -1151,14 +1145,14 @@ ieee80211_virtfs_vdetach(struct ieee80211vap *vap)
|
|||
|
||||
while (tmp) {
|
||||
if (tmp->entry) {
|
||||
remove_proc_entry(tmp->name, vap->iv_proc);
|
||||
proc_remove(tmp->entry);
|
||||
tmp->entry = NULL;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
remove_proc_entry(vap->iv_proc->name, proc_madwifi);
|
||||
proc_remove(vap->iv_proc);
|
||||
if (proc_madwifi_count == 1) {
|
||||
remove_proc_entry("madwifi", proc_net);
|
||||
proc_remove(proc_madwifi);
|
||||
proc_madwifi = NULL;
|
||||
}
|
||||
proc_madwifi_count--;
|
||||
|
|
Loading…
Reference in New Issue