mas_prev(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 mas_prev(9) β€” the Kernel API Manual glow-up 🌸

okay bestie, so you're diving into the maple tree kernel API and you found mas_prev and you're like "what does this even do" β€” don't worry, I got you. This is literally from the Kernel API Manual and we're gonna make it make sense πŸ’…


✨ SYNOPSIS ✨

void * mas_prev (struct ma_state *mas , unsigned long min );

like, it returns a void * and takes a maple state pointer and an unsigned long minimum. iconic signature tbh.


πŸŽ€ ARGUMENTS πŸŽ€

  • mas β€” The maple state. this is your main character struct, the whole vibe check of the operation lives here πŸ—ΊοΈ
  • min β€” The minimum value to check. like, don't go below this, fr fr.

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea:

You must hold rcu_read_lock or the write lock. no cap. if you don't, that's not it.

It will reset mas to ma_start if the status is ma_none. so like, it knows how to start over, very self-aware of it.

Will stop on not searchable nodes. periodt. it's not gonna keep digging where it shouldn't.


πŸ”₯ RETURN πŸ”₯

the previous value, or NULL. that's it. that's the whole return section. simple, clean, slay.

ngl if you get NULL back, maybe check your locks first bestie 😭

πŸ¦‹ SEE ALSO πŸ¦‹

okay bestie here's the whole friend group, all from the kernel file ./lib/maple_tree.c:

like, that's the whole squad. go read them. iykyk πŸ’œ


and that's the page bestie! this lil guy lives in ./lib and the manual's dated October 2026 β€” go forth and traverse that maple tree, you absolute icon πŸ‘‘βœ¨

πŸ“¦ where this page comes from