mt_for_each(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

okay so bestie, this is mt_for_each(9) from the Kernel API Manual, and it’s giving tiny iterator macro with main character energy ✨. It’s literally here to iterate over each entry starting at index until max. That’s highkey the whole gig. Iconic. Periodt πŸ’…

✨ SYNOPSIS ✨

mt_for_each (__tree , __entry , __index , __max );

πŸŽ€ ARGUMENTS πŸŽ€

  • __tree β€” The Maple Tree. Yes, the tree itself, the whole vibe 🌳.
  • __entry β€” The current entry. Like, the one you’re on right now in the loop πŸ‘€.
  • __index β€” The index to start the search from. Subsequently used as iterator. So it starts the search and then keeps doing iterator duty β€” lowkey a double shift πŸ’….
  • __max β€” The maximum limit for index. The ceiling, the cap, the β€œthat’s enough” line πŸ›‘.

πŸ¦‹ DESCRIPTION πŸ¦‹

This iterator skips all entries, which resolve to a NULL pointer, e.g. entries which has been reserved with XA_ZERO_ENTRY. No cap, it just quietly passes over them like β€œnot my entry, not my problem” πŸ™ˆ. Keep that in mind so you don’t get confused when your loop behaves like it’s skipping stuff β€” because it literally is πŸ’€.

bestie note: the skip is for entries that resolve to a NULL pointer, and XA_ZERO_ENTRY-reserved entries are the example. That’s the tea β˜•.

πŸ’– SEE ALSO πŸ’–


xoxo, your kernel bestie 🫢 β€” this mt_for_each(9) moment comes from source/version ./include/linux, dated October 2026. Bye bestie, go iterate slayfully πŸ’…βœ¨

πŸ“¦ where this page comes from