tb_path_discover(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 (-1 if don't care). pass -1 and you're basically saying "idk, surprise me" πŸ™ˆ
  • dst β€” expected destination port of the path (NULL if don't care). again with the not-caring, and honestly? valid.
  • dst_hopid β€” HopID to the dst (-1 if don't care). same energy, you see the pattern πŸ‘‘
  • last β€” last port is filled here if not NULL. 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 fr
  • alloc_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 the dst port 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 calling tb_path_deactivate before tb_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

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