diff options
Diffstat (limited to 'net/mac80211/debugfs_netdev.c')
-rw-r--r-- | net/mac80211/debugfs_netdev.c | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 04b5a14c8a05..b62cbe82954c 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -133,7 +133,15 @@ static ssize_t ieee80211_if_fmt_##name( \ | |||
133 | jiffies_to_msecs(sdata->field)); \ | 133 | jiffies_to_msecs(sdata->field)); \ |
134 | } | 134 | } |
135 | 135 | ||
136 | #define __IEEE80211_IF_FILE(name, _write) \ | 136 | #define _IEEE80211_IF_FILE_OPS(name, _read, _write) \ |
137 | static const struct file_operations name##_ops = { \ | ||
138 | .read = (_read), \ | ||
139 | .write = (_write), \ | ||
140 | .open = simple_open, \ | ||
141 | .llseek = generic_file_llseek, \ | ||
142 | } | ||
143 | |||
144 | #define _IEEE80211_IF_FILE_R_FN(name) \ | ||
137 | static ssize_t ieee80211_if_read_##name(struct file *file, \ | 145 | static ssize_t ieee80211_if_read_##name(struct file *file, \ |
138 | char __user *userbuf, \ | 146 | char __user *userbuf, \ |
139 | size_t count, loff_t *ppos) \ | 147 | size_t count, loff_t *ppos) \ |
@@ -141,28 +149,34 @@ static ssize_t ieee80211_if_read_##name(struct file *file, \ | |||
141 | return ieee80211_if_read(file->private_data, \ | 149 | return ieee80211_if_read(file->private_data, \ |
142 | userbuf, count, ppos, \ | 150 | userbuf, count, ppos, \ |
143 | ieee80211_if_fmt_##name); \ | 151 | ieee80211_if_fmt_##name); \ |
144 | } \ | ||
145 | static const struct file_operations name##_ops = { \ | ||
146 | .read = ieee80211_if_read_##name, \ | ||
147 | .write = (_write), \ | ||
148 | .open = simple_open, \ | ||
149 | .llseek = generic_file_llseek, \ | ||
150 | } | 152 | } |
151 | 153 | ||
152 | #define __IEEE80211_IF_FILE_W(name) \ | 154 | #define _IEEE80211_IF_FILE_W_FN(name) \ |
153 | static ssize_t ieee80211_if_write_##name(struct file *file, \ | 155 | static ssize_t ieee80211_if_write_##name(struct file *file, \ |
154 | const char __user *userbuf, \ | 156 | const char __user *userbuf, \ |
155 | size_t count, loff_t *ppos) \ | 157 | size_t count, loff_t *ppos) \ |
156 | { \ | 158 | { \ |
157 | return ieee80211_if_write(file->private_data, userbuf, count, \ | 159 | return ieee80211_if_write(file->private_data, userbuf, count, \ |
158 | ppos, ieee80211_if_parse_##name); \ | 160 | ppos, ieee80211_if_parse_##name); \ |
159 | } \ | 161 | } |
160 | __IEEE80211_IF_FILE(name, ieee80211_if_write_##name) | 162 | |
163 | #define IEEE80211_IF_FILE_R(name) \ | ||
164 | _IEEE80211_IF_FILE_R_FN(name) \ | ||
165 | _IEEE80211_IF_FILE_OPS(name, ieee80211_if_read_##name, NULL) | ||
166 | |||
167 | #define IEEE80211_IF_FILE_W(name) \ | ||
168 | _IEEE80211_IF_FILE_W_FN(name) \ | ||
169 | _IEEE80211_IF_FILE_OPS(name, NULL, ieee80211_if_write_##name) | ||
161 | 170 | ||
171 | #define IEEE80211_IF_FILE_RW(name) \ | ||
172 | _IEEE80211_IF_FILE_R_FN(name) \ | ||
173 | _IEEE80211_IF_FILE_W_FN(name) \ | ||
174 | _IEEE80211_IF_FILE_OPS(name, ieee80211_if_read_##name, \ | ||
175 | ieee80211_if_write_##name) | ||
162 | 176 | ||
163 | #define IEEE80211_IF_FILE(name, field, format) \ | 177 | #define IEEE80211_IF_FILE(name, field, format) \ |
164 | IEEE80211_IF_FMT_##format(name, field) \ | 178 | IEEE80211_IF_FMT_##format(name, field) \ |
165 | __IEEE80211_IF_FILE(name, NULL) | 179 | IEEE80211_IF_FILE_R(name) |
166 | 180 | ||
167 | /* common attributes */ | 181 | /* common attributes */ |
168 | IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); | 182 | IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); |
@@ -199,7 +213,7 @@ ieee80211_if_fmt_hw_queues(const struct ieee80211_sub_if_data *sdata, | |||
199 | 213 | ||
200 | return len; | 214 | return len; |
201 | } | 215 | } |
202 | __IEEE80211_IF_FILE(hw_queues, NULL); | 216 | IEEE80211_IF_FILE_R(hw_queues); |
203 | 217 | ||
204 | /* STA attributes */ | 218 | /* STA attributes */ |
205 | IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC); | 219 | IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC); |
@@ -275,14 +289,7 @@ static ssize_t ieee80211_if_parse_smps(struct ieee80211_sub_if_data *sdata, | |||
275 | 289 | ||
276 | return -EINVAL; | 290 | return -EINVAL; |
277 | } | 291 | } |
278 | 292 | IEEE80211_IF_FILE_RW(smps); | |
279 | __IEEE80211_IF_FILE_W(smps); | ||
280 | |||
281 | static ssize_t ieee80211_if_fmt_tkip_mic_test( | ||
282 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) | ||
283 | { | ||
284 | return -EOPNOTSUPP; | ||
285 | } | ||
286 | 293 | ||
287 | static ssize_t ieee80211_if_parse_tkip_mic_test( | 294 | static ssize_t ieee80211_if_parse_tkip_mic_test( |
288 | struct ieee80211_sub_if_data *sdata, const char *buf, int buflen) | 295 | struct ieee80211_sub_if_data *sdata, const char *buf, int buflen) |
@@ -349,8 +356,7 @@ static ssize_t ieee80211_if_parse_tkip_mic_test( | |||
349 | 356 | ||
350 | return buflen; | 357 | return buflen; |
351 | } | 358 | } |
352 | 359 | IEEE80211_IF_FILE_W(tkip_mic_test); | |
353 | __IEEE80211_IF_FILE_W(tkip_mic_test); | ||
354 | 360 | ||
355 | static ssize_t ieee80211_if_fmt_uapsd_queues( | 361 | static ssize_t ieee80211_if_fmt_uapsd_queues( |
356 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) | 362 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) |
@@ -378,7 +384,7 @@ static ssize_t ieee80211_if_parse_uapsd_queues( | |||
378 | 384 | ||
379 | return buflen; | 385 | return buflen; |
380 | } | 386 | } |
381 | __IEEE80211_IF_FILE_W(uapsd_queues); | 387 | IEEE80211_IF_FILE_RW(uapsd_queues); |
382 | 388 | ||
383 | static ssize_t ieee80211_if_fmt_uapsd_max_sp_len( | 389 | static ssize_t ieee80211_if_fmt_uapsd_max_sp_len( |
384 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) | 390 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) |
@@ -406,7 +412,7 @@ static ssize_t ieee80211_if_parse_uapsd_max_sp_len( | |||
406 | 412 | ||
407 | return buflen; | 413 | return buflen; |
408 | } | 414 | } |
409 | __IEEE80211_IF_FILE_W(uapsd_max_sp_len); | 415 | IEEE80211_IF_FILE_RW(uapsd_max_sp_len); |
410 | 416 | ||
411 | /* AP attributes */ | 417 | /* AP attributes */ |
412 | IEEE80211_IF_FILE(num_mcast_sta, u.ap.num_mcast_sta, ATOMIC); | 418 | IEEE80211_IF_FILE(num_mcast_sta, u.ap.num_mcast_sta, ATOMIC); |
@@ -419,7 +425,7 @@ static ssize_t ieee80211_if_fmt_num_buffered_multicast( | |||
419 | return scnprintf(buf, buflen, "%u\n", | 425 | return scnprintf(buf, buflen, "%u\n", |
420 | skb_queue_len(&sdata->u.ap.ps.bc_buf)); | 426 | skb_queue_len(&sdata->u.ap.ps.bc_buf)); |
421 | } | 427 | } |
422 | __IEEE80211_IF_FILE(num_buffered_multicast, NULL); | 428 | IEEE80211_IF_FILE_R(num_buffered_multicast); |
423 | 429 | ||
424 | /* IBSS attributes */ | 430 | /* IBSS attributes */ |
425 | static ssize_t ieee80211_if_fmt_tsf( | 431 | static ssize_t ieee80211_if_fmt_tsf( |
@@ -470,7 +476,7 @@ static ssize_t ieee80211_if_parse_tsf( | |||
470 | 476 | ||
471 | return buflen; | 477 | return buflen; |
472 | } | 478 | } |
473 | __IEEE80211_IF_FILE_W(tsf); | 479 | IEEE80211_IF_FILE_RW(tsf); |
474 | 480 | ||
475 | 481 | ||
476 | /* WDS attributes */ | 482 | /* WDS attributes */ |