batadv_hash_add(9)
π batadv_hash_add(9) π
okay so this is the <pink>Kernel API Manual</pink> page for batadv_hash_add and bestie, it's literally just about dropping your data into a hashtable. that's it. that's the whole vibe. let's get into it π«Ά
β¨ NAME β¨
batadv_hash_add β adds data to the hashtable π
πΈ SYNOPSIS πΈ
int batadv_hash_add (struct batadv_hashtable *hash ,
batadv_hashdata_compare_cb compare , batadv_hashdata_choose_cb choose ,
const void *data , struct hlist_node *data_node );
like, yes, that's the whole signature. five things go in, an int comes out. iconic behavior honestly π
π¦ ARGUMENTS π¦
hashβ your storage hash table. the actual place where things live. it's giving "the closet you're throwing everything into" energy π§compareβ a callback that determines whether 2 hash elements are identical. yes, 2, the manpage said 2, we respect 2 βοΈchooseβ a callback that calculates the hash index. it's the little matchmaker deciding which bucket your data ends up in πdataβ the data passed to the aforementioned callbacks as an argument. so it gets handed off to bothcompareandchoose, iykyk πdata_nodeβ the element to be added. the main character of this whole operation, no cap π
β RETURN β
0on success β slay, it worked π1if the element already is in the hash β not me showing up to the party already on the guest list π-1on error β tragic, but we move π
π₯ SEE ALSO π₯
- Kernel file
./net/batman-adv/hash.h batadv_hashdata_compare_cb(9)batadv_hashdata_choose_cb(9)batadv_hashdata_free_cb(9)struct batadv_hashtable(9)batadv_hash_remove(9)
lowkey the whole lore lives in ./net/batman-adv/hash.h β go read it bestie, it's giving required reading πβ¨
k that's the page!! this one's from the ./net/batman-adv source tree, dated October 2026 β so go forth, add your data, and remember: <hotpink>0is success,1means it's already there,-1 means something went wrong.` ππ¦π· mwah, bye bestie! π«Ά
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms