mtree_insert(9)
π NAME π
okay so welcome to the mtree_insert(9) glow-up, bestie β straight out of the Kernel API Manual β¨
mtree_insert β insert an entry at a given index, but only if there's no value there already. it's giving "respectfully, this seat is taken" energy: if the spot is free you slide your entry in, and if it's not, no cap, the call just refuses. periodt. π
β¨ SYNOPSIS β¨
int mtree_insert (struct maple_tree *mt , unsigned long index , void *entry , gfp_t gfp );
π¦ ARGUMENTS π¦
mtβ the maple tree you're working with, your main character data structure π³indexβ the index where the value is gonna be stored, iykykentryβ the entry itself, the thing you're storing πgfpβ theGFP_FLAGSused for allocations, the whole memory vibe check
π RETURN π
0β success!! it worked, slay π-EEXISTSβ the range is occupied already, someone got there first π-EINVALβ invalid request, not it π-ENOMEMβ memory could not be allocated, tragic π
π₯ SEE ALSO π₯
peep the kernel file ./lib/maple_tree.c, and honestly the whole iconic friend group of maple tree functions:
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_store(9)mtree_insert_range(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)
mwah π this little icon lives in ./lib and is dated October 2026 β go forth and insert responsibly, bestie π«Ά
π¦ 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