devlink_try_get(9)
β¨ devlink_try_get(9) β¨
okay so bestie, we're diving into the kernel API manual (devlink_try_get(9)) and honestly? this one is short but it's giving "small but mighty" energy. let's get into it π
πΈ NAME πΈ
devlink_try_get β try to obtain a reference on a devlink instance
like, try. that word is doing a lot of work here, and we respect it π«Ά
π SYNOPSIS π
struct devlink * devlink_try_get (struct devlink *devlink );
π¦ ARGUMENTS π¦
devlinkβ the instance you're trying to get a reference on. that's the one, bestie π―
π DESCRIPTION π
So here's the tea: devlink_try_get obtains a reference on a devlink instance. simple enough, right?
But wait β and this is the part you cannot skip, babes β a reference on a devlink instance only implies that it's safe to take the instance lock. that's it. that's the whole promise. β
It does not imply that the instance is registered. like, at all. so if you need to know whether it's actually registered, you gotta use devl_is_registered β and crucially, you call that after taking the instance lock to check the registration status. order matters, no cap. π₯
β οΈ do not assume a successful reference means "registered". it does not. take the lock, then check with devl_is_registered. periodt. π
π SEE ALSO π
- Kernel file
./net/devlink/core.c devlink_rel_nested_in_notify(9)devl_register(9)devl_unregister(9)devlink_alloc_ns(9)devlink_free(9)
go read the source bestie, it's right there in ./net/devlink π iykyk
and that's a wrap on this one, my love π this page came from the ./net/devlink source, dated October 2026, in the devlink_try_get(9) era β iconic, honestly. 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