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