hash_for_each_safe(9)
β¨ NAME β¨
okay bestie, meet hash_for_each_safe β the one that helps you iterate over a hashtable safe against removal of hash entry. π
this is the hash_for_each_safe(9) page from the Kernel API Manual, and it's giving βremoval-safe loop, no cap.β π«Ά
π SYNOPSIS π
here's the exact spell, copy it character for character:
hash_for_each_safe (name , bkt , tmp , obj , member );
π ARGUMENTS π
nameβ the hashtable to iterate. slay, that's your table. β¨bktβ an integer to use as bucket loop cursor. it keeps the bucket loop moving, iykyk. π₯tmpβ a struct used for temporary storage. literally the temp bestie holding space. πobjβ thetype *to use as a loop cursor for each entry. main character loop cursor energy. πmemberβ the name of thehlist_nodewithin the struct. yes, that exact member. π
π¦ SEE ALSO π¦
the kernel file is ./tools/include/linux/hashtable.h, and the whole friend group is right here:
hash_init(9)hash_add(9)hash_hashed(9)hash_empty(9)hash_del(9)hash_for_each(9)hash_for_each_possible(9)hash_for_each_possible_safe(9)
mwah π this little icon comes from ./tools/include/linux, dated October 2026, and it's literally hash_for_each_safe(9). periodt. ππ
π¦ 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