list_prev_entry_circular(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… list_prev_entry_circular β€” the Kernel API Manual, but make it make sense

okay so bestie, welcome to list_prev_entry_circular(9) from the Kernel API Manual β€” she's a little macro, she's a little iconic, and she's about to walk you backwards through a linked list like it's a runway. πŸŽ€


✨ SYNOPSIS ✨

list_prev_entry_circular (pos , head , member );

no cap, that's the whole vibe. three little things and she's done. πŸ¦‹


🌸 ARGUMENTS 🌸

like, the three things she needs from you before she'll do anything:

  • pos β€” the *type ** to cursor. this is your little pointer bestie that's holding the current spot, okay? she's the main character here.
  • head β€” the list head to take the element from. yes, the actual head of the list. she needs to know where the party starts. πŸ‘‘
  • member β€” the name of the list_head within the struct. this is literally just the field name, so she knows where inside your struct the list glue lives. iykyk.

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea: you give her a pos, and she gives you the previous element. simple. slay.

but β€” and this is the part that ate β€” she wraps around. if pos is the first element, she doesn't just fall off the edge and cry about it; she loops all the way around and hands you the last element instead. it's giving circular, it's giving "no beginning, no end," it's giving main character energy. πŸ”₯

⚠️ heads up bestie: the list is expected to be not empty. this macro does not vibe-check that for you. an empty list is on you, fr fr. 😭

🫢 SEE ALSO 🫢

she does not exist alone, she's part of a whole friend group. Kernel file ./include/linux/list.h. go say hi to literally all of these:

LIST_HEAD_INIT(9), LIST_HEAD(9), LIST_HEAD_GUARDED(9), INIT_LIST_HEAD(9), list_add(9), list_add_tail(9), list_add_tail_release(9), list_del(9), list_replace(9), list_replace_init(9), list_swap(9), list_del_init(9), list_move(9), list_move_tail(9), list_bulk_move_tail(9), list_is_first(9), list_is_last(9), list_is_head(9), list_empty(9), list_del_init_careful(9), list_empty_careful(9), list_rotate_left(9), list_rotate_to_front(9), list_is_singular(9), list_cut_position(9), list_cut_before(9), list_splice(9), list_splice_tail(9), list_splice_init(9), list_splice_tail_init(9), list_entry(9), list_first_entry(9), list_last_entry(9), list_first_entry_or_null(9), list_first_entry_or_null_acquire(9), list_last_entry_or_null(9), list_next_entry(9), list_next_entry_circular(9), list_prev_entry(9), list_for_each(9), list_for_each_continue(9), list_for_each_prev(9), list_for_each_safe(9), list_for_each_prev_safe(9), list_count_nodes(9), list_entry_is_head(9), list_for_each_entry(9), list_for_each_entry_reverse(9), list_prepare_entry(9), list_for_each_entry_continue(9), list_for_each_entry_continue_reverse(9), list_for_each_entry_from(9), list_for_each_entry_from_reverse(9), list_for_each_entry_safe(9), list_for_each_entry_safe_continue(9), list_for_each_entry_safe_from(9), list_for_each_entry_safe_reverse(9), list_safe_reset_next(9), hlist_unhashed(9), hlist_unhashed_lockless(9), hlist_empty(9), hlist_del(9), hlist_del_init(9), hlist_add_head(9), hlist_add_before(9), hlist_add_behind(9), hlist_add_fake(9), hlist_fake(9), hlist_is_singular_node(9), hlist_move_list(9), hlist_splice_init(9), hlist_for_each_entry(9), hlist_for_each_entry_continue(9), hlist_for_each_entry_from(9), hlist_for_each_entry_safe(9), hlist_count_nodes(9)


okay that's the whole page, you're officially a list girlie now. mwah πŸ’‹

this little love letter came from ./include/linux and it's dated October 2026 β€” stan her, cite her, wrap around responsibly. 🧚✨

πŸ“¦ where this page comes from