Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Simon Wunderlich
Sat, 14 Nov 2026 09:15
[PATCH net-next 06/15] batman-adv: hash: document key argument of hash operations
Author: Simon Wunderlich
Date: Sat, 14 Nov 2026 09:15
Date: Sat, 14 Nov 2026 09:15
64 lines
11433 bytes
11433 bytes
From: Sven Eckelmann <sven@narfation.org> With all users converted, the data passed to batadv_hash_add(), batadv_hash_remove() and the compare/choose callbacks is always the key of the hash table, never a (partially initialized) element. The kernel-doc of batadv_hash_remove() even still suggested to pass "the structure you use with just the key filled". Document the actual key contract. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> --- net/batman-adv/hash.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h index 45a432cc15789..fca426c5e3c58 100644 --- a/net/batman-adv/hash.h +++ b/net/batman-adv/hash.h @@ -21,7 +21,7 @@ /** * typedef batadv_hashdata_compare_cb - hash element comparison callback * @node: hlist node of the element currently stored in the bucket - * @key: opaque payload to compare @node's key against + * @key: key to compare @node's key against * * Compare hash element by its keys. * @@ -32,7 +32,7 @@ typedef bool (*batadv_hashdata_compare_cb)(const struct hlist_node *node, /** * typedef batadv_hashdata_choose_cb - hash bucket selection callback - * @key: opaque payload whose key selects the bucket + * @key: key which selects the bucket * @size: number of buckets in the hash table * * Return: bucket index derived from the key in @key and the table @size. @@ -80,7 +80,8 @@ void batadv_hash_destroy(struct batadv_hashtable *hash); * @hash: storage hash table * @compare: callback to determine if 2 hash elements are identical * @choose: callback calculating the hash index - * @data: data passed to the aforementioned callbacks as argument + * @data: key of the element to add (the key embedded in the element), + * passed to the aforementioned callbacks as argument * @data_node: to be added element * * Return: 0 on success, 1 if the element already is in the hash @@ -132,10 +133,8 @@ static inline int batadv_hash_add(struct batadv_hashtable *hash, * @hash: hash table * @compare: callback to determine if 2 hash elements are identical * @choose: callback calculating the hash index - * @data: data passed to the aforementioned callbacks as argument - * - * data could be the structure you use with just the key filled, we just need - * the key for comparing. + * @data: key of the element to remove, passed to the aforementioned callbacks + * as argument * * Return: returns pointer to hlist_node on success, so you can remove the used * structure yourself, or NULL on error -- 2.47.3
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads