list_for_eac...from_reverse(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the type * 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 actual head for the list you're looping over ✨
  • member β€” the name of the list_head living 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:

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