mtree_store(9)
π
mtree_store β store an entry at a given index, bestie β¨
okay so this is a page from the Kernel API Manual (section 9, the kernel-functions girlies πΈ), and it's literally about dropping one single entry into a maple tree at a specific index. short page, but she matters. let's get into it π«Ά
β¨ SYNOPSIS β¨
int mtree_store (struct maple_tree *mt , unsigned long index , void
*entry , gfp_t gfp );
that's the whole vibe: returns an int, takes four things. slay. π
π ARGUMENTS π
mtβ the maple tree π³ like, the actualstruct maple_treeyou're messing with. main character energy fr.indexβ the index where the value goes. this is where the thing lives, bestie, choose wisely β¨entryβ the entry you're storing. the payload. the moment. πgfpβ theGFP_FLAGSused for allocations π§ if you don't know what those are, that's a whole other manpage, iykyk.
π RETURN π
0β on success π slay, it worked, we love a zero.-EINVALβ on an invalid request π not me passing something the tree can't handle.-ENOMEMβ if memory could not be allocated π the allocator said no and honestly same.
π¦ SEE ALSO π¦
Kernel file ./lib/maple_tree.c π and like... her entire extended friend group:
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(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_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 group chat right there π go read them, they're iconic, periodt. π
ngl the whole node lives in ./lib, and it's dated October 2026 β so if you're reading this from the future: hi bestie, hope the maple tree is thriving π
stay hydrated, preallocate responsibly, and remember: every entry deserves its own index ππβ¨
π¦ 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