get_hashentry(9)
π get_hashentry β the Kernel API Manual, bestie edition β¨
okay so this one's from the Kernel API Manual, and it's lowkey one of those tiny helper functions that eats and leaves no crumbs. let's get into it π«Ά
πΈ NAME πΈ
get_hashentry β literally just a wrapper around a hashtable lookup. that's the whole vibe. it looks things up, and if the thing isn't there, it makes room for it. iconic behavior honestly π
β¨ SYNOPSIS β¨
void * get_hashentry (struct rhashtable *ht , void *key , const struct
rhashtable_params params , size_t size );
yes bestie, it returns a void *. we love a flexible pointer π
π ARGUMENTS π
htβ the hashtable where the entry could be found. this is the group chat you're searching through πkeyβ the key to look up. the thing you're matching on, the actual search term, the @ you're trying to find πparamsβ the hashtable params. it's aconst struct rhashtable_params, so it's giving "look but don't touch" π¦sizeβ the size of the entry to allocate if it's not in the table. so if the search comes up empty, this is how much memory we're setting aside for the new one π±
π DESCRIPTION π
so here's the tea: this function returns an entry from a hashtable. simple enough, right?
but if the entry does not exist yet, it allocates the memory for it and returns the new entry. not me showing up, not finding what i wanted, and just making it exist πβ¨ main character energy fr fr.
so yeah β lookup first, allocate if missing, hand you back the entry either way. no cap π§
π SEE ALSO π
- the kernel file
./drivers/net/ethernet/netronome/nfp/flower/conntrack.cβ go read it, iykyk π get_mangled_key(9)β its little friend, also worth a vibe check π
ngl if you're poking around in kernel hashtables, keep an eye on memory stuff β the whole "allocate if it's not there" thing is the moment of the page, so know that it's happening π₯
that's the whole page, bestie!! this absolute gem of a man page is hanging out in the Linux kernel sources β the footer points at ./drivers/net/ethernet/netrono... and it's dated October 2026, page name get_hashentry(9). slay, go read some kernel code, mwah ππ
π¦ 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