vdo_int_map_put(9)
π vdo_int_map_put(9) π
okay so real talk, this is a page straight out of the Kernel API Manual β yes, that Kernel API Manual β and it's all about vdo_int_map_put. Buckle up bestie, we're mapping integers to values and it's gonna slay. πΈ
β¨ NAME β¨
vdo_int_map_put β try to associate a value with an integer. that's it. that's the whole vibe. π
π SYNOPSIS π
int vdo_int_map_put (struct int_map *map , u64 key , void *new_value ,
bool update , void **old_value_ptr );
look at her. five args. main character energy fr. π
π¦ ARGUMENTS π¦
mapβ theint_mapyou're trying to modify. she's the one getting the glow-up. πkeyβ the key you wanna associate the new value with. like, this is the lock and the value is the key but also the key is the key. iykyk. πnew_valueβ the value that's getting associated with the key. the new kid. the fresh face. πupdateβ whether to overwrite an existing value. like, do we barge in and redecorate, or do we respect what's already there?true= barge in. π€old_value_ptrβ a pointer where you stash either the old value (if the key was already mapped) orNULLif the map didn't contain the key. and here's the cute part: you can passNULLfor this whole thing if you literally do not care about the old value. not me being unbothered. π
π DESCRIPTION π
So the mission β should you choose to accept it β is to try to associate a value (a pointer, babe, it's a pointer) with an integer in an int_map. π«Ά
If the map already contains a mapping for the provided key, the old value only gets replaced with the specified value if update is true. Otherwise the old one just sits there, unbothered, thriving. π
And in either case, the old value is returned. every single time. no exceptions, no cap. π―
But if the map does not already contain a value for the specified key? then the new value gets added regardless of the value of update. like update doesn't even get a vote in that situation. she's irrelevant. iconic. π₯
β RETURN β
VDO_SUCCESS or an error code. that's the whole return section. short and sweet, just how we like it. β¨
π§ SEE ALSO π§
Kernel file ./drivers/md/dm-vdo/int-map.c β go read the source, bestie, it's giving lore. π
Introduction(9)struct bucket(9)struct int_map(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_remove(9)
literally the whole friend group. go say hi. ππ
okay and finally, the credits moment β this page lives in ./drivers/md/dm-vdo, dated October 2026, and it's page vdo_int_map_put(9) of the Kernel API Manual. mwah. π thanks for coming to my ted talk, go map some integers 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