xas_find(9)
π 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:
xas_load(9),xas_nomem(9),xas_free_nodes(9),xas_create_range(9),xas_store(9),xas_get_mark(9),xas_set_mark(9),xas_clear_mark(9),xas_init_marks(9),xas_split_alloc(9),xas_split(9),xas_try_split_min_order(9),xas_try_split(9),xas_pause(9),xas_find_marked(9),xas_find_conflict(9)xa_load(9),__xa_erase(9),xa_erase(9),__xa_store(9),xa_store(9),__xa_cmpxchg(9),__xa_insert(9),xa_store_range(9)xas_get_order(9),xa_get_order(9)__xa_alloc(9),__xa_alloc_cyclic(9)__xa_set_mark(9),__xa_clear_mark(9),xa_get_mark(9),xa_set_mark(9),xa_clear_mark(9)xa_find(9),xa_find_after(9),xa_extract(9),xa_delete_node(9),xa_destroy(9)
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
- 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