STRUCT INT_MAP(9)
π 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 fromcapacity, 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 π«Ά:
- Kernel file
./drivers/md/dm-vdo/int-map.c Introduction(9)struct bucket(9)mix(9)hash_key(9)allocate_buckets(9)vdo_int_map_create(9)vdo_int_map_free(9)vdo_int_map_size(9)dereference_hop(9)insert_in_hop_list(9)select_bucket(9)search_hop_list(9)vdo_int_map_get(9)resize_buckets(9)find_empty_bucket(9)move_empty_bucket(9)update_mapping(9)find_or_make_vacancy(9)vdo_int_map_put(9)vdo_int_map_remove(9)
fr fr,capacityβbucket_countand 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
- 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