aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/bat_sysfs.c
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2012-03-10 17:17:51 -0500
committerAntonio Quartulli <ordex@autistici.org>2012-05-11 07:56:02 -0400
commitf245c38ba74e1433294b5f41c9d6eb3e97b88e5b (patch)
treed1ffb1e1c8585876909d64449a9e8bb99d379c12 /net/batman-adv/bat_sysfs.c
parentc32293983d836ed6cbc5e8b58cb8cd10b26a774e (diff)
batman-adv: rename sysfs macros to reflect the soft-interface dependency
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/bat_sysfs.c')
-rw-r--r--net/batman-adv/bat_sysfs.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 2c816883ca13..913299d03f4a 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -63,7 +63,7 @@ struct bat_attribute bat_attr_##_name = { \
63 .store = _store, \ 63 .store = _store, \
64}; 64};
65 65
66#define BAT_ATTR_STORE_BOOL(_name, _post_func) \ 66#define BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \
67ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \ 67ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
68 char *buff, size_t count) \ 68 char *buff, size_t count) \
69{ \ 69{ \
@@ -73,9 +73,9 @@ ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
73 &bat_priv->_name, net_dev); \ 73 &bat_priv->_name, net_dev); \
74} 74}
75 75
76#define BAT_ATTR_SHOW_BOOL(_name) \ 76#define BAT_ATTR_SIF_SHOW_BOOL(_name) \
77ssize_t show_##_name(struct kobject *kobj, struct attribute *attr, \ 77ssize_t show_##_name(struct kobject *kobj, \
78 char *buff) \ 78 struct attribute *attr, char *buff) \
79{ \ 79{ \
80 struct bat_priv *bat_priv = kobj_to_batpriv(kobj); \ 80 struct bat_priv *bat_priv = kobj_to_batpriv(kobj); \
81 return sprintf(buff, "%s\n", \ 81 return sprintf(buff, "%s\n", \
@@ -83,16 +83,17 @@ ssize_t show_##_name(struct kobject *kobj, struct attribute *attr, \
83 "disabled" : "enabled"); \ 83 "disabled" : "enabled"); \
84} \ 84} \
85 85
86/* Use this, if you are going to turn a [name] in bat_priv on or off */ 86/* Use this, if you are going to turn a [name] in the soft-interface
87#define BAT_ATTR_BOOL(_name, _mode, _post_func) \ 87 * (bat_priv) on or off */
88 static BAT_ATTR_STORE_BOOL(_name, _post_func) \ 88#define BAT_ATTR_SIF_BOOL(_name, _mode, _post_func) \
89 static BAT_ATTR_SHOW_BOOL(_name) \ 89 static BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \
90 static BAT_ATTR_SIF_SHOW_BOOL(_name) \
90 static BAT_ATTR(_name, _mode, show_##_name, store_##_name) 91 static BAT_ATTR(_name, _mode, show_##_name, store_##_name)
91 92
92 93
93#define BAT_ATTR_STORE_UINT(_name, _min, _max, _post_func) \ 94#define BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \
94ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \ 95ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
95 char *buff, size_t count) \ 96 char *buff, size_t count) \
96{ \ 97{ \
97 struct net_device *net_dev = kobj_to_netdev(kobj); \ 98 struct net_device *net_dev = kobj_to_netdev(kobj); \
98 struct bat_priv *bat_priv = netdev_priv(net_dev); \ 99 struct bat_priv *bat_priv = netdev_priv(net_dev); \
@@ -100,19 +101,19 @@ ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
100 attr, &bat_priv->_name, net_dev); \ 101 attr, &bat_priv->_name, net_dev); \
101} 102}
102 103
103#define BAT_ATTR_SHOW_UINT(_name) \ 104#define BAT_ATTR_SIF_SHOW_UINT(_name) \
104ssize_t show_##_name(struct kobject *kobj, struct attribute *attr, \ 105ssize_t show_##_name(struct kobject *kobj, \
105 char *buff) \ 106 struct attribute *attr, char *buff) \
106{ \ 107{ \
107 struct bat_priv *bat_priv = kobj_to_batpriv(kobj); \ 108 struct bat_priv *bat_priv = kobj_to_batpriv(kobj); \
108 return sprintf(buff, "%i\n", atomic_read(&bat_priv->_name)); \ 109 return sprintf(buff, "%i\n", atomic_read(&bat_priv->_name)); \
109} \ 110} \
110 111
111/* Use this, if you are going to set [name] in bat_priv to unsigned integer 112/* Use this, if you are going to set [name] in the soft-interface
112 * values only */ 113 * (bat_priv) to an unsigned integer value */
113#define BAT_ATTR_UINT(_name, _mode, _min, _max, _post_func) \ 114#define BAT_ATTR_SIF_UINT(_name, _mode, _min, _max, _post_func) \
114 static BAT_ATTR_STORE_UINT(_name, _min, _max, _post_func) \ 115 static BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \
115 static BAT_ATTR_SHOW_UINT(_name) \ 116 static BAT_ATTR_SIF_SHOW_UINT(_name) \
116 static BAT_ATTR(_name, _mode, show_##_name, store_##_name) 117 static BAT_ATTR(_name, _mode, show_##_name, store_##_name)
117 118
118 119
@@ -384,24 +385,24 @@ static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr,
384 return gw_bandwidth_set(net_dev, buff, count); 385 return gw_bandwidth_set(net_dev, buff, count);
385} 386}
386 387
387BAT_ATTR_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); 388BAT_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL);
388BAT_ATTR_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); 389BAT_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL);
389#ifdef CONFIG_BATMAN_ADV_BLA 390#ifdef CONFIG_BATMAN_ADV_BLA
390BAT_ATTR_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL); 391BAT_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL);
391#endif 392#endif
392BAT_ATTR_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu); 393BAT_ATTR_SIF_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu);
393BAT_ATTR_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); 394BAT_ATTR_SIF_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL);
394static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode); 395static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode);
395static BAT_ATTR(routing_algo, S_IRUGO, show_bat_algo, NULL); 396static BAT_ATTR(routing_algo, S_IRUGO, show_bat_algo, NULL);
396static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, show_gw_mode, store_gw_mode); 397static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, show_gw_mode, store_gw_mode);
397BAT_ATTR_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * JITTER, INT_MAX, NULL); 398BAT_ATTR_SIF_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * JITTER, INT_MAX, NULL);
398BAT_ATTR_UINT(hop_penalty, S_IRUGO | S_IWUSR, 0, TQ_MAX_VALUE, NULL); 399BAT_ATTR_SIF_UINT(hop_penalty, S_IRUGO | S_IWUSR, 0, TQ_MAX_VALUE, NULL);
399BAT_ATTR_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, TQ_MAX_VALUE, 400BAT_ATTR_SIF_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, TQ_MAX_VALUE,
400 post_gw_deselect); 401 post_gw_deselect);
401static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, show_gw_bwidth, 402static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, show_gw_bwidth,
402 store_gw_bwidth); 403 store_gw_bwidth);
403#ifdef CONFIG_BATMAN_ADV_DEBUG 404#ifdef CONFIG_BATMAN_ADV_DEBUG
404BAT_ATTR_UINT(log_level, S_IRUGO | S_IWUSR, 0, 15, NULL); 405BAT_ATTR_SIF_UINT(log_level, S_IRUGO | S_IWUSR, 0, 15, NULL);
405#endif 406#endif
406 407
407static struct bat_attribute *mesh_attrs[] = { 408static struct bat_attribute *mesh_attrs[] = {