diff options
author | Sven Eckelmann <sven@narfation.org> | 2011-05-14 17:14:50 -0400 |
---|---|---|
committer | Sven Eckelmann <sven@narfation.org> | 2011-05-30 01:39:31 -0400 |
commit | 747e4221a03cde62402b614ca1f8e961b8416130 (patch) | |
tree | 98428064fef191a5093e276d5a779b9e801a97f0 /net/batman-adv/translation-table.c | |
parent | 38e3c5f0dae7a3bbb32c3b2bb28c3f2557d40fe9 (diff) |
batman-adv: Add const type qualifier for pointers
batman-adv uses pointers which are marked as const and should not
violate that type qualifier by passing it to functions which force a
cast to the non-const version.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r-- | net/batman-adv/translation-table.c | 35 |
1 files changed, 19 insertions, 16 deletions
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; |