xas_find(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… xas_find(9) β€” or, "where's the next thing bestie"

okay so this is a page from the Kernel API Manual, and honestly it's a short one but it's important, so pay attention 🫢


✨ NAME ✨

xas_find β€” find the next present entry in the XArray. that's it. that's the whole job. slay πŸ’…


🌸 SYNOPSIS 🌸

void * xas_find (struct xa_state *xas , unsigned long max );

πŸŽ€ ARGUMENTS πŸŽ€

  • xas β€” the XArray operation state. this is your little cursor bestie, it's holding the whole vibe of where you are in the array πŸ’–
  • max β€” highest index to return. like, the ceiling. the limit. do not pass go past this number, bestie 🚫

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜•

if the xas has not yet been walked to an entry, you get the entry that has an index >= xas.xa_index. simple. iconic. no notes.

but if it has been walked? then the entry currently being pointed at has already been processed β€” been there, done that, ate and left no crumbs β€” so we move on to the next entry. next!! ✨

and now the lowkey important part: if no entry is found and the array is smaller than max, the iterator gets set to the smallest index not yet in the array. why does that matter, you ask? because it means xas can be handed straight over to xas_store with zero extra steps. it's giving convenience, it's giving main character energy πŸ‘‘


⭐ RETURN ⭐

the entry, if found πŸ’– otherwise NULL 😭 (ngl, NULL is always the villain in these stories)


πŸ”₯ SEE ALSO πŸ”₯

so xas_find does not exist in a vacuum, bestie β€” it runs with a whole squad. literally the Kernel file ./lib/xarray.c plus:

like I said. a whole squad. 🧚


and that's the page, bestie πŸŽ€ it lives in ./lib, and this version is dated October 2026 β€” so if you're reading this in the future, hi, hope the kernel is thriving πŸ’œβœ¨

πŸ“¦ where this page comes from