diff options
Diffstat (limited to 'net/batman-adv/bat_sysfs.c')
-rw-r--r-- | net/batman-adv/bat_sysfs.c | 114 |
1 files changed, 58 insertions, 56 deletions
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index 54429a222bd6..3862fe18a033 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
@@ -38,9 +38,9 @@ static struct bat_priv *batadv_kobj_to_batpriv(struct kobject *obj) | |||
38 | return netdev_priv(net_dev); | 38 | return netdev_priv(net_dev); |
39 | } | 39 | } |
40 | 40 | ||
41 | #define UEV_TYPE_VAR "BATTYPE=" | 41 | #define BATADV_UEV_TYPE_VAR "BATTYPE=" |
42 | #define UEV_ACTION_VAR "BATACTION=" | 42 | #define BATADV_UEV_ACTION_VAR "BATACTION=" |
43 | #define UEV_DATA_VAR "BATDATA=" | 43 | #define BATADV_UEV_DATA_VAR "BATDATA=" |
44 | 44 | ||
45 | static char *batadv_uev_action_str[] = { | 45 | static char *batadv_uev_action_str[] = { |
46 | "add", | 46 | "add", |
@@ -53,15 +53,15 @@ static char *batadv_uev_type_str[] = { | |||
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 BATADV_ATTR(_name, _mode, _show, _store) \ |
57 | struct bat_attribute batadv_attr_##_name = { \ | 57 | struct 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, \ |
61 | .store = _store, \ | 61 | .store = _store, \ |
62 | }; | 62 | }; |
63 | 63 | ||
64 | #define BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \ | 64 | #define BATADV_ATTR_SIF_STORE_BOOL(_name, _post_func) \ |
65 | ssize_t batadv_store_##_name(struct kobject *kobj, \ | 65 | ssize_t batadv_store_##_name(struct kobject *kobj, \ |
66 | struct attribute *attr, char *buff, \ | 66 | struct attribute *attr, char *buff, \ |
67 | size_t count) \ | 67 | size_t count) \ |
@@ -72,7 +72,7 @@ ssize_t batadv_store_##_name(struct kobject *kobj, \ | |||
72 | &bat_priv->_name, net_dev); \ | 72 | &bat_priv->_name, net_dev); \ |
73 | } | 73 | } |
74 | 74 | ||
75 | #define BAT_ATTR_SIF_SHOW_BOOL(_name) \ | 75 | #define BATADV_ATTR_SIF_SHOW_BOOL(_name) \ |
76 | ssize_t batadv_show_##_name(struct kobject *kobj, \ | 76 | ssize_t batadv_show_##_name(struct kobject *kobj, \ |
77 | struct attribute *attr, char *buff) \ | 77 | struct attribute *attr, char *buff) \ |
78 | { \ | 78 | { \ |
@@ -85,14 +85,14 @@ ssize_t batadv_show_##_name(struct kobject *kobj, \ | |||
85 | /* Use this, if you are going to turn a [name] in the soft-interface | 85 | /* Use this, if you are going to turn a [name] in the soft-interface |
86 | * (bat_priv) on or off | 86 | * (bat_priv) on or off |
87 | */ | 87 | */ |
88 | #define BAT_ATTR_SIF_BOOL(_name, _mode, _post_func) \ | 88 | #define BATADV_ATTR_SIF_BOOL(_name, _mode, _post_func) \ |
89 | static BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \ | 89 | static BATADV_ATTR_SIF_STORE_BOOL(_name, _post_func) \ |
90 | static BAT_ATTR_SIF_SHOW_BOOL(_name) \ | 90 | static BATADV_ATTR_SIF_SHOW_BOOL(_name) \ |
91 | static BAT_ATTR(_name, _mode, batadv_show_##_name, \ | 91 | static BATADV_ATTR(_name, _mode, batadv_show_##_name, \ |
92 | batadv_store_##_name) | 92 | batadv_store_##_name) |
93 | 93 | ||
94 | 94 | ||
95 | #define BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ | 95 | #define BATADV_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ |
96 | ssize_t batadv_store_##_name(struct kobject *kobj, \ | 96 | ssize_t batadv_store_##_name(struct kobject *kobj, \ |
97 | struct attribute *attr, char *buff, \ | 97 | struct attribute *attr, char *buff, \ |
98 | size_t count) \ | 98 | size_t count) \ |
@@ -104,7 +104,7 @@ ssize_t batadv_store_##_name(struct kobject *kobj, \ | |||
104 | &bat_priv->_name, net_dev); \ | 104 | &bat_priv->_name, net_dev); \ |
105 | } | 105 | } |
106 | 106 | ||
107 | #define BAT_ATTR_SIF_SHOW_UINT(_name) \ | 107 | #define BATADV_ATTR_SIF_SHOW_UINT(_name) \ |
108 | ssize_t batadv_show_##_name(struct kobject *kobj, \ | 108 | ssize_t batadv_show_##_name(struct kobject *kobj, \ |
109 | struct attribute *attr, char *buff) \ | 109 | struct attribute *attr, char *buff) \ |
110 | { \ | 110 | { \ |
@@ -115,14 +115,14 @@ ssize_t batadv_show_##_name(struct kobject *kobj, \ | |||
115 | /* Use this, if you are going to set [name] in the soft-interface | 115 | /* Use this, if you are going to set [name] in the soft-interface |
116 | * (bat_priv) to an unsigned integer value | 116 | * (bat_priv) to an unsigned integer value |
117 | */ | 117 | */ |
118 | #define BAT_ATTR_SIF_UINT(_name, _mode, _min, _max, _post_func) \ | 118 | #define BATADV_ATTR_SIF_UINT(_name, _mode, _min, _max, _post_func) \ |
119 | static BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ | 119 | static BATADV_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func)\ |
120 | static BAT_ATTR_SIF_SHOW_UINT(_name) \ | 120 | static BATADV_ATTR_SIF_SHOW_UINT(_name) \ |
121 | static BAT_ATTR(_name, _mode, batadv_show_##_name, \ | 121 | static BATADV_ATTR(_name, _mode, batadv_show_##_name, \ |
122 | batadv_store_##_name) | 122 | batadv_store_##_name) |
123 | 123 | ||
124 | 124 | ||
125 | #define BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ | 125 | #define BATADV_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ |
126 | ssize_t batadv_store_##_name(struct kobject *kobj, \ | 126 | ssize_t batadv_store_##_name(struct kobject *kobj, \ |
127 | struct attribute *attr, char *buff, \ | 127 | struct attribute *attr, char *buff, \ |
128 | size_t count) \ | 128 | size_t count) \ |
@@ -143,7 +143,7 @@ ssize_t batadv_store_##_name(struct kobject *kobj, \ | |||
143 | return length; \ | 143 | return length; \ |
144 | } | 144 | } |
145 | 145 | ||
146 | #define BAT_ATTR_HIF_SHOW_UINT(_name) \ | 146 | #define BATADV_ATTR_HIF_SHOW_UINT(_name) \ |
147 | ssize_t batadv_show_##_name(struct kobject *kobj, \ | 147 | ssize_t batadv_show_##_name(struct kobject *kobj, \ |
148 | struct attribute *attr, char *buff) \ | 148 | struct attribute *attr, char *buff) \ |
149 | { \ | 149 | { \ |
@@ -164,11 +164,11 @@ ssize_t batadv_show_##_name(struct kobject *kobj, \ | |||
164 | /* Use this, if you are going to set [name] in hard_iface to an | 164 | /* Use this, if you are going to set [name] in hard_iface to an |
165 | * unsigned integer value | 165 | * unsigned integer value |
166 | */ | 166 | */ |
167 | #define BAT_ATTR_HIF_UINT(_name, _mode, _min, _max, _post_func) \ | 167 | #define BATADV_ATTR_HIF_UINT(_name, _mode, _min, _max, _post_func) \ |
168 | static BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ | 168 | static BATADV_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func)\ |
169 | static BAT_ATTR_HIF_SHOW_UINT(_name) \ | 169 | static BATADV_ATTR_HIF_SHOW_UINT(_name) \ |
170 | static BAT_ATTR(_name, _mode, batadv_show_##_name, \ | 170 | static BATADV_ATTR(_name, _mode, batadv_show_##_name, \ |
171 | batadv_store_##_name) | 171 | batadv_store_##_name) |
172 | 172 | ||
173 | 173 | ||
174 | static int batadv_store_bool_attr(char *buff, size_t count, | 174 | static int batadv_store_bool_attr(char *buff, size_t count, |
@@ -454,26 +454,27 @@ static ssize_t batadv_store_gw_bwidth(struct kobject *kobj, | |||
454 | return batadv_gw_bandwidth_set(net_dev, buff, count); | 454 | return batadv_gw_bandwidth_set(net_dev, buff, count); |
455 | } | 455 | } |
456 | 456 | ||
457 | BAT_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); | 457 | BATADV_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); |
458 | BAT_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); | 458 | BATADV_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); |
459 | #ifdef CONFIG_BATMAN_ADV_BLA | 459 | #ifdef CONFIG_BATMAN_ADV_BLA |
460 | BAT_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL); | 460 | BATADV_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL); |
461 | #endif | 461 | #endif |
462 | BAT_ATTR_SIF_BOOL(fragmentation, S_IRUGO | S_IWUSR, batadv_update_min_mtu); | 462 | BATADV_ATTR_SIF_BOOL(fragmentation, S_IRUGO | S_IWUSR, batadv_update_min_mtu); |
463 | BAT_ATTR_SIF_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); | 463 | BATADV_ATTR_SIF_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); |
464 | static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, batadv_show_vis_mode, | 464 | static BATADV_ATTR(vis_mode, S_IRUGO | S_IWUSR, batadv_show_vis_mode, |
465 | batadv_store_vis_mode); | 465 | batadv_store_vis_mode); |
466 | static BAT_ATTR(routing_algo, S_IRUGO, batadv_show_bat_algo, NULL); | 466 | static BATADV_ATTR(routing_algo, S_IRUGO, batadv_show_bat_algo, NULL); |
467 | static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, batadv_show_gw_mode, | 467 | static BATADV_ATTR(gw_mode, S_IRUGO | S_IWUSR, batadv_show_gw_mode, |
468 | batadv_store_gw_mode); | 468 | batadv_store_gw_mode); |
469 | BAT_ATTR_SIF_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * JITTER, INT_MAX, NULL); | 469 | BATADV_ATTR_SIF_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * JITTER, INT_MAX, |
470 | BAT_ATTR_SIF_UINT(hop_penalty, S_IRUGO | S_IWUSR, 0, TQ_MAX_VALUE, NULL); | 470 | NULL); |
471 | BAT_ATTR_SIF_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, TQ_MAX_VALUE, | 471 | BATADV_ATTR_SIF_UINT(hop_penalty, S_IRUGO | S_IWUSR, 0, TQ_MAX_VALUE, NULL); |
472 | batadv_post_gw_deselect); | 472 | BATADV_ATTR_SIF_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, TQ_MAX_VALUE, |
473 | static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth, | 473 | batadv_post_gw_deselect); |
474 | batadv_store_gw_bwidth); | 474 | static BATADV_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth, |
475 | batadv_store_gw_bwidth); | ||
475 | #ifdef CONFIG_BATMAN_ADV_DEBUG | 476 | #ifdef CONFIG_BATMAN_ADV_DEBUG |
476 | BAT_ATTR_SIF_UINT(log_level, S_IRUGO | S_IWUSR, 0, DBG_ALL, NULL); | 477 | BATADV_ATTR_SIF_UINT(log_level, S_IRUGO | S_IWUSR, 0, DBG_ALL, NULL); |
477 | #endif | 478 | #endif |
478 | 479 | ||
479 | static struct bat_attribute *batadv_mesh_attrs[] = { | 480 | static struct bat_attribute *batadv_mesh_attrs[] = { |
@@ -656,9 +657,9 @@ static ssize_t batadv_show_iface_status(struct kobject *kobj, | |||
656 | return length; | 657 | return length; |
657 | } | 658 | } |
658 | 659 | ||
659 | static BAT_ATTR(mesh_iface, S_IRUGO | S_IWUSR, | 660 | static BATADV_ATTR(mesh_iface, S_IRUGO | S_IWUSR, batadv_show_mesh_iface, |
660 | batadv_show_mesh_iface, batadv_store_mesh_iface); | 661 | batadv_store_mesh_iface); |
661 | static BAT_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL); | 662 | static BATADV_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL); |
662 | 663 | ||
663 | static struct bat_attribute *batadv_batman_attrs[] = { | 664 | static struct bat_attribute *batadv_batman_attrs[] = { |
664 | &batadv_attr_mesh_iface, | 665 | &batadv_attr_mesh_iface, |
@@ -720,31 +721,32 @@ int batadv_throw_uevent(struct bat_priv *bat_priv, enum uev_type type, | |||
720 | 721 | ||
721 | bat_kobj = &primary_if->soft_iface->dev.kobj; | 722 | bat_kobj = &primary_if->soft_iface->dev.kobj; |
722 | 723 | ||
723 | uevent_env[0] = kmalloc(strlen(UEV_TYPE_VAR) + | 724 | uevent_env[0] = kmalloc(strlen(BATADV_UEV_TYPE_VAR) + |
724 | strlen(batadv_uev_type_str[type]) + 1, | 725 | strlen(batadv_uev_type_str[type]) + 1, |
725 | GFP_ATOMIC); | 726 | GFP_ATOMIC); |
726 | if (!uevent_env[0]) | 727 | if (!uevent_env[0]) |
727 | goto out; | 728 | goto out; |
728 | 729 | ||
729 | sprintf(uevent_env[0], "%s%s", UEV_TYPE_VAR, batadv_uev_type_str[type]); | 730 | sprintf(uevent_env[0], "%s%s", BATADV_UEV_TYPE_VAR, |
731 | batadv_uev_type_str[type]); | ||
730 | 732 | ||
731 | uevent_env[1] = kmalloc(strlen(UEV_ACTION_VAR) + | 733 | uevent_env[1] = kmalloc(strlen(BATADV_UEV_ACTION_VAR) + |
732 | strlen(batadv_uev_action_str[action]) + 1, | 734 | strlen(batadv_uev_action_str[action]) + 1, |
733 | GFP_ATOMIC); | 735 | GFP_ATOMIC); |
734 | if (!uevent_env[1]) | 736 | if (!uevent_env[1]) |
735 | goto out; | 737 | goto out; |
736 | 738 | ||
737 | sprintf(uevent_env[1], "%s%s", UEV_ACTION_VAR, | 739 | sprintf(uevent_env[1], "%s%s", BATADV_UEV_ACTION_VAR, |
738 | batadv_uev_action_str[action]); | 740 | batadv_uev_action_str[action]); |
739 | 741 | ||
740 | /* If the event is DEL, ignore the data field */ | 742 | /* If the event is DEL, ignore the data field */ |
741 | if (action != UEV_DEL) { | 743 | if (action != UEV_DEL) { |
742 | uevent_env[2] = kmalloc(strlen(UEV_DATA_VAR) + | 744 | uevent_env[2] = kmalloc(strlen(BATADV_UEV_DATA_VAR) + |
743 | strlen(data) + 1, GFP_ATOMIC); | 745 | strlen(data) + 1, GFP_ATOMIC); |
744 | if (!uevent_env[2]) | 746 | if (!uevent_env[2]) |
745 | goto out; | 747 | goto out; |
746 | 748 | ||
747 | sprintf(uevent_env[2], "%s%s", UEV_DATA_VAR, data); | 749 | sprintf(uevent_env[2], "%s%s", BATADV_UEV_DATA_VAR, data); |
748 | } | 750 | } |
749 | 751 | ||
750 | ret = kobject_uevent_env(bat_kobj, KOBJ_CHANGE, uevent_env); | 752 | ret = kobject_uevent_env(bat_kobj, KOBJ_CHANGE, uevent_env); |