__devlink_re...pshot_id_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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 πŸ¦‹:


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