idr_get_next(9)
π idr_get_next(9) β like, the Kernel API Manual page, bestie π
Ok so this is from the Kernel API Manual and it's genuinely one of those tiny little functions that carries the whole group project, so listen up π«Ά
β¨ NAME β¨
idr_get_next β find the next populated entry. That's it, that's the whole vibe check π
πΈ SYNOPSIS πΈ
void * idr_get_next (struct idr *idr , int *nextid );
Not me obsessing over how short this signature is π void * out front, two pointers, done. Iconic.
π ARGUMENTS π
idrβ your IDR handle. Like, your whole little tree thing. The main character πnextidβ a pointer to an ID. Yep, a pointer, not the ID itself. She's indirect, she's mysterious π
π¦ DESCRIPTION π¦
So here's the tea, bestie: idr_get_next gives you the next populated entry in the tree β the first one whose ID is greater than or equal to the value pointed to by nextid. No cap.
And here's the part everyone forgets π on exit, nextid gets updated to the ID of the value it actually found. So it writes back to you. Slay.
β IMPORTANT LOOP MECHANICS, FR FR: if you wanna use this in a loop, you β the user β have to increment the value pointed to by nextid yourself. The function is NOT gonna do it for you. It's not that kind of girl. Please don't skip this step, I am begging π
π₯ SEE ALSO π₯
Kernel file ./lib/idr.c β she lives there π
idr_alloc_u32(9)idr_alloc(9)idr_alloc_cyclic(9)idr_remove(9)idr_find(9)idr_for_each(9)idr_get_next_ul(9)idr_replace(9)IDA description(9)ida_alloc_range(9)ida_find_first_range(9)ida_free(9)ida_destroy(9)
Like, the whole IDR/IDA friend group showed up to the party π go say hi to all of them, iykyk.
And that's the page!! Brought to you out of ./lib, dated October 2026 β yes, the future πβ¨ bye bestie, go populate that tree πΈππ«Ά
π¦ 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