list_for_each_prev(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… list_for_each_prev(9) β€” the backwards-walk bestie

okay so real talk, this page lives in the Kernel API Manual and it's basically your little cheat code for walking a linked list in reverse. Not forwards. Backwards. We're going back to the beginning, literally. πŸ¦‹


✨ NAME ✨

list_for_each_prev β€” iterate over a list backwards πŸ’«

Like, the whole entire personality of this macro is "walk the list the other way." That's it. That's the tweet.


πŸŽ€ SYNOPSIS πŸŽ€

list_for_each_prev (pos , head );

(it's literally that simple bestie, don't overthink it 🫢)


🌸 ARGUMENTS 🌸

  • pos β€” the struct list_head you're using as your loop cursor. Think of it as your little finger tracing along the list as you go. It's the thing that moves. πŸ’…
  • head β€” the head for your list. The main character. The starting point of the whole situation. πŸ‘‘

πŸ”₯ SEE ALSO πŸ”₯

okay so this is the part where the manpage just dumps the entire friend group on you, and honestly? iconic. every single one of these, no cap:

and before anyone asks β€” the kernel file is ./tools/include/linux/list.h if you wanna go read the source yourself. iykyk πŸ’–

🧚 the cute sign-off 🧚

this whole thing comes to you from ./tools/include/linux, dated October 2026, and it's called list_for_each_prev(9) in case you forgot already (you didn't, you're doing amazing). mwah πŸ’‹βœ¨πŸŽ€

πŸ“¦ where this page comes from