kunit_add_named_resource(9)
π kunit_add_named_resource (9) π
okay so bestie, welcome to the Kernel API Manual β yes that's the manual name, we're fancy here π β and today's main character is kunit_add_named_resource, which literally does what it says on the tin: it adds a named test managed resource. no cap. π
β¨ NAME β¨
kunit_add_named_resource β add a named test managed resource. that's it, that's the vibe. π
πΈ SYNOPSIS πΈ
int kunit_add_named_resource (struct kunit *test , kunit_resource_init_t
init , kunit_resource_free_t free , struct kunit_resource *res , const
char *name , void *data );
she takes six arguments and returns an int, and honestly? she ate. π₯
π¦ ARGUMENTS π¦
testβ the test context object. the whole situation lives inside this, she's the main character energy of the call fr fr.initβ a user-supplied function to initialize the resource data, if needed. you bring the setup, she brings the vibes.freeβ a user-supplied function to free the resource data, if needed. the cleanup crew π§Ή β again, only if needed, no pressure.resβ the resource. like, the actual resource resource. iconic.nameβ name to be set for resource. give her a name, she deserves one π.dataβ value to pass toinitfunction or set in resource data field. whatever you hand over goes straight toinitor into the resource's data field, so pack accordingly π.
π SEE ALSO π
like, go read these too, they're all part of the same friend group π«Ά β straight from the kernel file ./include/kunit/resource.h:
struct kunit_resource(9)kunit_get_resource(9)kunit_put_resource(9)__kunit_add_resource(9)kunit_add_resource(9)kunit_alloc_and_get_resource(9)kunit_alloc_resource(9)kunit_resource_name_match(9)kunit_find_resource(9)kunit_find_named_resource(9)kunit_destroy_resource(9)kunit_remove_resource(9)KUNIT_DEFINE_ACTION_WRAPPER(9)kunit_add_action(9)kunit_add_action_or_reset(9)kunit_remove_action(9)kunit_release_action(9)
lowkey important bestie: this page came from ./include/kunit, dated October 2026 β so when you cite her, cite her right ππ
and that's the whole page!! go add those named test managed resources, you absolute legend πβπ
π¦ 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