list_for_eac...safe_reverse(9)
π NAME π
ok so bestie, list_for_each_entry_safe_reverse β this is from the Kernel API Manual btw β it's the macro that walks your list backwards and does not freak out if something gets deleted mid-walk. safe against removal, backwards, iconic behaviour only.
β¨ SYNOPSIS β¨
list_for_each_entry_safe_reverse (pos , n , head , member );
π ARGUMENTS π
posβ the *type ** you use as the loop cursor. it's your little main character pointer, out here living its best life pointing at each entry as you go πnβ another *type ** but this one's just temporary storage. the understudy. the backup dancer. it hangs onto the next thing so you don't lose your place π«Άheadβ the head of your list. like, the literal starting node of the whole situation πΈmemberβ the name of thelist_headinside the struct. yes bestie, you gotta tell it where the list-ness lives π¦
π₯ DESCRIPTION π₯
so basically: you iterate backwards over a list of the given type, and the whole thing is safe against removal of a list entry. like you can literally be out here deleting stuff as you go and it won't betray you. no cap. that's the whole vibe β¨
π SEE ALSO π
the kernel file lives at ./tools/include/linux/list.h β and here's the whole friend group, they all say hi π
list_add(9)list_add_tail(9)list_replace(9)list_del_init(9)list_move(9)list_move_tail(9)list_is_first(9)list_is_last(9)list_empty(9)list_empty_careful(9)list_rotate_left(9)list_is_singular(9)list_cut_position(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_last_entry_or_null(9)list_next_entry(9)list_prev_entry(9)list_for_each(9)list_for_each_prev(9)list_for_each_safe(9)list_for_each_prev_safe(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_safe(9)list_for_each_entry_safe_continue(9)list_for_each_entry_safe_from(9)list_safe_reset_next(9)hlist_for_each_entry(9)hlist_for_each_entry_continue(9)hlist_for_each_entry_from(9)hlist_for_each_entry_safe(9)list_del_range(9)list_for_each_from(9)
ok that's the whole page, mwah π this one's coming at you from ./tools/include/linux and it's dated October 2026, page list_for_eac...safe_reverse(9) β yes the title is literally truncated with dots in the header, and we love her for that πβ¨ bye bestie, go reverse some lists responsibly π§ββοΈπ
π¦ 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