STRUCT INT_MAP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ struct int_map(9) β€” the glow-up

okay bestie, so this is a page from the Kernel API Manual (yes that's the manual name, we're in the big leagues now) and it's literally just the ~real~ definition of the int_map type β€” the one everybody else keeps as an opaque lil mystery. no cap, this is the reveal. πŸŽ€


✨ NAME ✨

struct int_map β€” the concrete definition of the opaque int_map type. like, the actual struct. the receipts. the whole fit. πŸ’…


🌸 SYNOPSIS 🌸

struct int_map {
    size_t size;
    size_t capacity;
    size_t bucket_count;
    struct bucket *buckets;
 };

that's it, that's the whole struct. she's small but she's iconic ✨


πŸ¦‹ Members πŸ¦‹

  • size β€” the number of entries stored in the map. i.e. how much stuff is actually in there, bestie. πŸ“
  • capacity β€” the number of neighborhoods in the map. yes, neighborhoods. that's the word. we don't make the rules. 🏘️
  • bucket_count β€” the number of buckets in the bucket array. and yes this is lowkey different from capacity, keep reading, i promise it makes sense πŸ‘€
  • buckets β€” the array of hash buckets. the actual bucket lineup. πŸ’€

πŸ”₯ Description πŸ”₯

okay so here's the tea β˜• β€” when you've got entries at the very end of the map, their neighborhoods would normally have to wrap all the way back around to the start of the bucket array. and that's awkward. so instead we just allocate a few more buckets at the end of the array. extra buckets. bonus buckets. treat yourself. 🎁

which is exactly why capacity and bucket_count are different numbers β€” not a bug, not a typo, it's on purpose. iykyk πŸ’…βœ¨


🌈 SEE ALSO 🌈

go read these next, bestie, they're the whole extended universe 🫢:


fr fr, capacity β‰  bucket_count and that is the whole plot twist. don't come for me about it, come for the extra buckets at the end. πŸ™ˆ

k bye ily, this page lives in ./drivers/md/dm-vdo and it's stamped October 2026 β€” so like, future vibes only. see u in the next manpage, mwah πŸ’–πŸ§šβ€β™€οΈπŸŽ€

πŸ“¦ where this page comes from