Revert "l2tpv3tun: moved to github"
[packages.git] / net / madwifi / patches / 481-fix_proc.patch
1 --- a/net80211/ieee80211_linux.c
2 +++ b/net80211/ieee80211_linux.c
3 @@ -476,8 +476,12 @@ static int
4  proc_ieee80211_open(struct inode *inode, struct file *file)
5  {
6         struct proc_ieee80211_priv *pv = NULL;
7 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
8 +       struct ieee80211vap *vap = PDE_DATA(inode);
9 +#else
10         struct proc_dir_entry *dp = PDE(inode);
11         struct ieee80211vap *vap = dp->data;
12 +#endif
13  
14         if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv), GFP_KERNEL)))
15                 return -ENOMEM;
16 @@ -842,10 +846,16 @@ ieee80211_virtfs_latevattach(struct ieee
17                 tmp = vap->iv_proc_entries;
18                 while (tmp) {
19                         if (!tmp->entry) {
20 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
21 +                               tmp->entry = proc_create_data(tmp->name,
22 +                               PROC_IEEE80211_PERM, vap->iv_proc,
23 +                               tmp->fileops, vap);
24 +#else
25                                 tmp->entry = create_proc_entry(tmp->name,
26                                 PROC_IEEE80211_PERM, vap->iv_proc);
27                                 tmp->entry->data = vap;
28                                 tmp->entry->proc_fops = tmp->fileops;
29 +#endif
30                         }
31                         tmp = tmp->next;
32                 }
33 @@ -913,10 +923,16 @@ ieee80211_proc_vcreate(struct ieee80211v
34  
35         /* Create the actual proc entry */
36         if (vap->iv_proc) {
37 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
38 +               entry->entry = proc_create_data(entry->name,
39 +                               PROC_IEEE80211_PERM, vap->iv_proc,
40 +                               entry->fileops, vap);
41 +#else
42                 entry->entry = create_proc_entry(entry->name,
43                                 PROC_IEEE80211_PERM, vap->iv_proc);
44                 entry->entry->data = vap;
45                 entry->entry->proc_fops = entry->fileops;
46 +#endif
47         }
48  
49         /* Add it to the list */
50 @@ -953,14 +969,26 @@ ieee80211_virtfs_vdetach(struct ieee8021
51                 tmp = vap->iv_proc_entries;
52                 while (tmp) {
53                         if (tmp->entry) {
54 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
55 +                               proc_remove(tmp->entry);
56 +#else
57                                 remove_proc_entry(tmp->name, vap->iv_proc);
58 +#endif
59                                 tmp->entry = NULL;
60                         }
61                         tmp = tmp->next;
62                 }
63 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
64 +               proc_remove(vap->iv_proc);
65 +#else
66                 remove_proc_entry(vap->iv_proc->name, proc_madwifi);
67 +#endif
68                 if (proc_madwifi_count == 1) {
69 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
70 +                       proc_remove(proc_madwifi);
71 +#else
72                         remove_proc_entry("madwifi", proc_net);
73 +#endif
74                         proc_madwifi = NULL;
75                 }
76                 proc_madwifi_count--;
77 --- a/ath_rate/minstrel/minstrel.c
78 +++ b/ath_rate/minstrel/minstrel.c
79 @@ -835,8 +835,12 @@ static int
80  ath_proc_ratesample_open(struct inode *inode, struct file *file)
81  {
82                 struct proc_ieee80211_priv *pv = NULL;
83 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
84 +               struct ieee80211vap *vap = PDE_DATA(inode);
85 +#else
86                 struct proc_dir_entry *dp = PDE(inode);
87                 struct ieee80211vap *vap = dp->data;
88 +#endif
89  
90                 if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv),
91                                                     GFP_KERNEL)))
92 --- a/ath_rate/sample/sample.c
93 +++ b/ath_rate/sample/sample.c
94 @@ -923,12 +923,15 @@ proc_read_nodes(struct ieee80211vap *vap
95  }
96  
97  static int
98 -proc_ratesample_open(struct inode *inode, struct file *file)
99 +proc_ratesample_open_common(struct inode *inode, struct file *file, const unsigned long size)
100  {
101         struct proc_ieee80211_priv *pv;
102 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
103 +       struct ieee80211vap *vap = PDE_DATA(inode);
104 +#else
105         struct proc_dir_entry *dp = PDE(inode);
106         struct ieee80211vap *vap = dp->data;
107 -       unsigned long size;
108 +#endif
109  
110         if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv),
111                                         GFP_KERNEL)))
112 @@ -953,18 +956,47 @@ proc_ratesample_open(struct inode *inode
113         pv->max_wlen = MAX_PROC_IEEE80211_SIZE;
114         pv->max_rlen = MAX_PROC_IEEE80211_SIZE;
115  
116 -       /* Determine what size packets to get stats for based on proc filename */
117 -       size = simple_strtoul(dp->name + 10, NULL, 0);
118 -
119         /* now read the data into the buffer */
120         pv->rlen = proc_read_nodes(vap, size, pv->rbuf, MAX_PROC_IEEE80211_SIZE);
121         return 0;
122  }
123  
124 -static struct file_operations proc_ratesample_ops = {
125 +static int
126 +proc_ratesample_stats250_open(struct inode *inode, struct file *file)
127 +{
128 +       return proc_ratesample_open_common(inode, file, 250);
129 +}
130 +
131 +static int
132 +proc_ratesample_stats1600_open(struct inode *inode, struct file *file)
133 +{
134 +       return proc_ratesample_open_common(inode, file, 1600);
135 +}
136 +
137 +static int
138 +proc_ratesample_stats3000_open(struct inode *inode, struct file *file)
139 +{
140 +       return proc_ratesample_open_common(inode, file, 3000);
141 +}
142 +
143 +static struct file_operations proc_ratesample_stats250_ops = {
144 +       .read = NULL,
145 +       .write = NULL,
146 +       .open = proc_ratesample_stats250_open,
147 +       .release = NULL,
148 +};
149 +
150 +static struct file_operations proc_ratesample_stats1600_ops = {
151 +       .read = NULL,
152 +       .write = NULL,
153 +       .open = proc_ratesample_stats1600_open,
154 +       .release = NULL,
155 +};
156 +
157 +static struct file_operations proc_ratesample_stats3000_ops = {
158         .read = NULL,
159         .write = NULL,
160 -       .open = proc_ratesample_open,
161 +       .open = proc_ratesample_stats3000_open,
162         .release = NULL,
163  };
164  
165 @@ -972,9 +1004,9 @@ static void
166  ath_rate_dynamic_proc_register(struct ieee80211vap *vap)
167  {
168         /* Create proc entries for the rate control algorithm */
169 -       ieee80211_proc_vcreate(vap, &proc_ratesample_ops, "ratestats_250");
170 -       ieee80211_proc_vcreate(vap, &proc_ratesample_ops, "ratestats_1600");
171 -       ieee80211_proc_vcreate(vap, &proc_ratesample_ops, "ratestats_3000");
172 +       ieee80211_proc_vcreate(vap, &proc_ratesample_stats250_ops, "ratestats_250");
173 +       ieee80211_proc_vcreate(vap, &proc_ratesample_stats1600_ops, "ratestats_1600");
174 +       ieee80211_proc_vcreate(vap, &proc_ratesample_stats3000_ops, "ratestats_3000");
175  }
176  
177  static struct ieee80211_rate_ops ath_rate_ops = {