hlist_nulls...h_entry_safe(9)
π hlist_nulls_for_each_entry_safe π
okay so bestie, welcome to the Kernel API Manual β yes, the actual kernel API manual, and yes, we're gonna get through this together π«Ά this one's like a tiny little page but it's honestly iconic if you're the kind of girl who likes walking a list while other people are out here deleting stuff from it π
πΈ NAME πΈ
hlist_nulls_for_each_entry_safe β iterate over list of given type safe against removal of list entry
like literally that's the whole vibe: you're iterating over a list of a given type, and you're safe against removal of the list entry while you do it π no cap, that's the whole point.
β¨ SYNOPSIS β¨
hlist_nulls_for_each_entry_safe (tpos , pos , head , member );
that's it, that's the whole call π four things go in, and the spaces before the commas are canon, we don't touch them, we respect them π
π¦ ARGUMENTS π¦
tposβ the type * to use as a loop cursor. like, the type, with a star, it's a pointer bestie β this is your main character cursor.posβ thestruct hlist_nulls_nodeto use as a loop cursor. this one's the node-shaped cursor, the little structural one that's doing the actual walking π§headβ the head of the list. the whole thing starts here, this is the doorway πmemberβ the name of thehlist_nulls_nodewithin the struct. i.e. which field inside your struct is the list node β you gotta tell it, it can't guess, it's not psychic π
two cursors, one loop, zero fear.tposis the typed one,posis the node one, andmemberis how the macro finds the node inside your struct. that's the whole squad π
π₯ SEE ALSO π₯
kernel file ./include/linux/rculist_nulls.h β go read it, it's giving source of truth β¨
and the whole friend group:
hlist_nulls_del_init_rcu(9)hlist_nulls_first_rcu(9)hlist_nulls_next_rcu(9)hlist_nulls_pprev_rcu(9)hlist_nulls_del_rcu(9)hlist_nulls_add_head_rcu(9)hlist_nulls_add_tail_rcu(9)hlist_nulls_replace_rcu(9)hlist_nulls_replace_init_rcu(9)hlist_nulls_for_each_entry_rcu(9)
like, that's the entire nulls-hlist-rcu group chat and you should absolutely go say hi to all of them π«Ά
okay that's the page!! mwah π this one came straight out of ./include/linux and it's dated October 2026 β so yeah, it's from the future, we don't question it, we just say thank you and slay πβπ
π¦ 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