diff options
Diffstat (limited to 'net/batman-adv/originator.h')
-rw-r--r-- | net/batman-adv/originator.h | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h index e1d641f27aa9..cfc1f60a96a1 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); |
@@ -40,19 +40,11 @@ int orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num); | |||
40 | int orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num); | 40 | 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 */ | ||
44 | static inline int compare_orig(struct hlist_node *node, void *data2) | ||
45 | { | ||
46 | void *data1 = container_of(node, struct orig_node, hash_entry); | ||
47 | |||
48 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); | ||
49 | } | ||
50 | |||
51 | /* hashfunction to choose an entry in a hash table of given size */ | 43 | /* hashfunction to choose an entry in a hash table of given size */ |
52 | /* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ | 44 | /* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ |
53 | static inline int choose_orig(void *data, int32_t size) | 45 | static inline int choose_orig(const void *data, int32_t size) |
54 | { | 46 | { |
55 | unsigned char *key = data; | 47 | const unsigned char *key = data; |
56 | uint32_t hash = 0; | 48 | uint32_t hash = 0; |
57 | size_t i; | 49 | size_t i; |
58 | 50 | ||
@@ -70,7 +62,7 @@ static inline int choose_orig(void *data, int32_t size) | |||
70 | } | 62 | } |
71 | 63 | ||
72 | static inline struct orig_node *orig_hash_find(struct bat_priv *bat_priv, | 64 | static inline struct orig_node *orig_hash_find(struct bat_priv *bat_priv, |
73 | void *data) | 65 | const void *data) |
74 | { | 66 | { |
75 | struct hashtable_t *hash = bat_priv->orig_hash; | 67 | struct hashtable_t *hash = bat_priv->orig_hash; |
76 | struct hlist_head *head; | 68 | struct hlist_head *head; |