list_for_eac...from_reverse(9)
π list_for_eacβ¦from_reverse(9) β the Kernel API Manual, bestie edition β¨
okay so before we even get into it: yes, the title up top is truncated to list_for_eac...from_reverse(9) (the kernel doc tooling really said "you get half the name, that's the vibe today"), and yes, we're living in the Kernel API Manual. But the β¨actualβ¨ thing we're talking about is list_for_each_entry_from_reverse β a macro. From ./include/linux/list.h. She's a linked-list girlie. Keep scrolling π
πΈ NAME πΈ
list_for_each_entry_from_reverse β walk a list backwards, over entries of a given type, starting from wherever you currently are. She's the "no, go the other way, and start from here" macro. Lowkey iconic π
π¦ SYNOPSIS π¦
list_for_each_entry_from_reverse (pos , head , member );
copy it exactly like that, spaces and all, no cap π
π ARGUMENTS π
posβ thetype *that works as your loop cursor. This is the main character of the loop. It's the pointer that gets moved around, iteration after iteration π«Άheadβ the head of your list. Like, the actualheadfor the list you're looping over β¨memberβ the name of thelist_headliving inside the struct. Not the struct name, bestie β the field. iykyk π
π DESCRIPTION π
So here's the whole deal: you iterate backwards over a list of the given type, and β this is the important bit β you continue from the current position. Not from the start, not from the tail. From right where you are. She's picking up mid-conversation, basically. The way that she just slots into your loop and keeps going ππ₯
fr fr, "continuing from current position" is the whole personality of this macro β don't skip it, it's doing the work π
π SEE ALSO π
the full squad, alphabetically-ish, and yes we're listing every single one because nobody gets left behind π«Άπ The kernel file is ./include/linux/list.h:
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_prev_entry_circular(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_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)
like, the whole friend group showed up to the function π§π
okay that's the page!! this one lives in ./include/linux and it's dated October 2026 π
β so yeah, shoutout to that directory and that date, and shoutout to you for reading all the way to the bottom. slay, you now understand list_for_each_entry_from_reverse(9). go iterate backwards, bestie π
β¨π
π¦ 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