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/originator.h | |
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/originator.h')
-rw-r--r-- | net/batman-adv/originator.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h index e1d641f27aa..8e307af7aa0 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; |