list_private...try_circular(9)
π list_private_next_entry_circular β the "and now back to the start" girlie π
ok so real talk, this one lives in the Kernel API Manual and it's genuinely one of my faves because it does the thing every good playlist does: loops back around πβ¨
β¨ NAME β¨
list_private_next_entry_circular β grab the next element in the list, bestie. and yeah, if you're at the end? she wraps. iconic behaviour tbh π
π¦ SYNOPSIS π¦
list_private_next_entry_circular (pos , head , member );
that's it, that's the whole vibe. three args, one very slay macro π
πΈ ARGUMENTS πΈ
posβ thetype *you're using as your cursor, like your little finger pointing at where you're at rn πheadβ the list head you're taking the element from, aka the main character of this whole list situation πmemberβ the name of thelist_headinside the struct. yes you have to spell it out exactly, no guessing, iykyk π«Ά
π DESCRIPTION π
okay so here's the tea β β this macro wraps around if pos is the last element, and it returns the first element instead. so no matter where you are, you always get a next. she literally never leaves you hanging πβ¨
β οΈ heads up bestie: the list is expected to be not empty. that's not me being dramatic, that's the spec. do not come for me if you pass an empty list, okay? π
π₯ SEE ALSO π₯
the whole friend group fr fr, go read them all:
- 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_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(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)
okay that's the whole page, go forth and wrap around responsibly ππ¦
shoutout to ./include/linux for housing this masterpiece, October 2026 for the timestamp, and the manual page list_private...try_circular(9) β yeah the footer name is a little unhinged but we love her anyway πβ¨
π¦ 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