tb_path_discover(9)
π tb_path_discover(9) β the kernel API manual, but make it make sense
okay so bestie, welcome to tb_path_discover(9) from the Kernel API Manual β¨ this is the Thunderbolt path-discovery glow-up you didn't know you needed, and tbh it's lowkey iconic.
π SYNOPSIS
struct tb_path * tb_path_discover (struct tb_port *src , int src_hopid ,
struct tb_port *dst , int dst_hopid , struct tb_port **last , const char
*name , bool alloc_hopid );
like, that's the whole vibe. seven args. she's thorough. π
π ARGUMENTS
srcβ first input port of a path. the starting point, the main character, where the whole journey begins π«Άsrc_hopidβ starting HopID of a path (-1if don't care). pass-1and you're basically saying "idk, surprise me" πdstβ expected destination port of the path (NULLif don't care). again with the not-caring, and honestly? valid.dst_hopidβ HopID to thedst(-1if don't care). same energy, you see the pattern πlastβ last port is filled here if notNULL. so if you hand her a spot, she'll write the last port into it, no cap πnameβ name of the path. give her a cute label fr fralloc_hopidβ allocate HopIDs for the ports. flip this on and she starts handing out HopIDs to everyone she visits like party favours β¨
π¦ DESCRIPTION
So the way that this works: tb_path_discover follows a path starting from src and src_hopid all the way to the last output port of the path πΈ and yes, she's literally walking the whole thing.
She allocates HopIDs for the visited ports β but only if alloc_hopid is true. conditional queen. π
When you're done with the path, call tb_path_free to release the path and the allocated HopIDs, because leaving those lying around is not the vibe. π§Ή
β οΈ okay important heads-up bestie: this function discovers also incomplete paths, so the caller should check that thedstport is the expected one. not me warning you about this, but like, check it. π if it's not the expected one, the path can be cleaned up by callingtb_path_deactivatebeforetb_path_free. in that order. remember the order. π―
β RETURN
Pointer to struct tb_path, or NULL in case of failure. if you get NULL, she's telling you it didn't work β no explanation, just vibes π
π₯ SEE ALSO
- Kernel file
./drivers/thunderbolt/path.c tb_path_alloc(9)tb_path_free(9)tb_path_deactivate_hop(9)tb_path_activate(9)tb_path_is_invalid(9)tb_path_port_on_path(9)
go read them, iykyk π
π that's the whole page, bestie! shoutout to ./drivers/thunderbolt for the source, and big slay energy to the October 2026 date on this one β tb_path_discover(9), periodt. πβ¨
π¦ 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