diff options
27 files changed, 166 insertions, 157 deletions
diff --git a/net/batman-adv/aggregation.c b/net/batman-adv/aggregation.c index a8c32030527c..f8ccb49bf87e 100644 --- a/net/batman-adv/aggregation.c +++ b/net/batman-adv/aggregation.c | |||
@@ -26,18 +26,18 @@ | |||
26 | #include "hard-interface.h" | 26 | #include "hard-interface.h" |
27 | 27 | ||
28 | /* calculate the size of the tt information for a given packet */ | 28 | /* calculate the size of the tt information for a given packet */ |
29 | static int tt_len(struct batman_packet *batman_packet) | 29 | static int tt_len(const struct batman_packet *batman_packet) |
30 | { | 30 | { |
31 | return batman_packet->num_tt * ETH_ALEN; | 31 | return batman_packet->num_tt * ETH_ALEN; |
32 | } | 32 | } |
33 | 33 | ||
34 | /* return true if new_packet can be aggregated with forw_packet */ | 34 | /* return true if new_packet can be aggregated with forw_packet */ |
35 | static bool can_aggregate_with(struct batman_packet *new_batman_packet, | 35 | static bool can_aggregate_with(const struct batman_packet *new_batman_packet, |
36 | int packet_len, | 36 | int packet_len, |
37 | unsigned long send_time, | 37 | unsigned long send_time, |
38 | bool directlink, | 38 | bool directlink, |
39 | struct hard_iface *if_incoming, | 39 | const struct hard_iface *if_incoming, |
40 | struct forw_packet *forw_packet) | 40 | const struct forw_packet *forw_packet) |
41 | { | 41 | { |
42 | struct batman_packet *batman_packet = | 42 | struct batman_packet *batman_packet = |
43 | (struct batman_packet *)forw_packet->skb->data; | 43 | (struct batman_packet *)forw_packet->skb->data; |
@@ -97,8 +97,9 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet, | |||
97 | } | 97 | } |
98 | 98 | ||
99 | /* create a new aggregated packet and add this packet to it */ | 99 | /* create a new aggregated packet and add this packet to it */ |
100 | static void new_aggregated_packet(unsigned char *packet_buff, int packet_len, | 100 | static void new_aggregated_packet(const unsigned char *packet_buff, |
101 | unsigned long send_time, bool direct_link, | 101 | int packet_len, unsigned long send_time, |
102 | bool direct_link, | ||
102 | struct hard_iface *if_incoming, | 103 | struct hard_iface *if_incoming, |
103 | int own_packet) | 104 | int own_packet) |
104 | { | 105 | { |
@@ -176,8 +177,7 @@ out: | |||
176 | 177 | ||
177 | /* aggregate a new packet into the existing aggregation */ | 178 | /* aggregate a new packet into the existing aggregation */ |
178 | static void aggregate(struct forw_packet *forw_packet_aggr, | 179 | static void aggregate(struct forw_packet *forw_packet_aggr, |
179 | unsigned char *packet_buff, | 180 | const unsigned char *packet_buff, int packet_len, |
180 | int packet_len, | ||
181 | bool direct_link) | 181 | bool direct_link) |
182 | { | 182 | { |
183 | unsigned char *skb_buff; | 183 | unsigned char *skb_buff; |
@@ -253,8 +253,9 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv, | |||
253 | } | 253 | } |
254 | 254 | ||
255 | /* unpack the aggregated packets and process them one by one */ | 255 | /* unpack the aggregated packets and process them one by one */ |
256 | void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, | 256 | void receive_aggr_bat_packet(const struct ethhdr *ethhdr, |
257 | int packet_len, struct hard_iface *if_incoming) | 257 | unsigned char *packet_buff, int packet_len, |
258 | struct hard_iface *if_incoming) | ||
258 | { | 259 | { |
259 | struct batman_packet *batman_packet; | 260 | struct batman_packet *batman_packet; |
260 | int buff_pos = 0; | 261 | int buff_pos = 0; |
diff --git a/net/batman-adv/aggregation.h b/net/batman-adv/aggregation.h index 7e6d72fbf540..fedeb8d0e13f 100644 --- a/net/batman-adv/aggregation.h +++ b/net/batman-adv/aggregation.h | |||
@@ -37,7 +37,8 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv, | |||
37 | unsigned char *packet_buff, int packet_len, | 37 | unsigned char *packet_buff, int packet_len, |
38 | struct hard_iface *if_incoming, char own_packet, | 38 | struct hard_iface *if_incoming, char own_packet, |
39 | unsigned long send_time); | 39 | unsigned long send_time); |
40 | void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, | 40 | void receive_aggr_bat_packet(const struct ethhdr *ethhdr, |
41 | int packet_len, struct hard_iface *if_incoming); | 41 | unsigned char *packet_buff, int packet_len, |
42 | struct hard_iface *if_incoming); | ||
42 | 43 | ||
43 | #endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */ | 44 | #endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */ |
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c index 628ab185e9ee..1049ae3f5367 100644 --- a/net/batman-adv/bat_debugfs.c +++ b/net/batman-adv/bat_debugfs.c | |||
@@ -51,7 +51,7 @@ static void emit_log_char(struct debug_log *debug_log, char c) | |||
51 | } | 51 | } |
52 | 52 | ||
53 | __printf(2, 3) | 53 | __printf(2, 3) |
54 | static int fdebug_log(struct debug_log *debug_log, char *fmt, ...) | 54 | static int fdebug_log(struct debug_log *debug_log, const char *fmt, ...) |
55 | { | 55 | { |
56 | va_list args; | 56 | va_list args; |
57 | static char debug_log_buf[256]; | 57 | static char debug_log_buf[256]; |
@@ -75,7 +75,7 @@ static int fdebug_log(struct debug_log *debug_log, char *fmt, ...) | |||
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | int debug_log(struct bat_priv *bat_priv, char *fmt, ...) | 78 | int debug_log(struct bat_priv *bat_priv, const char *fmt, ...) |
79 | { | 79 | { |
80 | va_list args; | 80 | va_list args; |
81 | char tmp_log_buf[256]; | 81 | char tmp_log_buf[256]; |
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index 497a0700cc3c..6f70560ef508 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
@@ -96,7 +96,7 @@ ssize_t show_##_name(struct kobject *kobj, struct attribute *attr, \ | |||
96 | 96 | ||
97 | static int store_bool_attr(char *buff, size_t count, | 97 | static int store_bool_attr(char *buff, size_t count, |
98 | struct net_device *net_dev, | 98 | struct net_device *net_dev, |
99 | char *attr_name, atomic_t *attr) | 99 | const char *attr_name, atomic_t *attr) |
100 | { | 100 | { |
101 | int enabled = -1; | 101 | int enabled = -1; |
102 | 102 | ||
@@ -138,16 +138,15 @@ static inline ssize_t __store_bool_attr(char *buff, size_t count, | |||
138 | { | 138 | { |
139 | int ret; | 139 | int ret; |
140 | 140 | ||
141 | ret = store_bool_attr(buff, count, net_dev, (char *)attr->name, | 141 | ret = store_bool_attr(buff, count, net_dev, attr->name, attr_store); |
142 | attr_store); | ||
143 | if (post_func && ret) | 142 | if (post_func && ret) |
144 | post_func(net_dev); | 143 | post_func(net_dev); |
145 | 144 | ||
146 | return ret; | 145 | return ret; |
147 | } | 146 | } |
148 | 147 | ||
149 | static int store_uint_attr(char *buff, size_t count, | 148 | static int store_uint_attr(const char *buff, size_t count, |
150 | struct net_device *net_dev, char *attr_name, | 149 | struct net_device *net_dev, const char *attr_name, |
151 | unsigned int min, unsigned int max, atomic_t *attr) | 150 | unsigned int min, unsigned int max, atomic_t *attr) |
152 | { | 151 | { |
153 | unsigned long uint_val; | 152 | unsigned long uint_val; |
@@ -183,15 +182,15 @@ static int store_uint_attr(char *buff, size_t count, | |||
183 | return count; | 182 | return count; |
184 | } | 183 | } |
185 | 184 | ||
186 | static inline ssize_t __store_uint_attr(char *buff, size_t count, | 185 | static inline ssize_t __store_uint_attr(const char *buff, size_t count, |
187 | int min, int max, | 186 | int min, int max, |
188 | void (*post_func)(struct net_device *), | 187 | void (*post_func)(struct net_device *), |
189 | struct attribute *attr, | 188 | const struct attribute *attr, |
190 | atomic_t *attr_store, struct net_device *net_dev) | 189 | atomic_t *attr_store, struct net_device *net_dev) |
191 | { | 190 | { |
192 | int ret; | 191 | int ret; |
193 | 192 | ||
194 | ret = store_uint_attr(buff, count, net_dev, (char *)attr->name, | 193 | ret = store_uint_attr(buff, count, net_dev, attr->name, |
195 | min, max, attr_store); | 194 | min, max, attr_store); |
196 | if (post_func && ret) | 195 | if (post_func && ret) |
197 | post_func(net_dev); | 196 | post_func(net_dev); |
diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c index ad2ca925b3e0..767e2379b1aa 100644 --- a/net/batman-adv/bitarray.c +++ b/net/batman-adv/bitarray.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | /* returns true if the corresponding bit in the given seq_bits indicates true | 27 | /* returns true if the corresponding bit in the given seq_bits indicates true |
28 | * and curr_seqno is within range of last_seqno */ | 28 | * and curr_seqno is within range of last_seqno */ |
29 | uint8_t get_bit_status(unsigned long *seq_bits, uint32_t last_seqno, | 29 | uint8_t get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno, |
30 | uint32_t curr_seqno) | 30 | uint32_t curr_seqno) |
31 | { | 31 | { |
32 | int32_t diff, word_offset, word_num; | 32 | int32_t diff, word_offset, word_num; |
@@ -190,7 +190,7 @@ char bit_get_packet(void *priv, unsigned long *seq_bits, | |||
190 | /* count the hamming weight, how many good packets did we receive? just count | 190 | /* count the hamming weight, how many good packets did we receive? just count |
191 | * the 1's. | 191 | * the 1's. |
192 | */ | 192 | */ |
193 | int bit_packet_count(unsigned long *seq_bits) | 193 | int bit_packet_count(const unsigned long *seq_bits) |
194 | { | 194 | { |
195 | int i, hamming = 0; | 195 | int i, hamming = 0; |
196 | 196 | ||
diff --git a/net/batman-adv/bitarray.h b/net/batman-adv/bitarray.h index 769c246d1fc1..e32eb2ddd2d2 100644 --- a/net/batman-adv/bitarray.h +++ b/net/batman-adv/bitarray.h | |||
@@ -26,8 +26,8 @@ | |||
26 | 26 | ||
27 | /* returns true if the corresponding bit in the given seq_bits indicates true | 27 | /* returns true if the corresponding bit in the given seq_bits indicates true |
28 | * and curr_seqno is within range of last_seqno */ | 28 | * and curr_seqno is within range of last_seqno */ |
29 | uint8_t get_bit_status(unsigned long *seq_bits, uint32_t last_seqno, | 29 | uint8_t get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno, |
30 | uint32_t curr_seqno); | 30 | uint32_t curr_seqno); |
31 | 31 | ||
32 | /* turn corresponding bit on, so we can remember that we got the packet */ | 32 | /* turn corresponding bit on, so we can remember that we got the packet */ |
33 | void bit_mark(unsigned long *seq_bits, int32_t n); | 33 | void bit_mark(unsigned long *seq_bits, int32_t n); |
@@ -39,6 +39,6 @@ char bit_get_packet(void *priv, unsigned long *seq_bits, | |||
39 | int32_t seq_num_diff, int8_t set_mark); | 39 | int32_t seq_num_diff, int8_t set_mark); |
40 | 40 | ||
41 | /* count the hamming weight, how many good packets did we receive? */ | 41 | /* count the hamming weight, how many good packets did we receive? */ |
42 | int bit_packet_count(unsigned long *seq_bits); | 42 | int bit_packet_count(const unsigned long *seq_bits); |
43 | 43 | ||
44 | #endif /* _NET_BATMAN_ADV_BITARRAY_H_ */ | 44 | #endif /* _NET_BATMAN_ADV_BITARRAY_H_ */ |
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index 6e036351dc3d..e9c7eb1a1f9d 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -393,8 +393,8 @@ void gw_node_purge(struct bat_priv *bat_priv) | |||
393 | /** | 393 | /** |
394 | * fails if orig_node has no router | 394 | * fails if orig_node has no router |
395 | */ | 395 | */ |
396 | static int _write_buffer_text(struct bat_priv *bat_priv, | 396 | static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq, |
397 | struct seq_file *seq, struct gw_node *gw_node) | 397 | const struct gw_node *gw_node) |
398 | { | 398 | { |
399 | struct gw_node *curr_gw; | 399 | struct gw_node *curr_gw; |
400 | struct neigh_node *router; | 400 | struct neigh_node *router; |
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index dfbfccc9fe40..915e12b820b9 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -46,7 +46,7 @@ void hardif_free_rcu(struct rcu_head *rcu) | |||
46 | kfree(hard_iface); | 46 | kfree(hard_iface); |
47 | } | 47 | } |
48 | 48 | ||
49 | struct hard_iface *hardif_get_by_netdev(struct net_device *net_dev) | 49 | struct hard_iface *hardif_get_by_netdev(const struct net_device *net_dev) |
50 | { | 50 | { |
51 | struct hard_iface *hard_iface; | 51 | struct hard_iface *hard_iface; |
52 | 52 | ||
@@ -64,7 +64,7 @@ out: | |||
64 | return hard_iface; | 64 | return hard_iface; |
65 | } | 65 | } |
66 | 66 | ||
67 | static int is_valid_iface(struct net_device *net_dev) | 67 | static int is_valid_iface(const struct net_device *net_dev) |
68 | { | 68 | { |
69 | if (net_dev->flags & IFF_LOOPBACK) | 69 | if (net_dev->flags & IFF_LOOPBACK) |
70 | return 0; | 70 | return 0; |
@@ -86,7 +86,7 @@ static int is_valid_iface(struct net_device *net_dev) | |||
86 | return 1; | 86 | return 1; |
87 | } | 87 | } |
88 | 88 | ||
89 | static struct hard_iface *hardif_get_active(struct net_device *soft_iface) | 89 | static struct hard_iface *hardif_get_active(const struct net_device *soft_iface) |
90 | { | 90 | { |
91 | struct hard_iface *hard_iface; | 91 | struct hard_iface *hard_iface; |
92 | 92 | ||
@@ -160,7 +160,7 @@ static void primary_if_select(struct bat_priv *bat_priv, | |||
160 | atomic_set(&bat_priv->tt_local_changed, 1); | 160 | atomic_set(&bat_priv->tt_local_changed, 1); |
161 | } | 161 | } |
162 | 162 | ||
163 | static bool hardif_is_iface_up(struct hard_iface *hard_iface) | 163 | static bool hardif_is_iface_up(const struct hard_iface *hard_iface) |
164 | { | 164 | { |
165 | if (hard_iface->net_dev->flags & IFF_UP) | 165 | if (hard_iface->net_dev->flags & IFF_UP) |
166 | return true; | 166 | return true; |
@@ -176,9 +176,9 @@ static void update_mac_addresses(struct hard_iface *hard_iface) | |||
176 | hard_iface->net_dev->dev_addr, ETH_ALEN); | 176 | hard_iface->net_dev->dev_addr, ETH_ALEN); |
177 | } | 177 | } |
178 | 178 | ||
179 | static void check_known_mac_addr(struct net_device *net_dev) | 179 | static void check_known_mac_addr(const struct net_device *net_dev) |
180 | { | 180 | { |
181 | struct hard_iface *hard_iface; | 181 | const struct hard_iface *hard_iface; |
182 | 182 | ||
183 | rcu_read_lock(); | 183 | rcu_read_lock(); |
184 | list_for_each_entry_rcu(hard_iface, &hardif_list, list) { | 184 | list_for_each_entry_rcu(hard_iface, &hardif_list, list) { |
@@ -204,8 +204,8 @@ static void check_known_mac_addr(struct net_device *net_dev) | |||
204 | 204 | ||
205 | int hardif_min_mtu(struct net_device *soft_iface) | 205 | int hardif_min_mtu(struct net_device *soft_iface) |
206 | { | 206 | { |
207 | struct bat_priv *bat_priv = netdev_priv(soft_iface); | 207 | const struct bat_priv *bat_priv = netdev_priv(soft_iface); |
208 | struct hard_iface *hard_iface; | 208 | const struct hard_iface *hard_iface; |
209 | /* allow big frames if all devices are capable to do so | 209 | /* allow big frames if all devices are capable to do so |
210 | * (have MTU > 1500 + BAT_HEADER_LEN) */ | 210 | * (have MTU > 1500 + BAT_HEADER_LEN) */ |
211 | int min_mtu = ETH_DATA_LEN; | 211 | int min_mtu = ETH_DATA_LEN; |
@@ -285,7 +285,8 @@ static void hardif_deactivate_interface(struct hard_iface *hard_iface) | |||
285 | update_min_mtu(hard_iface->soft_iface); | 285 | update_min_mtu(hard_iface->soft_iface); |
286 | } | 286 | } |
287 | 287 | ||
288 | int hardif_enable_interface(struct hard_iface *hard_iface, char *iface_name) | 288 | int hardif_enable_interface(struct hard_iface *hard_iface, |
289 | const char *iface_name) | ||
289 | { | 290 | { |
290 | struct bat_priv *bat_priv; | 291 | struct bat_priv *bat_priv; |
291 | struct batman_packet *batman_packet; | 292 | struct batman_packet *batman_packet; |
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h index 64265991460b..79e25cbb8009 100644 --- a/net/batman-adv/hard-interface.h +++ b/net/batman-adv/hard-interface.h | |||
@@ -31,8 +31,10 @@ | |||
31 | 31 | ||
32 | extern struct notifier_block hard_if_notifier; | 32 | extern struct notifier_block hard_if_notifier; |
33 | 33 | ||
34 | struct hard_iface *hardif_get_by_netdev(struct net_device *net_dev); | 34 | struct hard_iface* |
35 | int hardif_enable_interface(struct hard_iface *hard_iface, char *iface_name); | 35 | hardif_get_by_netdev(const struct net_device *net_dev); |
36 | int hardif_enable_interface(struct hard_iface *hard_iface, | ||
37 | const char *iface_name); | ||
36 | void hardif_disable_interface(struct hard_iface *hard_iface); | 38 | void hardif_disable_interface(struct hard_iface *hard_iface); |
37 | void hardif_remove_interfaces(void); | 39 | void hardif_remove_interfaces(void); |
38 | int hardif_min_mtu(struct net_device *soft_iface); | 40 | int hardif_min_mtu(struct net_device *soft_iface); |
diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h index 434822b27473..dd5c9fd7a905 100644 --- a/net/batman-adv/hash.h +++ b/net/batman-adv/hash.h | |||
@@ -28,12 +28,12 @@ | |||
28 | * compare 2 element datas for their keys, | 28 | * compare 2 element datas for their keys, |
29 | * return 0 if same and not 0 if not | 29 | * return 0 if same and not 0 if not |
30 | * same */ | 30 | * same */ |
31 | typedef int (*hashdata_compare_cb)(struct hlist_node *, void *); | 31 | typedef int (*hashdata_compare_cb)(const struct hlist_node *, const void *); |
32 | 32 | ||
33 | /* the hashfunction, should return an index | 33 | /* the hashfunction, should return an index |
34 | * based on the key in the data of the first | 34 | * based on the key in the data of the first |
35 | * argument and the size the second */ | 35 | * argument and the size the second */ |
36 | typedef int (*hashdata_choose_cb)(void *, int); | 36 | typedef int (*hashdata_choose_cb)(const void *, int); |
37 | typedef void (*hashdata_free_cb)(struct hlist_node *, void *); | 37 | typedef void (*hashdata_free_cb)(struct hlist_node *, void *); |
38 | 38 | ||
39 | struct hashtable_t { | 39 | struct hashtable_t { |
@@ -80,7 +80,7 @@ static inline void hash_delete(struct hashtable_t *hash, | |||
80 | static inline int hash_add(struct hashtable_t *hash, | 80 | static inline int hash_add(struct hashtable_t *hash, |
81 | hashdata_compare_cb compare, | 81 | hashdata_compare_cb compare, |
82 | hashdata_choose_cb choose, | 82 | hashdata_choose_cb choose, |
83 | void *data, struct hlist_node *data_node) | 83 | const void *data, struct hlist_node *data_node) |
84 | { | 84 | { |
85 | int index; | 85 | int index; |
86 | struct hlist_head *head; | 86 | struct hlist_head *head; |
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 0a7cee0076f4..2d6445e171d6 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c | |||
@@ -155,9 +155,9 @@ void dec_module_count(void) | |||
155 | module_put(THIS_MODULE); | 155 | module_put(THIS_MODULE); |
156 | } | 156 | } |
157 | 157 | ||
158 | int is_my_mac(uint8_t *addr) | 158 | int is_my_mac(const uint8_t *addr) |
159 | { | 159 | { |
160 | struct hard_iface *hard_iface; | 160 | const struct hard_iface *hard_iface; |
161 | 161 | ||
162 | rcu_read_lock(); | 162 | rcu_read_lock(); |
163 | list_for_each_entry_rcu(hard_iface, &hardif_list, list) { | 163 | list_for_each_entry_rcu(hard_iface, &hardif_list, list) { |
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index ba28436bcdd6..0150897acf63 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h | |||
@@ -133,10 +133,10 @@ int mesh_init(struct net_device *soft_iface); | |||
133 | void mesh_free(struct net_device *soft_iface); | 133 | void mesh_free(struct net_device *soft_iface); |
134 | void inc_module_count(void); | 134 | void inc_module_count(void); |
135 | void dec_module_count(void); | 135 | void dec_module_count(void); |
136 | int is_my_mac(uint8_t *addr); | 136 | int is_my_mac(const uint8_t *addr); |
137 | 137 | ||
138 | #ifdef CONFIG_BATMAN_ADV_DEBUG | 138 | #ifdef CONFIG_BATMAN_ADV_DEBUG |
139 | int debug_log(struct bat_priv *bat_priv, char *fmt, ...) __printf(2, 3); | 139 | int debug_log(struct bat_priv *bat_priv, const char *fmt, ...) __printf(2, 3); |
140 | 140 | ||
141 | #define bat_dbg(type, bat_priv, fmt, arg...) \ | 141 | #define bat_dbg(type, bat_priv, fmt, arg...) \ |
142 | do { \ | 142 | do { \ |
@@ -148,7 +148,7 @@ int debug_log(struct bat_priv *bat_priv, char *fmt, ...) __printf(2, 3); | |||
148 | __printf(3, 4) | 148 | __printf(3, 4) |
149 | static inline void bat_dbg(char type __always_unused, | 149 | static inline void bat_dbg(char type __always_unused, |
150 | struct bat_priv *bat_priv __always_unused, | 150 | struct bat_priv *bat_priv __always_unused, |
151 | char *fmt __always_unused, ...) | 151 | const char *fmt __always_unused, ...) |
152 | { | 152 | { |
153 | } | 153 | } |
154 | #endif | 154 | #endif |
@@ -173,11 +173,13 @@ static inline void bat_dbg(char type __always_unused, | |||
173 | * | 173 | * |
174 | * note: can't use compare_ether_addr() as it requires aligned memory | 174 | * note: can't use compare_ether_addr() as it requires aligned memory |
175 | */ | 175 | */ |
176 | static inline int compare_eth(void *data1, void *data2) | 176 | |
177 | static inline int compare_eth(const void *data1, const void *data2) | ||
177 | { | 178 | { |
178 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); | 179 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); |
179 | } | 180 | } |
180 | 181 | ||
182 | |||
181 | #define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) | 183 | #define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) |
182 | 184 | ||
183 | #endif /* _NET_BATMAN_ADV_MAIN_H_ */ | 185 | #endif /* _NET_BATMAN_ADV_MAIN_H_ */ |
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index ae54f77f2c1b..3ea997deb112 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -77,7 +77,7 @@ struct neigh_node *orig_node_get_router(struct orig_node *orig_node) | |||
77 | 77 | ||
78 | struct neigh_node *create_neighbor(struct orig_node *orig_node, | 78 | struct neigh_node *create_neighbor(struct orig_node *orig_node, |
79 | struct orig_node *orig_neigh_node, | 79 | struct orig_node *orig_neigh_node, |
80 | uint8_t *neigh, | 80 | const uint8_t *neigh, |
81 | struct hard_iface *if_incoming) | 81 | struct hard_iface *if_incoming) |
82 | { | 82 | { |
83 | struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); | 83 | struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); |
@@ -183,7 +183,7 @@ void originator_free(struct bat_priv *bat_priv) | |||
183 | 183 | ||
184 | /* this function finds or creates an originator entry for the given | 184 | /* this function finds or creates an originator entry for the given |
185 | * address if it does not exits */ | 185 | * address if it does not exits */ |
186 | struct orig_node *get_orig_node(struct bat_priv *bat_priv, uint8_t *addr) | 186 | struct orig_node *get_orig_node(struct bat_priv *bat_priv, const uint8_t *addr) |
187 | { | 187 | { |
188 | struct orig_node *orig_node; | 188 | struct orig_node *orig_node; |
189 | int size; | 189 | int size; |
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h index e1d641f27aa9..8e307af7aa0d 100644 --- a/net/batman-adv/originator.h +++ b/net/batman-adv/originator.h | |||
@@ -28,10 +28,10 @@ int originator_init(struct bat_priv *bat_priv); | |||
28 | void originator_free(struct bat_priv *bat_priv); | 28 | void originator_free(struct bat_priv *bat_priv); |
29 | void purge_orig_ref(struct bat_priv *bat_priv); | 29 | void purge_orig_ref(struct bat_priv *bat_priv); |
30 | void orig_node_free_ref(struct orig_node *orig_node); | 30 | void orig_node_free_ref(struct orig_node *orig_node); |
31 | struct orig_node *get_orig_node(struct bat_priv *bat_priv, uint8_t *addr); | 31 | struct orig_node *get_orig_node(struct bat_priv *bat_priv, const uint8_t *addr); |
32 | struct neigh_node *create_neighbor(struct orig_node *orig_node, | 32 | struct neigh_node *create_neighbor(struct orig_node *orig_node, |
33 | struct orig_node *orig_neigh_node, | 33 | struct orig_node *orig_neigh_node, |
34 | uint8_t *neigh, | 34 | const uint8_t *neigh, |
35 | struct hard_iface *if_incoming); | 35 | struct hard_iface *if_incoming); |
36 | void neigh_node_free_ref(struct neigh_node *neigh_node); | 36 | void neigh_node_free_ref(struct neigh_node *neigh_node); |
37 | struct neigh_node *orig_node_get_router(struct orig_node *orig_node); | 37 | struct neigh_node *orig_node_get_router(struct orig_node *orig_node); |
@@ -41,18 +41,18 @@ int orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num); | |||
41 | 41 | ||
42 | 42 | ||
43 | /* returns 1 if they are the same originator */ | 43 | /* returns 1 if they are the same originator */ |
44 | static inline int compare_orig(struct hlist_node *node, void *data2) | 44 | static inline int compare_orig(const struct hlist_node *node, const void *data2) |
45 | { | 45 | { |
46 | void *data1 = container_of(node, struct orig_node, hash_entry); | 46 | const void *data1 = container_of(node, struct orig_node, hash_entry); |
47 | 47 | ||
48 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); | 48 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); |
49 | } | 49 | } |
50 | 50 | ||
51 | /* hashfunction to choose an entry in a hash table of given size */ | 51 | /* hashfunction to choose an entry in a hash table of given size */ |
52 | /* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ | 52 | /* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ |
53 | static inline int choose_orig(void *data, int32_t size) | 53 | static inline int choose_orig(const void *data, int32_t size) |
54 | { | 54 | { |
55 | unsigned char *key = data; | 55 | const unsigned char *key = data; |
56 | uint32_t hash = 0; | 56 | uint32_t hash = 0; |
57 | size_t i; | 57 | size_t i; |
58 | 58 | ||
@@ -70,7 +70,7 @@ static inline int choose_orig(void *data, int32_t size) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | static inline struct orig_node *orig_hash_find(struct bat_priv *bat_priv, | 72 | static inline struct orig_node *orig_hash_find(struct bat_priv *bat_priv, |
73 | void *data) | 73 | const void *data) |
74 | { | 74 | { |
75 | struct hashtable_t *hash = bat_priv->orig_hash; | 75 | struct hashtable_t *hash = bat_priv->orig_hash; |
76 | struct hlist_head *head; | 76 | struct hlist_head *head; |
diff --git a/net/batman-adv/ring_buffer.c b/net/batman-adv/ring_buffer.c index 5bb6a619afee..f1ccfa76ce8a 100644 --- a/net/batman-adv/ring_buffer.c +++ b/net/batman-adv/ring_buffer.c | |||
@@ -28,9 +28,9 @@ void ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index, uint8_t value) | |||
28 | *lq_index = (*lq_index + 1) % TQ_GLOBAL_WINDOW_SIZE; | 28 | *lq_index = (*lq_index + 1) % TQ_GLOBAL_WINDOW_SIZE; |
29 | } | 29 | } |
30 | 30 | ||
31 | uint8_t ring_buffer_avg(uint8_t lq_recv[]) | 31 | uint8_t ring_buffer_avg(const uint8_t lq_recv[]) |
32 | { | 32 | { |
33 | uint8_t *ptr; | 33 | const uint8_t *ptr; |
34 | uint16_t count = 0, i = 0, sum = 0; | 34 | uint16_t count = 0, i = 0, sum = 0; |
35 | 35 | ||
36 | ptr = lq_recv; | 36 | ptr = lq_recv; |
diff --git a/net/batman-adv/ring_buffer.h b/net/batman-adv/ring_buffer.h index 0395b2741864..7cdfe62b657c 100644 --- a/net/batman-adv/ring_buffer.h +++ b/net/batman-adv/ring_buffer.h | |||
@@ -23,6 +23,6 @@ | |||
23 | #define _NET_BATMAN_ADV_RING_BUFFER_H_ | 23 | #define _NET_BATMAN_ADV_RING_BUFFER_H_ |
24 | 24 | ||
25 | void ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index, uint8_t value); | 25 | void ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index, uint8_t value); |
26 | uint8_t ring_buffer_avg(uint8_t lq_recv[]); | 26 | uint8_t ring_buffer_avg(const uint8_t lq_recv[]); |
27 | 27 | ||
28 | #endif /* _NET_BATMAN_ADV_RING_BUFFER_H_ */ | 28 | #endif /* _NET_BATMAN_ADV_RING_BUFFER_H_ */ |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 8c403ce785d0..e0df4a007eac 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -65,7 +65,7 @@ void slide_own_bcast_window(struct hard_iface *hard_iface) | |||
65 | } | 65 | } |
66 | 66 | ||
67 | static void update_TT(struct bat_priv *bat_priv, struct orig_node *orig_node, | 67 | static void update_TT(struct bat_priv *bat_priv, struct orig_node *orig_node, |
68 | unsigned char *tt_buff, int tt_buff_len) | 68 | const unsigned char *tt_buff, int tt_buff_len) |
69 | { | 69 | { |
70 | if ((tt_buff_len != orig_node->tt_buff_len) || | 70 | if ((tt_buff_len != orig_node->tt_buff_len) || |
71 | ((tt_buff_len > 0) && | 71 | ((tt_buff_len > 0) && |
@@ -82,10 +82,9 @@ static void update_TT(struct bat_priv *bat_priv, struct orig_node *orig_node, | |||
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | static void update_route(struct bat_priv *bat_priv, | 85 | static void update_route(struct bat_priv *bat_priv, struct orig_node *orig_node, |
86 | struct orig_node *orig_node, | ||
87 | struct neigh_node *neigh_node, | 86 | struct neigh_node *neigh_node, |
88 | unsigned char *tt_buff, int tt_buff_len) | 87 | const unsigned char *tt_buff, int tt_buff_len) |
89 | { | 88 | { |
90 | struct neigh_node *curr_router; | 89 | struct neigh_node *curr_router; |
91 | 90 | ||
@@ -133,9 +132,8 @@ static void update_route(struct bat_priv *bat_priv, | |||
133 | neigh_node_free_ref(curr_router); | 132 | neigh_node_free_ref(curr_router); |
134 | } | 133 | } |
135 | 134 | ||
136 | |||
137 | void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node, | 135 | void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node, |
138 | struct neigh_node *neigh_node, unsigned char *tt_buff, | 136 | struct neigh_node *neigh_node, const unsigned char *tt_buff, |
139 | int tt_buff_len) | 137 | int tt_buff_len) |
140 | { | 138 | { |
141 | struct neigh_node *router = NULL; | 139 | struct neigh_node *router = NULL; |
@@ -348,9 +346,9 @@ out: | |||
348 | } | 346 | } |
349 | 347 | ||
350 | /* copy primary address for bonding */ | 348 | /* copy primary address for bonding */ |
351 | static void bonding_save_primary(struct orig_node *orig_node, | 349 | static void bonding_save_primary(const struct orig_node *orig_node, |
352 | struct orig_node *orig_neigh_node, | 350 | struct orig_node *orig_neigh_node, |
353 | struct batman_packet *batman_packet) | 351 | const struct batman_packet *batman_packet) |
354 | { | 352 | { |
355 | if (!(batman_packet->flags & PRIMARIES_FIRST_HOP)) | 353 | if (!(batman_packet->flags & PRIMARIES_FIRST_HOP)) |
356 | return; | 354 | return; |
@@ -358,12 +356,11 @@ static void bonding_save_primary(struct orig_node *orig_node, | |||
358 | memcpy(orig_neigh_node->primary_addr, orig_node->orig, ETH_ALEN); | 356 | memcpy(orig_neigh_node->primary_addr, orig_node->orig, ETH_ALEN); |
359 | } | 357 | } |
360 | 358 | ||
361 | static void update_orig(struct bat_priv *bat_priv, | 359 | static void update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node, |
362 | struct orig_node *orig_node, | 360 | const struct ethhdr *ethhdr, |
363 | struct ethhdr *ethhdr, | 361 | const struct batman_packet *batman_packet, |
364 | struct batman_packet *batman_packet, | ||
365 | struct hard_iface *if_incoming, | 362 | struct hard_iface *if_incoming, |
366 | unsigned char *tt_buff, int tt_buff_len, | 363 | const unsigned char *tt_buff, int tt_buff_len, |
367 | char is_duplicate) | 364 | char is_duplicate) |
368 | { | 365 | { |
369 | struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL; | 366 | struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL; |
@@ -531,9 +528,9 @@ static int window_protected(struct bat_priv *bat_priv, | |||
531 | * -1 the packet is old and has been received while the seqno window | 528 | * -1 the packet is old and has been received while the seqno window |
532 | * was protected. Caller should drop it. | 529 | * was protected. Caller should drop it. |
533 | */ | 530 | */ |
534 | static char count_real_packets(struct ethhdr *ethhdr, | 531 | static char count_real_packets(const struct ethhdr *ethhdr, |
535 | struct batman_packet *batman_packet, | 532 | const struct batman_packet *batman_packet, |
536 | struct hard_iface *if_incoming) | 533 | const struct hard_iface *if_incoming) |
537 | { | 534 | { |
538 | struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); | 535 | struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); |
539 | struct orig_node *orig_node; | 536 | struct orig_node *orig_node; |
@@ -595,9 +592,9 @@ out: | |||
595 | return ret; | 592 | return ret; |
596 | } | 593 | } |
597 | 594 | ||
598 | void receive_bat_packet(struct ethhdr *ethhdr, | 595 | void receive_bat_packet(const struct ethhdr *ethhdr, |
599 | struct batman_packet *batman_packet, | 596 | struct batman_packet *batman_packet, |
600 | unsigned char *tt_buff, int tt_buff_len, | 597 | const unsigned char *tt_buff, int tt_buff_len, |
601 | struct hard_iface *if_incoming) | 598 | struct hard_iface *if_incoming) |
602 | { | 599 | { |
603 | struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); | 600 | struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); |
@@ -1077,7 +1074,7 @@ out: | |||
1077 | * This method rotates the bonding list and increases the | 1074 | * This method rotates the bonding list and increases the |
1078 | * returned router's refcount. */ | 1075 | * returned router's refcount. */ |
1079 | static struct neigh_node *find_bond_router(struct orig_node *primary_orig, | 1076 | static struct neigh_node *find_bond_router(struct orig_node *primary_orig, |
1080 | struct hard_iface *recv_if) | 1077 | const struct hard_iface *recv_if) |
1081 | { | 1078 | { |
1082 | struct neigh_node *tmp_neigh_node; | 1079 | struct neigh_node *tmp_neigh_node; |
1083 | struct neigh_node *router = NULL, *first_candidate = NULL; | 1080 | struct neigh_node *router = NULL, *first_candidate = NULL; |
@@ -1128,7 +1125,7 @@ out: | |||
1128 | * | 1125 | * |
1129 | * Increases the returned router's refcount */ | 1126 | * Increases the returned router's refcount */ |
1130 | static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig, | 1127 | static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig, |
1131 | struct hard_iface *recv_if) | 1128 | const struct hard_iface *recv_if) |
1132 | { | 1129 | { |
1133 | struct neigh_node *tmp_neigh_node; | 1130 | struct neigh_node *tmp_neigh_node; |
1134 | struct neigh_node *router = NULL, *first_candidate = NULL; | 1131 | struct neigh_node *router = NULL, *first_candidate = NULL; |
@@ -1176,7 +1173,7 @@ static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig, | |||
1176 | * refcount.*/ | 1173 | * refcount.*/ |
1177 | struct neigh_node *find_router(struct bat_priv *bat_priv, | 1174 | struct neigh_node *find_router(struct bat_priv *bat_priv, |
1178 | struct orig_node *orig_node, | 1175 | struct orig_node *orig_node, |
1179 | struct hard_iface *recv_if) | 1176 | const struct hard_iface *recv_if) |
1180 | { | 1177 | { |
1181 | struct orig_node *primary_orig_node; | 1178 | struct orig_node *primary_orig_node; |
1182 | struct orig_node *router_orig; | 1179 | struct orig_node *router_orig; |
diff --git a/net/batman-adv/routing.h b/net/batman-adv/routing.h index 870f29842b28..0ce03923ec05 100644 --- a/net/batman-adv/routing.h +++ b/net/batman-adv/routing.h | |||
@@ -23,12 +23,12 @@ | |||
23 | #define _NET_BATMAN_ADV_ROUTING_H_ | 23 | #define _NET_BATMAN_ADV_ROUTING_H_ |
24 | 24 | ||
25 | void slide_own_bcast_window(struct hard_iface *hard_iface); | 25 | void slide_own_bcast_window(struct hard_iface *hard_iface); |
26 | void receive_bat_packet(struct ethhdr *ethhdr, | 26 | void receive_bat_packet(const struct ethhdr *ethhdr, |
27 | struct batman_packet *batman_packet, | 27 | struct batman_packet *batman_packet, |
28 | unsigned char *tt_buff, int tt_buff_len, | 28 | const unsigned char *tt_buff, int tt_buff_len, |
29 | struct hard_iface *if_incoming); | 29 | struct hard_iface *if_incoming); |
30 | void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node, | 30 | void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node, |
31 | struct neigh_node *neigh_node, unsigned char *tt_buff, | 31 | struct neigh_node *neigh_node, const unsigned char *tt_buff, |
32 | int tt_buff_len); | 32 | int tt_buff_len); |
33 | int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if); | 33 | int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if); |
34 | int recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if); | 34 | int recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if); |
@@ -39,7 +39,7 @@ int recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if); | |||
39 | int recv_bat_packet(struct sk_buff *skb, struct hard_iface *recv_if); | 39 | int recv_bat_packet(struct sk_buff *skb, struct hard_iface *recv_if); |
40 | struct neigh_node *find_router(struct bat_priv *bat_priv, | 40 | struct neigh_node *find_router(struct bat_priv *bat_priv, |
41 | struct orig_node *orig_node, | 41 | struct orig_node *orig_node, |
42 | struct hard_iface *recv_if); | 42 | const struct hard_iface *recv_if); |
43 | void bonding_candidate_del(struct orig_node *orig_node, | 43 | void bonding_candidate_del(struct orig_node *orig_node, |
44 | struct neigh_node *neigh_node); | 44 | struct neigh_node *neigh_node); |
45 | 45 | ||
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 33779278f1b2..9a20ba9e056f 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c | |||
@@ -33,14 +33,14 @@ | |||
33 | static void send_outstanding_bcast_packet(struct work_struct *work); | 33 | static void send_outstanding_bcast_packet(struct work_struct *work); |
34 | 34 | ||
35 | /* apply hop penalty for a normal link */ | 35 | /* apply hop penalty for a normal link */ |
36 | static uint8_t hop_penalty(const uint8_t tq, struct bat_priv *bat_priv) | 36 | static uint8_t hop_penalty(uint8_t tq, const struct bat_priv *bat_priv) |
37 | { | 37 | { |
38 | int hop_penalty = atomic_read(&bat_priv->hop_penalty); | 38 | int hop_penalty = atomic_read(&bat_priv->hop_penalty); |
39 | return (tq * (TQ_MAX_VALUE - hop_penalty)) / (TQ_MAX_VALUE); | 39 | return (tq * (TQ_MAX_VALUE - hop_penalty)) / (TQ_MAX_VALUE); |
40 | } | 40 | } |
41 | 41 | ||
42 | /* when do we schedule our own packet to be sent */ | 42 | /* when do we schedule our own packet to be sent */ |
43 | static unsigned long own_send_time(struct bat_priv *bat_priv) | 43 | static unsigned long own_send_time(const struct bat_priv *bat_priv) |
44 | { | 44 | { |
45 | return jiffies + msecs_to_jiffies( | 45 | return jiffies + msecs_to_jiffies( |
46 | atomic_read(&bat_priv->orig_interval) - | 46 | atomic_read(&bat_priv->orig_interval) - |
@@ -55,9 +55,8 @@ static unsigned long forward_send_time(void) | |||
55 | 55 | ||
56 | /* send out an already prepared packet to the given address via the | 56 | /* send out an already prepared packet to the given address via the |
57 | * specified batman interface */ | 57 | * specified batman interface */ |
58 | int send_skb_packet(struct sk_buff *skb, | 58 | int send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface, |
59 | struct hard_iface *hard_iface, | 59 | const uint8_t *dst_addr) |
60 | uint8_t *dst_addr) | ||
61 | { | 60 | { |
62 | struct ethhdr *ethhdr; | 61 | struct ethhdr *ethhdr; |
63 | 62 | ||
@@ -307,7 +306,7 @@ void schedule_own_packet(struct hard_iface *hard_iface) | |||
307 | } | 306 | } |
308 | 307 | ||
309 | void schedule_forward_packet(struct orig_node *orig_node, | 308 | void schedule_forward_packet(struct orig_node *orig_node, |
310 | struct ethhdr *ethhdr, | 309 | const struct ethhdr *ethhdr, |
311 | struct batman_packet *batman_packet, | 310 | struct batman_packet *batman_packet, |
312 | uint8_t directlink, int tt_buff_len, | 311 | uint8_t directlink, int tt_buff_len, |
313 | struct hard_iface *if_incoming) | 312 | struct hard_iface *if_incoming) |
@@ -408,11 +407,13 @@ static void _add_bcast_packet_to_list(struct bat_priv *bat_priv, | |||
408 | * | 407 | * |
409 | * The skb is not consumed, so the caller should make sure that the | 408 | * The skb is not consumed, so the caller should make sure that the |
410 | * skb is freed. */ | 409 | * skb is freed. */ |
411 | int add_bcast_packet_to_list(struct bat_priv *bat_priv, struct sk_buff *skb) | 410 | int add_bcast_packet_to_list(struct bat_priv *bat_priv, |
411 | const struct sk_buff *skb) | ||
412 | { | 412 | { |
413 | struct hard_iface *primary_if = NULL; | 413 | struct hard_iface *primary_if = NULL; |
414 | struct forw_packet *forw_packet; | 414 | struct forw_packet *forw_packet; |
415 | struct bcast_packet *bcast_packet; | 415 | struct bcast_packet *bcast_packet; |
416 | struct sk_buff *newskb; | ||
416 | 417 | ||
417 | if (!atomic_dec_not_zero(&bat_priv->bcast_queue_left)) { | 418 | if (!atomic_dec_not_zero(&bat_priv->bcast_queue_left)) { |
418 | bat_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n"); | 419 | bat_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n"); |
@@ -428,17 +429,17 @@ int add_bcast_packet_to_list(struct bat_priv *bat_priv, struct sk_buff *skb) | |||
428 | if (!forw_packet) | 429 | if (!forw_packet) |
429 | goto out_and_inc; | 430 | goto out_and_inc; |
430 | 431 | ||
431 | skb = skb_copy(skb, GFP_ATOMIC); | 432 | newskb = skb_copy(skb, GFP_ATOMIC); |
432 | if (!skb) | 433 | if (!newskb) |
433 | goto packet_free; | 434 | goto packet_free; |
434 | 435 | ||
435 | /* as we have a copy now, it is safe to decrease the TTL */ | 436 | /* as we have a copy now, it is safe to decrease the TTL */ |
436 | bcast_packet = (struct bcast_packet *)skb->data; | 437 | bcast_packet = (struct bcast_packet *)newskb->data; |
437 | bcast_packet->ttl--; | 438 | bcast_packet->ttl--; |
438 | 439 | ||
439 | skb_reset_mac_header(skb); | 440 | skb_reset_mac_header(newskb); |
440 | 441 | ||
441 | forw_packet->skb = skb; | 442 | forw_packet->skb = newskb; |
442 | forw_packet->if_incoming = primary_if; | 443 | forw_packet->if_incoming = primary_if; |
443 | 444 | ||
444 | /* how often did we send the bcast packet ? */ | 445 | /* how often did we send the bcast packet ? */ |
@@ -537,7 +538,7 @@ out: | |||
537 | } | 538 | } |
538 | 539 | ||
539 | void purge_outstanding_packets(struct bat_priv *bat_priv, | 540 | void purge_outstanding_packets(struct bat_priv *bat_priv, |
540 | struct hard_iface *hard_iface) | 541 | const struct hard_iface *hard_iface) |
541 | { | 542 | { |
542 | struct forw_packet *forw_packet; | 543 | struct forw_packet *forw_packet; |
543 | struct hlist_node *tmp_node, *safe_tmp_node; | 544 | struct hlist_node *tmp_node, *safe_tmp_node; |
diff --git a/net/batman-adv/send.h b/net/batman-adv/send.h index 247172d71e4b..eceab870024d 100644 --- a/net/batman-adv/send.h +++ b/net/batman-adv/send.h | |||
@@ -22,18 +22,18 @@ | |||
22 | #ifndef _NET_BATMAN_ADV_SEND_H_ | 22 | #ifndef _NET_BATMAN_ADV_SEND_H_ |
23 | #define _NET_BATMAN_ADV_SEND_H_ | 23 | #define _NET_BATMAN_ADV_SEND_H_ |
24 | 24 | ||
25 | int send_skb_packet(struct sk_buff *skb, | 25 | int send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface, |
26 | struct hard_iface *hard_iface, | 26 | const uint8_t *dst_addr); |
27 | uint8_t *dst_addr); | ||
28 | void schedule_own_packet(struct hard_iface *hard_iface); | 27 | void schedule_own_packet(struct hard_iface *hard_iface); |
29 | void schedule_forward_packet(struct orig_node *orig_node, | 28 | void schedule_forward_packet(struct orig_node *orig_node, |
30 | struct ethhdr *ethhdr, | 29 | const struct ethhdr *ethhdr, |
31 | struct batman_packet *batman_packet, | 30 | struct batman_packet *batman_packet, |
32 | uint8_t directlink, int tt_buff_len, | 31 | uint8_t directlink, int tt_buff_len, |
33 | struct hard_iface *if_outgoing); | 32 | struct hard_iface *if_outgoing); |
34 | int add_bcast_packet_to_list(struct bat_priv *bat_priv, struct sk_buff *skb); | 33 | int add_bcast_packet_to_list(struct bat_priv *bat_priv, |
34 | const struct sk_buff *skb); | ||
35 | void send_outstanding_bat_packet(struct work_struct *work); | 35 | void send_outstanding_bat_packet(struct work_struct *work); |
36 | void purge_outstanding_packets(struct bat_priv *bat_priv, | 36 | void purge_outstanding_packets(struct bat_priv *bat_priv, |
37 | struct hard_iface *hard_iface); | 37 | const struct hard_iface *hard_iface); |
38 | 38 | ||
39 | #endif /* _NET_BATMAN_ADV_SEND_H_ */ | 39 | #endif /* _NET_BATMAN_ADV_SEND_H_ */ |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index d5aa60999e83..1bec3a0f9721 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -146,7 +146,7 @@ out: | |||
146 | } | 146 | } |
147 | 147 | ||
148 | static struct softif_neigh *softif_neigh_get(struct bat_priv *bat_priv, | 148 | static struct softif_neigh *softif_neigh_get(struct bat_priv *bat_priv, |
149 | uint8_t *addr, short vid) | 149 | const uint8_t *addr, short vid) |
150 | { | 150 | { |
151 | struct softif_neigh_vid *softif_neigh_vid; | 151 | struct softif_neigh_vid *softif_neigh_vid; |
152 | struct softif_neigh *softif_neigh = NULL; | 152 | struct softif_neigh *softif_neigh = NULL; |
@@ -793,7 +793,7 @@ static void interface_setup(struct net_device *dev) | |||
793 | memset(priv, 0, sizeof(struct bat_priv)); | 793 | memset(priv, 0, sizeof(struct bat_priv)); |
794 | } | 794 | } |
795 | 795 | ||
796 | struct net_device *softif_create(char *name) | 796 | struct net_device *softif_create(const char *name) |
797 | { | 797 | { |
798 | struct net_device *soft_iface; | 798 | struct net_device *soft_iface; |
799 | struct bat_priv *bat_priv; | 799 | struct bat_priv *bat_priv; |
@@ -872,7 +872,7 @@ void softif_destroy(struct net_device *soft_iface) | |||
872 | unregister_netdevice(soft_iface); | 872 | unregister_netdevice(soft_iface); |
873 | } | 873 | } |
874 | 874 | ||
875 | int softif_is_valid(struct net_device *net_dev) | 875 | int softif_is_valid(const struct net_device *net_dev) |
876 | { | 876 | { |
877 | #ifdef HAVE_NET_DEVICE_OPS | 877 | #ifdef HAVE_NET_DEVICE_OPS |
878 | if (net_dev->netdev_ops->ndo_start_xmit == interface_tx) | 878 | if (net_dev->netdev_ops->ndo_start_xmit == interface_tx) |
@@ -924,4 +924,3 @@ static u32 bat_get_link(struct net_device *dev) | |||
924 | { | 924 | { |
925 | return 1; | 925 | return 1; |
926 | } | 926 | } |
927 | |||
diff --git a/net/batman-adv/soft-interface.h b/net/batman-adv/soft-interface.h index 4789b6f2a0b3..c24906dd1d6a 100644 --- a/net/batman-adv/soft-interface.h +++ b/net/batman-adv/soft-interface.h | |||
@@ -29,8 +29,8 @@ int interface_tx(struct sk_buff *skb, struct net_device *soft_iface); | |||
29 | void interface_rx(struct net_device *soft_iface, | 29 | void interface_rx(struct net_device *soft_iface, |
30 | struct sk_buff *skb, struct hard_iface *recv_if, | 30 | struct sk_buff *skb, struct hard_iface *recv_if, |
31 | int hdr_size); | 31 | int hdr_size); |
32 | struct net_device *softif_create(char *name); | 32 | struct net_device *softif_create(const char *name); |
33 | void softif_destroy(struct net_device *soft_iface); | 33 | void softif_destroy(struct net_device *soft_iface); |
34 | int softif_is_valid(struct net_device *net_dev); | 34 | int softif_is_valid(const struct net_device *net_dev); |
35 | 35 | ||
36 | #endif /* _NET_BATMAN_ADV_SOFT_INTERFACE_H_ */ | 36 | #endif /* _NET_BATMAN_ADV_SOFT_INTERFACE_H_ */ |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 7b729660cbfd..be7b5cc71d28 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -29,20 +29,22 @@ | |||
29 | static void tt_local_purge(struct work_struct *work); | 29 | static void tt_local_purge(struct work_struct *work); |
30 | static void _tt_global_del_orig(struct bat_priv *bat_priv, | 30 | static void _tt_global_del_orig(struct bat_priv *bat_priv, |
31 | struct tt_global_entry *tt_global_entry, | 31 | struct tt_global_entry *tt_global_entry, |
32 | char *message); | 32 | const char *message); |
33 | 33 | ||
34 | /* returns 1 if they are the same mac addr */ | 34 | /* returns 1 if they are the same mac addr */ |
35 | static int compare_ltt(struct hlist_node *node, void *data2) | 35 | static int compare_ltt(const struct hlist_node *node, const void *data2) |
36 | { | 36 | { |
37 | void *data1 = container_of(node, struct tt_local_entry, hash_entry); | 37 | const void *data1 = container_of(node, struct tt_local_entry, |
38 | hash_entry); | ||
38 | 39 | ||
39 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); | 40 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); |
40 | } | 41 | } |
41 | 42 | ||
42 | /* returns 1 if they are the same mac addr */ | 43 | /* returns 1 if they are the same mac addr */ |
43 | static int compare_gtt(struct hlist_node *node, void *data2) | 44 | static int compare_gtt(const struct hlist_node *node, const void *data2) |
44 | { | 45 | { |
45 | void *data1 = container_of(node, struct tt_global_entry, hash_entry); | 46 | const void *data1 = container_of(node, struct tt_global_entry, |
47 | hash_entry); | ||
46 | 48 | ||
47 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); | 49 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); |
48 | } | 50 | } |
@@ -54,7 +56,7 @@ static void tt_local_start_timer(struct bat_priv *bat_priv) | |||
54 | } | 56 | } |
55 | 57 | ||
56 | static struct tt_local_entry *tt_local_hash_find(struct bat_priv *bat_priv, | 58 | static struct tt_local_entry *tt_local_hash_find(struct bat_priv *bat_priv, |
57 | void *data) | 59 | const void *data) |
58 | { | 60 | { |
59 | struct hashtable_t *hash = bat_priv->tt_local_hash; | 61 | struct hashtable_t *hash = bat_priv->tt_local_hash; |
60 | struct hlist_head *head; | 62 | struct hlist_head *head; |
@@ -82,7 +84,7 @@ static struct tt_local_entry *tt_local_hash_find(struct bat_priv *bat_priv, | |||
82 | } | 84 | } |
83 | 85 | ||
84 | static struct tt_global_entry *tt_global_hash_find(struct bat_priv *bat_priv, | 86 | static struct tt_global_entry *tt_global_hash_find(struct bat_priv *bat_priv, |
85 | void *data) | 87 | const void *data) |
86 | { | 88 | { |
87 | struct hashtable_t *hash = bat_priv->tt_global_hash; | 89 | struct hashtable_t *hash = bat_priv->tt_global_hash; |
88 | struct hlist_head *head; | 90 | struct hlist_head *head; |
@@ -126,7 +128,7 @@ int tt_local_init(struct bat_priv *bat_priv) | |||
126 | return 1; | 128 | return 1; |
127 | } | 129 | } |
128 | 130 | ||
129 | void tt_local_add(struct net_device *soft_iface, uint8_t *addr) | 131 | void tt_local_add(struct net_device *soft_iface, const uint8_t *addr) |
130 | { | 132 | { |
131 | struct bat_priv *bat_priv = netdev_priv(soft_iface); | 133 | struct bat_priv *bat_priv = netdev_priv(soft_iface); |
132 | struct tt_local_entry *tt_local_entry; | 134 | struct tt_local_entry *tt_local_entry; |
@@ -320,8 +322,8 @@ static void _tt_local_del(struct hlist_node *node, void *arg) | |||
320 | } | 322 | } |
321 | 323 | ||
322 | static void tt_local_del(struct bat_priv *bat_priv, | 324 | static void tt_local_del(struct bat_priv *bat_priv, |
323 | struct tt_local_entry *tt_local_entry, | 325 | struct tt_local_entry *tt_local_entry, |
324 | char *message) | 326 | const char *message) |
325 | { | 327 | { |
326 | bat_dbg(DBG_ROUTES, bat_priv, "Deleting local tt entry (%pM): %s\n", | 328 | bat_dbg(DBG_ROUTES, bat_priv, "Deleting local tt entry (%pM): %s\n", |
327 | tt_local_entry->addr, message); | 329 | tt_local_entry->addr, message); |
@@ -332,7 +334,7 @@ static void tt_local_del(struct bat_priv *bat_priv, | |||
332 | } | 334 | } |
333 | 335 | ||
334 | void tt_local_remove(struct bat_priv *bat_priv, | 336 | void tt_local_remove(struct bat_priv *bat_priv, |
335 | uint8_t *addr, char *message) | 337 | const uint8_t *addr, const char *message) |
336 | { | 338 | { |
337 | struct tt_local_entry *tt_local_entry; | 339 | struct tt_local_entry *tt_local_entry; |
338 | 340 | ||
@@ -409,12 +411,12 @@ int tt_global_init(struct bat_priv *bat_priv) | |||
409 | 411 | ||
410 | void tt_global_add_orig(struct bat_priv *bat_priv, | 412 | void tt_global_add_orig(struct bat_priv *bat_priv, |
411 | struct orig_node *orig_node, | 413 | struct orig_node *orig_node, |
412 | unsigned char *tt_buff, int tt_buff_len) | 414 | const unsigned char *tt_buff, int tt_buff_len) |
413 | { | 415 | { |
414 | struct tt_global_entry *tt_global_entry; | 416 | struct tt_global_entry *tt_global_entry; |
415 | struct tt_local_entry *tt_local_entry; | 417 | struct tt_local_entry *tt_local_entry; |
416 | int tt_buff_count = 0; | 418 | int tt_buff_count = 0; |
417 | unsigned char *tt_ptr; | 419 | const unsigned char *tt_ptr; |
418 | 420 | ||
419 | while ((tt_buff_count + 1) * ETH_ALEN <= tt_buff_len) { | 421 | while ((tt_buff_count + 1) * ETH_ALEN <= tt_buff_len) { |
420 | spin_lock_bh(&bat_priv->tt_ghash_lock); | 422 | spin_lock_bh(&bat_priv->tt_ghash_lock); |
@@ -557,7 +559,7 @@ out: | |||
557 | 559 | ||
558 | static void _tt_global_del_orig(struct bat_priv *bat_priv, | 560 | static void _tt_global_del_orig(struct bat_priv *bat_priv, |
559 | struct tt_global_entry *tt_global_entry, | 561 | struct tt_global_entry *tt_global_entry, |
560 | char *message) | 562 | const char *message) |
561 | { | 563 | { |
562 | bat_dbg(DBG_ROUTES, bat_priv, | 564 | bat_dbg(DBG_ROUTES, bat_priv, |
563 | "Deleting global tt entry %pM (via %pM): %s\n", | 565 | "Deleting global tt entry %pM (via %pM): %s\n", |
@@ -570,7 +572,7 @@ static void _tt_global_del_orig(struct bat_priv *bat_priv, | |||
570 | } | 572 | } |
571 | 573 | ||
572 | void tt_global_del_orig(struct bat_priv *bat_priv, | 574 | void tt_global_del_orig(struct bat_priv *bat_priv, |
573 | struct orig_node *orig_node, char *message) | 575 | struct orig_node *orig_node, const char *message) |
574 | { | 576 | { |
575 | struct tt_global_entry *tt_global_entry; | 577 | struct tt_global_entry *tt_global_entry; |
576 | int tt_buff_count = 0; | 578 | int tt_buff_count = 0; |
@@ -616,7 +618,8 @@ void tt_global_free(struct bat_priv *bat_priv) | |||
616 | bat_priv->tt_global_hash = NULL; | 618 | bat_priv->tt_global_hash = NULL; |
617 | } | 619 | } |
618 | 620 | ||
619 | struct orig_node *transtable_search(struct bat_priv *bat_priv, uint8_t *addr) | 621 | struct orig_node *transtable_search(struct bat_priv *bat_priv, |
622 | const uint8_t *addr) | ||
620 | { | 623 | { |
621 | struct tt_global_entry *tt_global_entry; | 624 | struct tt_global_entry *tt_global_entry; |
622 | struct orig_node *orig_node = NULL; | 625 | struct orig_node *orig_node = NULL; |
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h index 46152c38cc95..0f2b9905cfc4 100644 --- a/net/batman-adv/translation-table.h +++ b/net/batman-adv/translation-table.h | |||
@@ -23,21 +23,22 @@ | |||
23 | #define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ | 23 | #define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ |
24 | 24 | ||
25 | int tt_local_init(struct bat_priv *bat_priv); | 25 | int tt_local_init(struct bat_priv *bat_priv); |
26 | void tt_local_add(struct net_device *soft_iface, uint8_t *addr); | 26 | void tt_local_add(struct net_device *soft_iface, const uint8_t *addr); |
27 | void tt_local_remove(struct bat_priv *bat_priv, | 27 | void tt_local_remove(struct bat_priv *bat_priv, |
28 | uint8_t *addr, char *message); | 28 | const uint8_t *addr, const char *message); |
29 | int tt_local_fill_buffer(struct bat_priv *bat_priv, | 29 | int tt_local_fill_buffer(struct bat_priv *bat_priv, |
30 | unsigned char *buff, int buff_len); | 30 | unsigned char *buff, int buff_len); |
31 | int tt_local_seq_print_text(struct seq_file *seq, void *offset); | 31 | int tt_local_seq_print_text(struct seq_file *seq, void *offset); |
32 | void tt_local_free(struct bat_priv *bat_priv); | 32 | void tt_local_free(struct bat_priv *bat_priv); |
33 | int tt_global_init(struct bat_priv *bat_priv); | 33 | int tt_global_init(struct bat_priv *bat_priv); |
34 | void tt_global_add_orig(struct bat_priv *bat_priv, | 34 | void tt_global_add_orig(struct bat_priv *bat_priv, |
35 | struct orig_node *orig_node, | 35 | struct orig_node *orig_node, |
36 | unsigned char *tt_buff, int tt_buff_len); | 36 | const unsigned char *tt_buff, int tt_buff_len); |
37 | int tt_global_seq_print_text(struct seq_file *seq, void *offset); | 37 | int tt_global_seq_print_text(struct seq_file *seq, void *offset); |
38 | void tt_global_del_orig(struct bat_priv *bat_priv, | 38 | void tt_global_del_orig(struct bat_priv *bat_priv, |
39 | struct orig_node *orig_node, char *message); | 39 | struct orig_node *orig_node, const char *message); |
40 | void tt_global_free(struct bat_priv *bat_priv); | 40 | void tt_global_free(struct bat_priv *bat_priv); |
41 | struct orig_node *transtable_search(struct bat_priv *bat_priv, uint8_t *addr); | 41 | struct orig_node *transtable_search(struct bat_priv *bat_priv, |
42 | const uint8_t *addr); | ||
42 | 43 | ||
43 | #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */ | 44 | #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */ |
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index bab6076c4334..e2deb442f4fe 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c | |||
@@ -115,7 +115,7 @@ static int frag_create_buffer(struct list_head *head) | |||
115 | } | 115 | } |
116 | 116 | ||
117 | static struct frag_packet_list_entry *frag_search_packet(struct list_head *head, | 117 | static struct frag_packet_list_entry *frag_search_packet(struct list_head *head, |
118 | struct unicast_frag_packet *up) | 118 | const struct unicast_frag_packet *up) |
119 | { | 119 | { |
120 | struct frag_packet_list_entry *tfp; | 120 | struct frag_packet_list_entry *tfp; |
121 | struct unicast_frag_packet *tmp_up = NULL; | 121 | struct unicast_frag_packet *tmp_up = NULL; |
@@ -218,7 +218,7 @@ out: | |||
218 | } | 218 | } |
219 | 219 | ||
220 | int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, | 220 | int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, |
221 | struct hard_iface *hard_iface, uint8_t dstaddr[]) | 221 | struct hard_iface *hard_iface, const uint8_t dstaddr[]) |
222 | { | 222 | { |
223 | struct unicast_packet tmp_uc, *unicast_packet; | 223 | struct unicast_packet tmp_uc, *unicast_packet; |
224 | struct hard_iface *primary_if; | 224 | struct hard_iface *primary_if; |
diff --git a/net/batman-adv/unicast.h b/net/batman-adv/unicast.h index 16ad7a9242b5..2ba867cf4135 100644 --- a/net/batman-adv/unicast.h +++ b/net/batman-adv/unicast.h | |||
@@ -32,11 +32,11 @@ int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv, | |||
32 | void frag_list_free(struct list_head *head); | 32 | void frag_list_free(struct list_head *head); |
33 | int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv); | 33 | int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv); |
34 | int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, | 34 | int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, |
35 | struct hard_iface *hard_iface, uint8_t dstaddr[]); | 35 | struct hard_iface *hard_iface, const uint8_t dstaddr[]); |
36 | 36 | ||
37 | static inline int frag_can_reassemble(struct sk_buff *skb, int mtu) | 37 | static inline int frag_can_reassemble(const struct sk_buff *skb, int mtu) |
38 | { | 38 | { |
39 | struct unicast_frag_packet *unicast_packet; | 39 | const struct unicast_frag_packet *unicast_packet; |
40 | int uneven_correction = 0; | 40 | int uneven_correction = 0; |
41 | unsigned int merged_size; | 41 | unsigned int merged_size; |
42 | 42 | ||
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index c39f20cc1ba6..adb0327ff28b 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -68,10 +68,10 @@ static void free_info(struct kref *ref) | |||
68 | } | 68 | } |
69 | 69 | ||
70 | /* Compare two vis packets, used by the hashing algorithm */ | 70 | /* Compare two vis packets, used by the hashing algorithm */ |
71 | static int vis_info_cmp(struct hlist_node *node, void *data2) | 71 | static int vis_info_cmp(const struct hlist_node *node, const void *data2) |
72 | { | 72 | { |
73 | struct vis_info *d1, *d2; | 73 | const struct vis_info *d1, *d2; |
74 | struct vis_packet *p1, *p2; | 74 | const struct vis_packet *p1, *p2; |
75 | 75 | ||
76 | d1 = container_of(node, struct vis_info, hash_entry); | 76 | d1 = container_of(node, struct vis_info, hash_entry); |
77 | d2 = data2; | 77 | d2 = data2; |
@@ -82,11 +82,11 @@ static int vis_info_cmp(struct hlist_node *node, void *data2) | |||
82 | 82 | ||
83 | /* hash function to choose an entry in a hash table of given size */ | 83 | /* hash function to choose an entry in a hash table of given size */ |
84 | /* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ | 84 | /* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ |
85 | static int vis_info_choose(void *data, int size) | 85 | static int vis_info_choose(const void *data, int size) |
86 | { | 86 | { |
87 | struct vis_info *vis_info = data; | 87 | const struct vis_info *vis_info = data; |
88 | struct vis_packet *packet; | 88 | const struct vis_packet *packet; |
89 | unsigned char *key; | 89 | const unsigned char *key; |
90 | uint32_t hash = 0; | 90 | uint32_t hash = 0; |
91 | size_t i; | 91 | size_t i; |
92 | 92 | ||
@@ -106,7 +106,7 @@ static int vis_info_choose(void *data, int size) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | static struct vis_info *vis_hash_find(struct bat_priv *bat_priv, | 108 | static struct vis_info *vis_hash_find(struct bat_priv *bat_priv, |
109 | void *data) | 109 | const void *data) |
110 | { | 110 | { |
111 | struct hashtable_t *hash = bat_priv->vis_hash; | 111 | struct hashtable_t *hash = bat_priv->vis_hash; |
112 | struct hlist_head *head; | 112 | struct hlist_head *head; |
@@ -143,7 +143,7 @@ static void vis_data_insert_interface(const uint8_t *interface, | |||
143 | struct hlist_node *pos; | 143 | struct hlist_node *pos; |
144 | 144 | ||
145 | hlist_for_each_entry(entry, pos, if_list, list) { | 145 | hlist_for_each_entry(entry, pos, if_list, list) { |
146 | if (compare_eth(entry->addr, (void *)interface)) | 146 | if (compare_eth(entry->addr, interface)) |
147 | return; | 147 | return; |
148 | } | 148 | } |
149 | 149 | ||
@@ -156,7 +156,8 @@ static void vis_data_insert_interface(const uint8_t *interface, | |||
156 | hlist_add_head(&entry->list, if_list); | 156 | hlist_add_head(&entry->list, if_list); |
157 | } | 157 | } |
158 | 158 | ||
159 | static ssize_t vis_data_read_prim_sec(char *buff, struct hlist_head *if_list) | 159 | static ssize_t vis_data_read_prim_sec(char *buff, |
160 | const struct hlist_head *if_list) | ||
160 | { | 161 | { |
161 | struct if_list_entry *entry; | 162 | struct if_list_entry *entry; |
162 | struct hlist_node *pos; | 163 | struct hlist_node *pos; |
@@ -189,8 +190,9 @@ static size_t vis_data_count_prim_sec(struct hlist_head *if_list) | |||
189 | } | 190 | } |
190 | 191 | ||
191 | /* read an entry */ | 192 | /* read an entry */ |
192 | static ssize_t vis_data_read_entry(char *buff, struct vis_info_entry *entry, | 193 | static ssize_t vis_data_read_entry(char *buff, |
193 | uint8_t *src, bool primary) | 194 | const struct vis_info_entry *entry, |
195 | const uint8_t *src, bool primary) | ||
194 | { | 196 | { |
195 | /* maximal length: max(4+17+2, 3+17+1+3+2) == 26 */ | 197 | /* maximal length: max(4+17+2, 3+17+1+3+2) == 26 */ |
196 | if (primary && entry->quality == 0) | 198 | if (primary && entry->quality == 0) |
@@ -361,7 +363,7 @@ static void send_list_del(struct vis_info *info) | |||
361 | 363 | ||
362 | /* tries to add one entry to the receive list. */ | 364 | /* tries to add one entry to the receive list. */ |
363 | static void recv_list_add(struct bat_priv *bat_priv, | 365 | static void recv_list_add(struct bat_priv *bat_priv, |
364 | struct list_head *recv_list, char *mac) | 366 | struct list_head *recv_list, const char *mac) |
365 | { | 367 | { |
366 | struct recvlist_node *entry; | 368 | struct recvlist_node *entry; |
367 | 369 | ||
@@ -377,9 +379,9 @@ static void recv_list_add(struct bat_priv *bat_priv, | |||
377 | 379 | ||
378 | /* returns 1 if this mac is in the recv_list */ | 380 | /* returns 1 if this mac is in the recv_list */ |
379 | static int recv_list_is_in(struct bat_priv *bat_priv, | 381 | static int recv_list_is_in(struct bat_priv *bat_priv, |
380 | struct list_head *recv_list, char *mac) | 382 | const struct list_head *recv_list, const char *mac) |
381 | { | 383 | { |
382 | struct recvlist_node *entry; | 384 | const struct recvlist_node *entry; |
383 | 385 | ||
384 | spin_lock_bh(&bat_priv->vis_list_lock); | 386 | spin_lock_bh(&bat_priv->vis_list_lock); |
385 | list_for_each_entry(entry, recv_list, list) { | 387 | list_for_each_entry(entry, recv_list, list) { |
@@ -599,9 +601,9 @@ static int find_best_vis_server(struct bat_priv *bat_priv, | |||
599 | } | 601 | } |
600 | 602 | ||
601 | /* Return true if the vis packet is full. */ | 603 | /* Return true if the vis packet is full. */ |
602 | static bool vis_packet_full(struct vis_info *info) | 604 | static bool vis_packet_full(const struct vis_info *info) |
603 | { | 605 | { |
604 | struct vis_packet *packet; | 606 | const struct vis_packet *packet; |
605 | packet = (struct vis_packet *)info->skb_packet->data; | 607 | packet = (struct vis_packet *)info->skb_packet->data; |
606 | 608 | ||
607 | if (MAX_VIS_PACKET_SIZE / sizeof(struct vis_info_entry) | 609 | if (MAX_VIS_PACKET_SIZE / sizeof(struct vis_info_entry) |