for_each_cle...itrange_from(9)
π for_each_clear_bitrange_from(9) β like, the whole kernel API manual page, bestie
okay so this is from the Kernel API Manual, section 9 (for_each_cle...itrange_from(9) β yes the title is truncated, no I didn't do that, that's just how it's printed π). Buckle up, we're going bit-by-bit and it's gonna slay.
β¨ NAME β¨
for_each_clear_bitrange_from β iterate over all unset bit ranges [b; e)
that's it. that's the whole vibe. we're walking through every stretch of zeros in a bitmap, starting from a spot you pick. iconic behavior honestly π«Ά
π¦ SYNOPSIS π¦
for_each_clear_bitrange_from (b , e , addr , size );
look at that spacing. don't touch it. it's canon. π
πΈ ARGUMENTS πΈ
bβ bit offset of the start of the current bitrange (the first unset bit), and listen: it must be initialized. like, you have to set it before you go. no cap, it's not optional, don't come crying to me if you skip it πeβ bit offset of the end of the current bitrange (the first set bit). that's where the run of zeros stops, bestie.addrβ bitmap address to base the search on. this is the actual bitmap you're digging through πsizeβ bitmap size in number of bits. yes, bits, not bytes, read it again π
π SEE ALSO π
fr fr go read these too, they're all in the kernel file ./include/linux/find.h and honestly the whole friend group is here:
find_next_bit(9)find_next_and_bit(9)find_next_andnot_bit(9)find_next_or_bit(9)find_next_zero_bit(9)find_first_bit(9)find_nth_bit(9)find_nth_and_bit(9)find_nth_and_andnot_bit(9)find_first_and_bit(9)find_first_andnot_bit(9)find_first_and_and_bit(9)find_first_zero_bit(9)find_last_bit(9)find_next_and_bit_wrap(9)find_next_bit_wrap(9)find_next_clump8(9)for_each_set_bitrange(9)for_each_set_bitrange_from(9)for_each_clear_bitrange(9)for_each_set_bit_wrap(9)for_each_set_clump8(9)
that's twenty-two entries, every single one of them, I counted twice so you don't have to π§
lowkey a reminder: b being uninitialized is the classic oopsie here. the docs literally say "must be initialized" β that's not me being dramatic, that's the spec π
okay that's the page!! mwah π it lives under ./include/linux, and this particular printing is dated October 2026 β so like, future vibes. anyway, for_each_cle...itrange_from(9), that's a wrap, go iterate responsibly β¨ππ¦
π¦ 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