list_private...h_entry_safe(9)
π list_private_for_each_entry_safe(9) π
okay so bestie, welcome to the Kernel API Manual β yes, the actual manual name, we're fancy here β and today's main character is list_private_for_each_entry_safe. no cap, this one is lowkey a lifesaver once you get it. let's go π
β¨ NAME β¨
list_private_for_each_entry_safe β iterate over list of given type safe against removal of list entry π¦
like, literally walk your list and survive deleting stuff from it as you go. it's giving "I can have both" energy. periodt.
πΈ SYNOPSIS πΈ
list_private_for_each_entry_safe (pos , n , head , member );
yes the spacing is exactly like that, don't come for me, that's just how it's printed π
π«Ά ARGUMENTS π«Ά
posβ the type * to use as a loop cursor. this is your little main character pointer, the one doing the walking π«nβ another type * to use as temporary storage. think of it as the backup dancer holding the next position so nothing gets lost πheadβ the head for your list. every list has one, it's the anchor, the group chat admin if you will πmemberβ the name of thelist_headwithin the struct. you gotta tell it where the list-ness lives inside your struct, iykyk π
π SEE ALSO π
so here's the whole squad, all of them, no skipping, we love a complete friend group:
- Kernel file
./include/linux/list_private.hPrivate List Primitives(9) list_private_entry(9)list_private_first_entry(9)list_private_last_entry(9)list_private_next_entry(9)list_private_next_entry_circular(9)list_private_prev_entry(9)list_private_prev_entry_circular(9)list_private_entry_is_head(9)list_private_for_each_entry(9)list_private_for_each_entry_reverse(9)list_private_for_each_entry_continue(9)list_private_for_each_entry_continue_reverse(9)list_private_for_each_entry_from(9)list_private_for_each_entry_from_reverse(9)list_private_for_each_entry_safe_continue(9)list_private_for_each_entry_safe_from(9)list_private_for_each_entry_safe_reverse(9)list_private_safe_reset_next(9)
like, the whole family tree fr fr π
heads up bestie: that's the literal list of references from the page β I'm not adding extra ones, I'm not dropping any. we keep every last one πβ¨
and that's the page!! source lives at ./include/linux, dated October 2026 β so it's basically a lil time traveler π°οΈπ mwah, go iterate safely, ily, bye π§ββοΈπ
π¦ 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