mas_prev(9)
πΈ 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:
mas_prealloc_calc(9)mas_wr_preallocate(9)mas_insert(9)mas_alloc_cyclic(9)mas_walk(9)mte_dead_walk(9)mt_free_walk(9)mas_store(9)mas_store_gfp(9)mas_store_prealloc(9)mas_preallocate(9)mas_next(9)mas_next_range(9)mt_next(9)mas_prev_range(9)mt_prev(9)mas_pause(9)mas_find_setup(9)mas_find(9)mas_find_range(9)mas_find_rev_setup(9)mas_find_rev(9)mas_find_range_rev(9)mas_erase(9)mas_nomem(9)mas_nomem_nofail(9)mtree_load(9)mtree_store_range(9)mtree_store(9)mtree_insert_range(9)mtree_insert(9)mtree_alloc_cyclic(9)mtree_erase(9)__mt_dup(9)mtree_dup(9)__mt_destroy(9)mtree_destroy(9)mt_find(9)mt_find_after(9)
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
- 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