bitmap_find_...ero_area_off(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:

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