mtree_insert(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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, iykyk
  • entry β€” the entry itself, the thing you're storing πŸŽ€
  • gfp β€” the GFP_FLAGS used 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:


mwah πŸ’‹ this little icon lives in ./lib and is dated October 2026 β€” go forth and insert responsibly, bestie 🫢

πŸ“¦ where this page comes from