xas_find_marked(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… xas_find_marked β€” like, the whole page, bestie

okay so you're in the Kernel API Manual and the function is xas_find_marked(9) β€” yes, the (9) is the section, it's giving kernel-internals realness, we love that for us ✨


🌸 NAME 🌸

xas_find_marked β€” finds the next marked entry in the XArray. that's it, that's the whole vibe. πŸŽ€


✨ SYNOPSIS ✨

void * xas_find_marked (struct xa_state *xas , unsigned long max ,
       xa_mark_t mark );

(note the space before the commas in that signature β€” that's how it's written, we do not edit the queen's handwriting πŸ’…)


πŸ¦‹ ARGUMENTS πŸ¦‹

  • xas β€” the XArray operation state. it's the little luggage the operation carries around with it, yep.
  • max β€” the highest index to return. like, the ceiling, the boundary, the "do not pass go past here" index 🚧
  • mark β€” the mark number to search for. which little tag you're hunting for πŸ”Ž

πŸ’– DESCRIPTION πŸ’–

okay this is the part where it gets good. so picture this:

if the xas has not yet been walked to an entry, we return the marked entry which has an index >= xas.xa_index. simple, clean, iconic.

if it has been walked, then the entry currently being pointed at has already been processed β€” been there, done that β€” so we return the first marked entry with an index > xas.xa_index. note the strictly-greater, no cap, that's not a typo, it's the whole point πŸ™ˆ

and then, bestie, the two endings:

  • no marked entry found AND the array is smaller than max? then xas is set to the bounds state, and xas->xa_index is set to the smallest index not yet in the array. the payoff? xas can be immediately passed to xas_store β€” like, no extra steps, immediately, we're so efficient. πŸ‘‘
  • no entry found before max is reached? then xas is set to the restart state. that's the "womp womp, try again" state 😭

πŸ”₯ RETURN πŸ”₯

the entry, if found. otherwise NULL. that's it. that's the return value. short and slay. 🫢


🌈 SEE ALSO 🌈

kernel file ./lib/xarray.c, plus the entire friend group (fr fr, this is the full list, every single one):

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(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)


lowkey reminder: NULL is a real return value here, not a personality flaw. check for it, bestie. πŸ’€

k byeee, this page lives in ./lib, dated October 2026 β€” signed, sealed, delivered, xoxo πŸ§šπŸ’œπŸŒ·

πŸ“¦ where this page comes from