bitmap_find_...ero_area_off(9)
π bitmap_find_...ero_area_off(9) β Kernel API Manual
okay bestie, so this is a page from the Kernel API Manual and honestly? it's a little sleeper hit. it's bitmap_find_next_zero_area_off, and yes the header truncates it because even manpage headers have a character limit, we don't make the rules π
β¨ NAME β¨
bitmap_find_next_zero_area_off β find a contiguous aligned zero area π
like, you're scanning a bitmap for a stretch of zeros that's the right length AND lines up the way you want. that's the whole gig. slay.
πΈ SYNOPSIS πΈ
unsigned long bitmap_find_next_zero_area_off (unsigned long *map ,
unsigned long size , unsigned long start , unsigned int nr , unsigned
long align_mask , unsigned long align_offset );
look at all those params π it's giving long and typed, and honestly every single one of them matters, so let's meet the cast.
π¦ ARGUMENTS π¦
mapβ the address to base the search on. this is the bitmap you're snooping through, not to be confused with the other kind of map that gets you to treasure πΊοΈsizeβ the bitmap size in bits. this is the boundary, the edge of the world, the point where you stop looking π₯startβ the bitnumber to start searching at. you're not starting from zero, you're starting exactly here, no notes β¨nrβ the number of zeroed bits we're looking for. how many zeros in a row do you need? this many. periodt.align_maskβ alignment mask for zero area. sounds scary, it's not, keep reading πalign_offsetβ alignment offset for zero area. the little nudge that shifts the alignment target off dead-zero π«Ά
π DESCRIPTION π
okay so here's the vibe check on align_mask: it should be one less than a power of 2. that's the rule, that's the setup, respect it.
and the effect of that? the bit offset of all zero areas this function finds, plus align_offset, is a multiple of that power of 2. that's it. that's the magic. it's not complicated, it's just alignment with extra steps and honestly we love that for it π
π₯ RETURN π₯
the function hands you back the bit offset of the found area π
or β and this is the part where you go "π" β a value greater than or equal to size if no area is found. so yeah, if what you get back is >= size, that's your "nope, nothing, not today" signal. don't miss it.
bestie please actually check the return value against size. no cap, that's how you catch the failure case π
π SEE ALSO π
run don't walk, go read these too:
- Kernel file
./lib/bitmap.c bitmap introduction(9)__bitmap_shift_right(9)__bitmap_shift_left(9)bitmap_cut(9)bitmap_pos_to_ord(9)bitmap_remap(9)bitmap_bitremap(9)bitmap_onto(9)bitmap_fold(9)bitmap_from_arr32(9)bitmap_to_arr32(9)bitmap_from_arr64(9)bitmap_to_arr64(9)
the whole bitmap friend group, they all hang out together, it's iconic π§
okay and last thing, the little footer things so you know where this came from: it lives under ./lib, version/date stamp is October 2026, and the page name shows up as bitmap_find_...ero_area_off(9) because the header had to squeeze it. mwah, go find some zeros πβ¨π
π¦ 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