tb_path_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… tb_path_alloc(9) β€” like, the kernel API manual, but make it make sense πŸ¦‹

okay bestie, welcome to the tb_path_alloc(9) page from the Kernel API Manual ✨ this is the one that hands you a whole thunderbolt path between two ports, and honestly the way it does it is kind of iconic. no cap.


🌸 NAME 🌸

tb_path_alloc β€” allocate a thunderbolt path between two ports πŸ’–

like, it literally makes you a path. between two ports. that's the whole vibe check.


✨ SYNOPSIS ✨

struct tb_path * tb_path_alloc (struct tb *tb , struct tb_port *src ,
int src_hopid , struct tb_port *dst , int dst_hopid , int link_nr ,
const char *name );

seven arguments, one function, zero regrets. copy it exactly, bestie, we don't freestyle signatures here πŸ™ˆ


πŸŽ€ ARGUMENTS πŸŽ€

  • tb β€” the domain pointer. it's giving "main character energy" β€” everything else lives inside it πŸ‘‘
  • src β€” source port of the path. where the journey starts πŸš€
  • src_hopid β€” the HopID used for the first ingress port in the path πŸŒ€
  • dst β€” destination port of the path. where we're headed, periodt 🎯
  • dst_hopid β€” the HopID used for the last egress port in the path 🌈
  • link_nr β€” the preferred link if there are dual links on the path ✌️ (dual links = two lanes, we love options)
  • name β€” name of the path. give it a cute one, it deserves it 🏷️

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea, bestie: this creates a path between two ports, starting with the given src_hopid 🫢

then it reserves HopIDs for each port. and no, they can't always be the same as src_hopid β€” lowkey they can absolutely be different, depending on how many HopIDs each port already has reserved 😭 like, the ports are booked and busy. it works around that.

and if there are dual links on the path, it prioritizes using link_nr β€” but highkey it takes into account that the lanes may be bonded πŸ”₯ so it's not just blindly picking your fave link, it's being smart about it.


⭐ RETURN ⭐

returns a pointer to struct tb_path ✨

and if things go sideways? NULL in case of failure πŸ’€ not a crash, not a vibe, just NULL. check for it, bestie. always check for it. πŸ™


πŸ¦‹ SEE ALSO πŸ¦‹


ngl, if you're allocating paths you should fr fr also know how to free them. tb_path_free(9) is right there in SEE ALSO for a reason 🫢

and that's the page, bestie πŸ’… source and version: it's from ./drivers/thunderbolt, and the date on it is October 2026 β€” so yeah, it's a little from the future, but it ate and left no crumbs πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from