aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/bat_sysfs.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-12 12:33:52 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-25 02:21:35 -0400
commit0ff9b86feb6ee50171dcf5635520c91757b3d5e9 (patch)
tree48d6af680881a8a1e3154a922d60d7a3c762fda4 /net/batman-adv/bat_sysfs.c
parentfe8bc39699cf887a9c3758aa7b3cbbf771e1e847 (diff)
batman-adv: Prefix bat_sysfs local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent. Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/bat_sysfs.c')
-rw-r--r--net/batman-adv/bat_sysfs.c255
1 files changed, 138 insertions, 117 deletions
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 7f464a9e9672..03b76a41ac4e 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -26,15 +26,15 @@
26#include "gateway_client.h" 26#include "gateway_client.h"
27#include "vis.h" 27#include "vis.h"
28 28
29static struct net_device *kobj_to_netdev(struct kobject *obj) 29static struct net_device *batadv_kobj_to_netdev(struct kobject *obj)
30{ 30{
31 struct device *dev = container_of(obj->parent, struct device, kobj); 31 struct device *dev = container_of(obj->parent, struct device, kobj);
32 return to_net_dev(dev); 32 return to_net_dev(dev);
33} 33}
34 34
35static struct bat_priv *kobj_to_batpriv(struct kobject *obj) 35static struct bat_priv *batadv_kobj_to_batpriv(struct kobject *obj)
36{ 36{
37 struct net_device *net_dev = kobj_to_netdev(obj); 37 struct net_device *net_dev = batadv_kobj_to_netdev(obj);
38 return netdev_priv(net_dev); 38 return netdev_priv(net_dev);
39} 39}
40 40
@@ -42,19 +42,19 @@ static struct bat_priv *kobj_to_batpriv(struct kobject *obj)
42#define UEV_ACTION_VAR "BATACTION=" 42#define UEV_ACTION_VAR "BATACTION="
43#define UEV_DATA_VAR "BATDATA=" 43#define UEV_DATA_VAR "BATDATA="
44 44
45static char *uev_action_str[] = { 45static char *batadv_uev_action_str[] = {
46 "add", 46 "add",
47 "del", 47 "del",
48 "change" 48 "change"
49}; 49};
50 50
51static char *uev_type_str[] = { 51static char *batadv_uev_type_str[] = {
52 "gw" 52 "gw"
53}; 53};
54 54
55/* Use this, if you have customized show and store functions */ 55/* Use this, if you have customized show and store functions */
56#define BAT_ATTR(_name, _mode, _show, _store) \ 56#define BAT_ATTR(_name, _mode, _show, _store) \
57struct bat_attribute bat_attr_##_name = { \ 57struct bat_attribute batadv_attr_##_name = { \
58 .attr = {.name = __stringify(_name), \ 58 .attr = {.name = __stringify(_name), \
59 .mode = _mode }, \ 59 .mode = _mode }, \
60 .show = _show, \ 60 .show = _show, \
@@ -62,20 +62,21 @@ struct bat_attribute bat_attr_##_name = { \
62}; 62};
63 63
64#define BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \ 64#define BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \
65ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \ 65ssize_t batadv_store_##_name(struct kobject *kobj, \
66 char *buff, size_t count) \ 66 struct attribute *attr, char *buff, \
67 size_t count) \
67{ \ 68{ \
68 struct net_device *net_dev = kobj_to_netdev(kobj); \ 69 struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \
69 struct bat_priv *bat_priv = netdev_priv(net_dev); \ 70 struct bat_priv *bat_priv = netdev_priv(net_dev); \
70 return __store_bool_attr(buff, count, _post_func, attr, \ 71 return __batadv_store_bool_attr(buff, count, _post_func, attr, \
71 &bat_priv->_name, net_dev); \ 72 &bat_priv->_name, net_dev); \
72} 73}
73 74
74#define BAT_ATTR_SIF_SHOW_BOOL(_name) \ 75#define BAT_ATTR_SIF_SHOW_BOOL(_name) \
75ssize_t show_##_name(struct kobject *kobj, \ 76ssize_t batadv_show_##_name(struct kobject *kobj, \
76 struct attribute *attr, char *buff) \ 77 struct attribute *attr, char *buff) \
77{ \ 78{ \
78 struct bat_priv *bat_priv = kobj_to_batpriv(kobj); \ 79 struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj); \
79 return sprintf(buff, "%s\n", \ 80 return sprintf(buff, "%s\n", \
80 atomic_read(&bat_priv->_name) == 0 ? \ 81 atomic_read(&bat_priv->_name) == 0 ? \
81 "disabled" : "enabled"); \ 82 "disabled" : "enabled"); \
@@ -87,24 +88,27 @@ ssize_t show_##_name(struct kobject *kobj, \
87#define BAT_ATTR_SIF_BOOL(_name, _mode, _post_func) \ 88#define BAT_ATTR_SIF_BOOL(_name, _mode, _post_func) \
88 static BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \ 89 static BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \
89 static BAT_ATTR_SIF_SHOW_BOOL(_name) \ 90 static BAT_ATTR_SIF_SHOW_BOOL(_name) \
90 static BAT_ATTR(_name, _mode, show_##_name, store_##_name) 91 static BAT_ATTR(_name, _mode, batadv_show_##_name, \
92 batadv_store_##_name)
91 93
92 94
93#define BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ 95#define BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \
94ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \ 96ssize_t batadv_store_##_name(struct kobject *kobj, \
95 char *buff, size_t count) \ 97 struct attribute *attr, char *buff, \
98 size_t count) \
96{ \ 99{ \
97 struct net_device *net_dev = kobj_to_netdev(kobj); \ 100 struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \
98 struct bat_priv *bat_priv = netdev_priv(net_dev); \ 101 struct bat_priv *bat_priv = netdev_priv(net_dev); \
99 return __store_uint_attr(buff, count, _min, _max, _post_func, \ 102 return __batadv_store_uint_attr(buff, count, _min, _max, \
100 attr, &bat_priv->_name, net_dev); \ 103 _post_func, attr, \
104 &bat_priv->_name, net_dev); \
101} 105}
102 106
103#define BAT_ATTR_SIF_SHOW_UINT(_name) \ 107#define BAT_ATTR_SIF_SHOW_UINT(_name) \
104ssize_t show_##_name(struct kobject *kobj, \ 108ssize_t batadv_show_##_name(struct kobject *kobj, \
105 struct attribute *attr, char *buff) \ 109 struct attribute *attr, char *buff) \
106{ \ 110{ \
107 struct bat_priv *bat_priv = kobj_to_batpriv(kobj); \ 111 struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj); \
108 return sprintf(buff, "%i\n", atomic_read(&bat_priv->_name)); \ 112 return sprintf(buff, "%i\n", atomic_read(&bat_priv->_name)); \
109} \ 113} \
110 114
@@ -114,14 +118,16 @@ ssize_t show_##_name(struct kobject *kobj, \
114#define BAT_ATTR_SIF_UINT(_name, _mode, _min, _max, _post_func) \ 118#define BAT_ATTR_SIF_UINT(_name, _mode, _min, _max, _post_func) \
115 static BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ 119 static BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \
116 static BAT_ATTR_SIF_SHOW_UINT(_name) \ 120 static BAT_ATTR_SIF_SHOW_UINT(_name) \
117 static BAT_ATTR(_name, _mode, show_##_name, store_##_name) 121 static BAT_ATTR(_name, _mode, batadv_show_##_name, \
122 batadv_store_##_name)
118 123
119 124
120#define BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ 125#define BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \
121ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \ 126ssize_t batadv_store_##_name(struct kobject *kobj, \
122 char *buff, size_t count) \ 127 struct attribute *attr, char *buff, \
128 size_t count) \
123{ \ 129{ \
124 struct net_device *net_dev = kobj_to_netdev(kobj); \ 130 struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \
125 struct hard_iface *hard_iface; \ 131 struct hard_iface *hard_iface; \
126 ssize_t length; \ 132 ssize_t length; \
127 \ 133 \
@@ -129,18 +135,19 @@ ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
129 if (!hard_iface) \ 135 if (!hard_iface) \
130 return 0; \ 136 return 0; \
131 \ 137 \
132 length = __store_uint_attr(buff, count, _min, _max, _post_func, \ 138 length = __batadv_store_uint_attr(buff, count, _min, _max, \
133 attr, &hard_iface->_name, net_dev); \ 139 _post_func, attr, \
140 &hard_iface->_name, net_dev); \
134 \ 141 \
135 batadv_hardif_free_ref(hard_iface); \ 142 batadv_hardif_free_ref(hard_iface); \
136 return length; \ 143 return length; \
137} 144}
138 145
139#define BAT_ATTR_HIF_SHOW_UINT(_name) \ 146#define BAT_ATTR_HIF_SHOW_UINT(_name) \
140ssize_t show_##_name(struct kobject *kobj, \ 147ssize_t batadv_show_##_name(struct kobject *kobj, \
141 struct attribute *attr, char *buff) \ 148 struct attribute *attr, char *buff) \
142{ \ 149{ \
143 struct net_device *net_dev = kobj_to_netdev(kobj); \ 150 struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \
144 struct hard_iface *hard_iface; \ 151 struct hard_iface *hard_iface; \
145 ssize_t length; \ 152 ssize_t length; \
146 \ 153 \
@@ -160,12 +167,13 @@ ssize_t show_##_name(struct kobject *kobj, \
160#define BAT_ATTR_HIF_UINT(_name, _mode, _min, _max, _post_func) \ 167#define BAT_ATTR_HIF_UINT(_name, _mode, _min, _max, _post_func) \
161 static BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ 168 static BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \
162 static BAT_ATTR_HIF_SHOW_UINT(_name) \ 169 static BAT_ATTR_HIF_SHOW_UINT(_name) \
163 static BAT_ATTR(_name, _mode, show_##_name, store_##_name) 170 static BAT_ATTR(_name, _mode, batadv_show_##_name, \
171 batadv_store_##_name)
164 172
165 173
166static int store_bool_attr(char *buff, size_t count, 174static int batadv_store_bool_attr(char *buff, size_t count,
167 struct net_device *net_dev, 175 struct net_device *net_dev,
168 const char *attr_name, atomic_t *attr) 176 const char *attr_name, atomic_t *attr)
169{ 177{
170 int enabled = -1; 178 int enabled = -1;
171 179
@@ -200,23 +208,27 @@ static int store_bool_attr(char *buff, size_t count,
200 return count; 208 return count;
201} 209}
202 210
203static inline ssize_t __store_bool_attr(char *buff, size_t count, 211static inline ssize_t
204 void (*post_func)(struct net_device *), 212__batadv_store_bool_attr(char *buff, size_t count,
205 struct attribute *attr, 213 void (*post_func)(struct net_device *),
206 atomic_t *attr_store, struct net_device *net_dev) 214 struct attribute *attr,
215 atomic_t *attr_store, struct net_device *net_dev)
207{ 216{
208 int ret; 217 int ret;
209 218
210 ret = store_bool_attr(buff, count, net_dev, attr->name, attr_store); 219 ret = batadv_store_bool_attr(buff, count, net_dev, attr->name,
220 attr_store);
211 if (post_func && ret) 221 if (post_func && ret)
212 post_func(net_dev); 222 post_func(net_dev);
213 223
214 return ret; 224 return ret;
215} 225}
216 226
217static int store_uint_attr(const char *buff, size_t count, 227static int batadv_store_uint_attr(const char *buff, size_t count,
218 struct net_device *net_dev, const char *attr_name, 228 struct net_device *net_dev,
219 unsigned int min, unsigned int max, atomic_t *attr) 229 const char *attr_name,
230 unsigned int min, unsigned int max,
231 atomic_t *attr)
220{ 232{
221 unsigned long uint_val; 233 unsigned long uint_val;
222 int ret; 234 int ret;
@@ -251,26 +263,27 @@ static int store_uint_attr(const char *buff, size_t count,
251 return count; 263 return count;
252} 264}
253 265
254static inline ssize_t __store_uint_attr(const char *buff, size_t count, 266static inline ssize_t
255 int min, int max, 267__batadv_store_uint_attr(const char *buff, size_t count,
256 void (*post_func)(struct net_device *), 268 int min, int max,
257 const struct attribute *attr, 269 void (*post_func)(struct net_device *),
258 atomic_t *attr_store, struct net_device *net_dev) 270 const struct attribute *attr,
271 atomic_t *attr_store, struct net_device *net_dev)
259{ 272{
260 int ret; 273 int ret;
261 274
262 ret = store_uint_attr(buff, count, net_dev, attr->name, 275 ret = batadv_store_uint_attr(buff, count, net_dev, attr->name, min, max,
263 min, max, attr_store); 276 attr_store);
264 if (post_func && ret) 277 if (post_func && ret)
265 post_func(net_dev); 278 post_func(net_dev);
266 279
267 return ret; 280 return ret;
268} 281}
269 282
270static ssize_t show_vis_mode(struct kobject *kobj, struct attribute *attr, 283static ssize_t batadv_show_vis_mode(struct kobject *kobj,
271 char *buff) 284 struct attribute *attr, char *buff)
272{ 285{
273 struct bat_priv *bat_priv = kobj_to_batpriv(kobj); 286 struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj);
274 int vis_mode = atomic_read(&bat_priv->vis_mode); 287 int vis_mode = atomic_read(&bat_priv->vis_mode);
275 288
276 return sprintf(buff, "%s\n", 289 return sprintf(buff, "%s\n",
@@ -278,10 +291,11 @@ static ssize_t show_vis_mode(struct kobject *kobj, struct attribute *attr,
278 "client" : "server"); 291 "client" : "server");
279} 292}
280 293
281static ssize_t store_vis_mode(struct kobject *kobj, struct attribute *attr, 294static ssize_t batadv_store_vis_mode(struct kobject *kobj,
282 char *buff, size_t count) 295 struct attribute *attr, char *buff,
296 size_t count)
283{ 297{
284 struct net_device *net_dev = kobj_to_netdev(kobj); 298 struct net_device *net_dev = batadv_kobj_to_netdev(kobj);
285 struct bat_priv *bat_priv = netdev_priv(net_dev); 299 struct bat_priv *bat_priv = netdev_priv(net_dev);
286 unsigned long val; 300 unsigned long val;
287 int ret, vis_mode_tmp = -1; 301 int ret, vis_mode_tmp = -1;
@@ -319,23 +333,23 @@ static ssize_t store_vis_mode(struct kobject *kobj, struct attribute *attr,
319 return count; 333 return count;
320} 334}
321 335
322static ssize_t show_bat_algo(struct kobject *kobj, struct attribute *attr, 336static ssize_t batadv_show_bat_algo(struct kobject *kobj,
323 char *buff) 337 struct attribute *attr, char *buff)
324{ 338{
325 struct bat_priv *bat_priv = kobj_to_batpriv(kobj); 339 struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj);
326 return sprintf(buff, "%s\n", bat_priv->bat_algo_ops->name); 340 return sprintf(buff, "%s\n", bat_priv->bat_algo_ops->name);
327} 341}
328 342
329static void post_gw_deselect(struct net_device *net_dev) 343static void batadv_post_gw_deselect(struct net_device *net_dev)
330{ 344{
331 struct bat_priv *bat_priv = netdev_priv(net_dev); 345 struct bat_priv *bat_priv = netdev_priv(net_dev);
332 batadv_gw_deselect(bat_priv); 346 batadv_gw_deselect(bat_priv);
333} 347}
334 348
335static ssize_t show_gw_mode(struct kobject *kobj, struct attribute *attr, 349static ssize_t batadv_show_gw_mode(struct kobject *kobj, struct attribute *attr,
336 char *buff) 350 char *buff)
337{ 351{
338 struct bat_priv *bat_priv = kobj_to_batpriv(kobj); 352 struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj);
339 int bytes_written; 353 int bytes_written;
340 354
341 switch (atomic_read(&bat_priv->gw_mode)) { 355 switch (atomic_read(&bat_priv->gw_mode)) {
@@ -353,10 +367,11 @@ static ssize_t show_gw_mode(struct kobject *kobj, struct attribute *attr,
353 return bytes_written; 367 return bytes_written;
354} 368}
355 369
356static ssize_t store_gw_mode(struct kobject *kobj, struct attribute *attr, 370static ssize_t batadv_store_gw_mode(struct kobject *kobj,
357 char *buff, size_t count) 371 struct attribute *attr, char *buff,
372 size_t count)
358{ 373{
359 struct net_device *net_dev = kobj_to_netdev(kobj); 374 struct net_device *net_dev = batadv_kobj_to_netdev(kobj);
360 struct bat_priv *bat_priv = netdev_priv(net_dev); 375 struct bat_priv *bat_priv = netdev_priv(net_dev);
361 char *curr_gw_mode_str; 376 char *curr_gw_mode_str;
362 int gw_mode_tmp = -1; 377 int gw_mode_tmp = -1;
@@ -405,10 +420,10 @@ static ssize_t store_gw_mode(struct kobject *kobj, struct attribute *attr,
405 return count; 420 return count;
406} 421}
407 422
408static ssize_t show_gw_bwidth(struct kobject *kobj, struct attribute *attr, 423static ssize_t batadv_show_gw_bwidth(struct kobject *kobj,
409 char *buff) 424 struct attribute *attr, char *buff)
410{ 425{
411 struct bat_priv *bat_priv = kobj_to_batpriv(kobj); 426 struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj);
412 int down, up; 427 int down, up;
413 int gw_bandwidth = atomic_read(&bat_priv->gw_bandwidth); 428 int gw_bandwidth = atomic_read(&bat_priv->gw_bandwidth);
414 429
@@ -420,10 +435,11 @@ static ssize_t show_gw_bwidth(struct kobject *kobj, struct attribute *attr,
420 (up > 2048 ? "MBit" : "KBit")); 435 (up > 2048 ? "MBit" : "KBit"));
421} 436}
422 437
423static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr, 438static ssize_t batadv_store_gw_bwidth(struct kobject *kobj,
424 char *buff, size_t count) 439 struct attribute *attr, char *buff,
440 size_t count)
425{ 441{
426 struct net_device *net_dev = kobj_to_netdev(kobj); 442 struct net_device *net_dev = batadv_kobj_to_netdev(kobj);
427 443
428 if (buff[count - 1] == '\n') 444 if (buff[count - 1] == '\n')
429 buff[count - 1] = '\0'; 445 buff[count - 1] = '\0';
@@ -438,36 +454,38 @@ BAT_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL);
438#endif 454#endif
439BAT_ATTR_SIF_BOOL(fragmentation, S_IRUGO | S_IWUSR, batadv_update_min_mtu); 455BAT_ATTR_SIF_BOOL(fragmentation, S_IRUGO | S_IWUSR, batadv_update_min_mtu);
440BAT_ATTR_SIF_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); 456BAT_ATTR_SIF_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL);
441static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode); 457static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, batadv_show_vis_mode,
442static BAT_ATTR(routing_algo, S_IRUGO, show_bat_algo, NULL); 458 batadv_store_vis_mode);
443static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, show_gw_mode, store_gw_mode); 459static BAT_ATTR(routing_algo, S_IRUGO, batadv_show_bat_algo, NULL);
460static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, batadv_show_gw_mode,
461 batadv_store_gw_mode);
444BAT_ATTR_SIF_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * JITTER, INT_MAX, NULL); 462BAT_ATTR_SIF_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * JITTER, INT_MAX, NULL);
445BAT_ATTR_SIF_UINT(hop_penalty, S_IRUGO | S_IWUSR, 0, TQ_MAX_VALUE, NULL); 463BAT_ATTR_SIF_UINT(hop_penalty, S_IRUGO | S_IWUSR, 0, TQ_MAX_VALUE, NULL);
446BAT_ATTR_SIF_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, TQ_MAX_VALUE, 464BAT_ATTR_SIF_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, TQ_MAX_VALUE,
447 post_gw_deselect); 465 batadv_post_gw_deselect);
448static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, show_gw_bwidth, 466static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth,
449 store_gw_bwidth); 467 batadv_store_gw_bwidth);
450#ifdef CONFIG_BATMAN_ADV_DEBUG 468#ifdef CONFIG_BATMAN_ADV_DEBUG
451BAT_ATTR_SIF_UINT(log_level, S_IRUGO | S_IWUSR, 0, DBG_ALL, NULL); 469BAT_ATTR_SIF_UINT(log_level, S_IRUGO | S_IWUSR, 0, DBG_ALL, NULL);
452#endif 470#endif
453 471
454static struct bat_attribute *mesh_attrs[] = { 472static struct bat_attribute *batadv_mesh_attrs[] = {
455 &bat_attr_aggregated_ogms, 473 &batadv_attr_aggregated_ogms,
456 &bat_attr_bonding, 474 &batadv_attr_bonding,
457#ifdef CONFIG_BATMAN_ADV_BLA 475#ifdef CONFIG_BATMAN_ADV_BLA
458 &bat_attr_bridge_loop_avoidance, 476 &batadv_attr_bridge_loop_avoidance,
459#endif 477#endif
460 &bat_attr_fragmentation, 478 &batadv_attr_fragmentation,
461 &bat_attr_ap_isolation, 479 &batadv_attr_ap_isolation,
462 &bat_attr_vis_mode, 480 &batadv_attr_vis_mode,
463 &bat_attr_routing_algo, 481 &batadv_attr_routing_algo,
464 &bat_attr_gw_mode, 482 &batadv_attr_gw_mode,
465 &bat_attr_orig_interval, 483 &batadv_attr_orig_interval,
466 &bat_attr_hop_penalty, 484 &batadv_attr_hop_penalty,
467 &bat_attr_gw_sel_class, 485 &batadv_attr_gw_sel_class,
468 &bat_attr_gw_bandwidth, 486 &batadv_attr_gw_bandwidth,
469#ifdef CONFIG_BATMAN_ADV_DEBUG 487#ifdef CONFIG_BATMAN_ADV_DEBUG
470 &bat_attr_log_level, 488 &batadv_attr_log_level,
471#endif 489#endif
472 NULL, 490 NULL,
473}; 491};
@@ -487,7 +505,7 @@ int batadv_sysfs_add_meshif(struct net_device *dev)
487 goto out; 505 goto out;
488 } 506 }
489 507
490 for (bat_attr = mesh_attrs; *bat_attr; ++bat_attr) { 508 for (bat_attr = batadv_mesh_attrs; *bat_attr; ++bat_attr) {
491 err = sysfs_create_file(bat_priv->mesh_obj, 509 err = sysfs_create_file(bat_priv->mesh_obj,
492 &((*bat_attr)->attr)); 510 &((*bat_attr)->attr));
493 if (err) { 511 if (err) {
@@ -501,7 +519,7 @@ int batadv_sysfs_add_meshif(struct net_device *dev)
501 return 0; 519 return 0;
502 520
503rem_attr: 521rem_attr:
504 for (bat_attr = mesh_attrs; *bat_attr; ++bat_attr) 522 for (bat_attr = batadv_mesh_attrs; *bat_attr; ++bat_attr)
505 sysfs_remove_file(bat_priv->mesh_obj, &((*bat_attr)->attr)); 523 sysfs_remove_file(bat_priv->mesh_obj, &((*bat_attr)->attr));
506 524
507 kobject_put(bat_priv->mesh_obj); 525 kobject_put(bat_priv->mesh_obj);
@@ -515,17 +533,17 @@ void batadv_sysfs_del_meshif(struct net_device *dev)
515 struct bat_priv *bat_priv = netdev_priv(dev); 533 struct bat_priv *bat_priv = netdev_priv(dev);
516 struct bat_attribute **bat_attr; 534 struct bat_attribute **bat_attr;
517 535
518 for (bat_attr = mesh_attrs; *bat_attr; ++bat_attr) 536 for (bat_attr = batadv_mesh_attrs; *bat_attr; ++bat_attr)
519 sysfs_remove_file(bat_priv->mesh_obj, &((*bat_attr)->attr)); 537 sysfs_remove_file(bat_priv->mesh_obj, &((*bat_attr)->attr));
520 538
521 kobject_put(bat_priv->mesh_obj); 539 kobject_put(bat_priv->mesh_obj);
522 bat_priv->mesh_obj = NULL; 540 bat_priv->mesh_obj = NULL;
523} 541}
524 542
525static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr, 543static ssize_t batadv_show_mesh_iface(struct kobject *kobj,
526 char *buff) 544 struct attribute *attr, char *buff)
527{ 545{
528 struct net_device *net_dev = kobj_to_netdev(kobj); 546 struct net_device *net_dev = batadv_kobj_to_netdev(kobj);
529 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev); 547 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev);
530 ssize_t length; 548 ssize_t length;
531 549
@@ -540,10 +558,11 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
540 return length; 558 return length;
541} 559}
542 560
543static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr, 561static ssize_t batadv_store_mesh_iface(struct kobject *kobj,
544 char *buff, size_t count) 562 struct attribute *attr, char *buff,
563 size_t count)
545{ 564{
546 struct net_device *net_dev = kobj_to_netdev(kobj); 565 struct net_device *net_dev = batadv_kobj_to_netdev(kobj);
547 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev); 566 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev);
548 int status_tmp = -1; 567 int status_tmp = -1;
549 int ret = count; 568 int ret = count;
@@ -596,10 +615,10 @@ out:
596 return ret; 615 return ret;
597} 616}
598 617
599static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr, 618static ssize_t batadv_show_iface_status(struct kobject *kobj,
600 char *buff) 619 struct attribute *attr, char *buff)
601{ 620{
602 struct net_device *net_dev = kobj_to_netdev(kobj); 621 struct net_device *net_dev = batadv_kobj_to_netdev(kobj);
603 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev); 622 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev);
604 ssize_t length; 623 ssize_t length;
605 624
@@ -631,12 +650,12 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
631} 650}
632 651
633static BAT_ATTR(mesh_iface, S_IRUGO | S_IWUSR, 652static BAT_ATTR(mesh_iface, S_IRUGO | S_IWUSR,
634 show_mesh_iface, store_mesh_iface); 653 batadv_show_mesh_iface, batadv_store_mesh_iface);
635static BAT_ATTR(iface_status, S_IRUGO, show_iface_status, NULL); 654static BAT_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL);
636 655
637static struct bat_attribute *batman_attrs[] = { 656static struct bat_attribute *batadv_batman_attrs[] = {
638 &bat_attr_mesh_iface, 657 &batadv_attr_mesh_iface,
639 &bat_attr_iface_status, 658 &batadv_attr_iface_status,
640 NULL, 659 NULL,
641}; 660};
642 661
@@ -655,7 +674,7 @@ int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev)
655 goto out; 674 goto out;
656 } 675 }
657 676
658 for (bat_attr = batman_attrs; *bat_attr; ++bat_attr) { 677 for (bat_attr = batadv_batman_attrs; *bat_attr; ++bat_attr) {
659 err = sysfs_create_file(*hardif_obj, &((*bat_attr)->attr)); 678 err = sysfs_create_file(*hardif_obj, &((*bat_attr)->attr));
660 if (err) { 679 if (err) {
661 bat_err(dev, "Can't add sysfs file: %s/%s/%s\n", 680 bat_err(dev, "Can't add sysfs file: %s/%s/%s\n",
@@ -668,7 +687,7 @@ int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev)
668 return 0; 687 return 0;
669 688
670rem_attr: 689rem_attr:
671 for (bat_attr = batman_attrs; *bat_attr; ++bat_attr) 690 for (bat_attr = batadv_batman_attrs; *bat_attr; ++bat_attr)
672 sysfs_remove_file(*hardif_obj, &((*bat_attr)->attr)); 691 sysfs_remove_file(*hardif_obj, &((*bat_attr)->attr));
673out: 692out:
674 return -ENOMEM; 693 return -ENOMEM;
@@ -695,20 +714,21 @@ int batadv_throw_uevent(struct bat_priv *bat_priv, enum uev_type type,
695 bat_kobj = &primary_if->soft_iface->dev.kobj; 714 bat_kobj = &primary_if->soft_iface->dev.kobj;
696 715
697 uevent_env[0] = kmalloc(strlen(UEV_TYPE_VAR) + 716 uevent_env[0] = kmalloc(strlen(UEV_TYPE_VAR) +
698 strlen(uev_type_str[type]) + 1, 717 strlen(batadv_uev_type_str[type]) + 1,
699 GFP_ATOMIC); 718 GFP_ATOMIC);
700 if (!uevent_env[0]) 719 if (!uevent_env[0])
701 goto out; 720 goto out;
702 721
703 sprintf(uevent_env[0], "%s%s", UEV_TYPE_VAR, uev_type_str[type]); 722 sprintf(uevent_env[0], "%s%s", UEV_TYPE_VAR, batadv_uev_type_str[type]);
704 723
705 uevent_env[1] = kmalloc(strlen(UEV_ACTION_VAR) + 724 uevent_env[1] = kmalloc(strlen(UEV_ACTION_VAR) +
706 strlen(uev_action_str[action]) + 1, 725 strlen(batadv_uev_action_str[action]) + 1,
707 GFP_ATOMIC); 726 GFP_ATOMIC);
708 if (!uevent_env[1]) 727 if (!uevent_env[1])
709 goto out; 728 goto out;
710 729
711 sprintf(uevent_env[1], "%s%s", UEV_ACTION_VAR, uev_action_str[action]); 730 sprintf(uevent_env[1], "%s%s", UEV_ACTION_VAR,
731 batadv_uev_action_str[action]);
712 732
713 /* If the event is DEL, ignore the data field */ 733 /* If the event is DEL, ignore the data field */
714 if (action != UEV_DEL) { 734 if (action != UEV_DEL) {
@@ -732,7 +752,8 @@ out:
732 if (ret) 752 if (ret)
733 batadv_dbg(DBG_BATMAN, bat_priv, 753 batadv_dbg(DBG_BATMAN, bat_priv,
734 "Impossible to send uevent for (%s,%s,%s) event (err: %d)\n", 754 "Impossible to send uevent for (%s,%s,%s) event (err: %d)\n",
735 uev_type_str[type], uev_action_str[action], 755 batadv_uev_type_str[type],
756 batadv_uev_action_str[action],
736 (action == UEV_DEL ? "NULL" : data), ret); 757 (action == UEV_DEL ? "NULL" : data), ret);
737 return ret; 758 return ret;
738} 759}