__devlink_re...pshot_id_get(9)
πΈ __devlink_re...pshot_id_get(9) πΈ
okay bestie so welcome to the Kernel API Manual π you're literally reading the page for __devlink_re...pshot_id_get(9) and it's giving kernel-internals realness, so let's get into it π
β¨ NAME β¨
__devlink_region_snapshot_id_get β get snapshot ID π«Ά (that's the whole job, she's a getter, an icon)
β¨ SYNOPSIS β¨
int __devlink_region_snapshot_id_get (struct devlink *devlink , u32 *id );
β¨ ARGUMENTS β¨
devlinkβ the devlink instance, like the actual object you're working with, no cap πidβ storage to return snapshot id β that's the lil spot where the snapshot id gets handed back to you π
β¨ DESCRIPTION β¨
okay so what she does is allocates a new snapshot id β¨ Returns zero on success, or a negative error on failure π (classic).
β οΈ lowkey important: this must be called while holding the devlink instance lock. fr fr, do not skip the lock, that's not a vibe π
Snapshot IDs are tracked using an xarray which stores the number of users of the snapshot id π. Like, the xarray is keeping count of how many people are holding onto each id β very main character bookkeeping energy π
Also note π: the caller of this function counts as a 'user', in order to avoid race conditions. So yes, you're part of the count the second you call her π. That means the caller must release its hold on the snapshot by using devlink_region_snapshot_id_put β like, you gotta give the id back when you're done, don't just ghost it ππ
β¨ SEE ALSO β¨
Kernel file ./net/devlink/region.c plus all these besties π¦:
__devlink_snapshot_id_increment(9)__devlink_snapshot_id_decrement(9)__devlink_snapshot_id_insert(9)__devlink_region_snapshot_create(9)devl_region_create(9)devlink_region_create(9)devlink_port_region_create(9)devl_region_destroy(9)devlink_region_destroy(9)devlink_region_snapshot_id_get(9)devlink_region_snapshot_id_put(9)devlink_region_snapshot_create(9)
and that's the page, bestie π this was brought to you by ./net/devlink, October 2026 β periodt, go forth and manage your snapshot ids 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