rhashtable_replace_fast(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– rhashtable_replace_fast β€” the Kernel API Manual glow-up πŸ¦‹

okay so bestie, welcome to the Kernel API Manual entry for rhashtable_replace_fast(9) β€” yes the header says it three times, we get it, the kernel is dramatic like that πŸ’…


✨ NAME ✨

rhashtable_replace_fast β€” swap an object out of a hash table, but like, fast πŸ’¨


πŸŽ€ SYNOPSIS πŸŽ€

int rhashtable_replace_fast (struct rhashtable *ht , struct rhash_head
*obj_old , struct rhash_head *obj_new , const struct rhashtable_params
params );

like literally the whole thing in one line, she's not subtle 🌸


🫢 ARGUMENTS 🫢

  • ht β€” your hash table, the main character πŸ‘‘
  • obj_old β€” pointer to the hash head inside the object you're replacing (the one getting yeeted πŸ™ˆ)
  • obj_new β€” pointer to the hash head inside the object that's brand new (the one sliding in ✨)
  • params β€” the hash table parameters, aka the vibe check settings 🌈

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea, bestie: replacing an object doesn't affect the number of elements in the hash table, and it doesn't affect the bucket either. so lowkey we do not have to worry about shrinking or expanding the table here β€” none of that, not today πŸŽ€

Returns:

  • zero on success β€” slay, it worked πŸ’…
  • -ENOENT if the entry could not be found β€” it's giving "who? never heard of her" 😭
  • -EINVAL if the hash is not the same for the old and new objects β€” not matching, not it, red flag 🚩
ngl the -EINVAL one is the important one to remember: if the hashes don't line up, that replacement is not happening βœ‹

🌟 SEE ALSO 🌟

Kernel file ./include/linux/rhashtable.h, plus the whole friend group (they're all (9) entries, iykyk):

fr fr go read them, they're iconic 🧚


and that's the whole page babes πŸ“ courtesy of ./include/linux, dated October 2026, filed under rhashtable_replace_fast(9) β€” stream it, bookmark it, tell your kernel dev bestie πŸ’–βœ¨

πŸ“¦ where this page comes from