batadv_hash_add(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 both compare and choose, iykyk 🌈
  • data_node β€” the element to be added. the main character of this whole operation, no cap πŸ‘‘

⭐ RETURN ⭐

  • 0 on success β€” slay, it worked πŸŽ‰
  • 1 if the element already is in the hash β€” not me showing up to the party already on the guest list πŸ’€
  • -1 on error β€” tragic, but we move 😭

πŸ”₯ SEE ALSO πŸ”₯


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