STRUCT TB_SERVICE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

struct tb_service β€” the Thunderbolt service struct, bestie ✨

okay so real quick, this page is straight out of the Kernel API Manual and it's all about struct tb_service in <pink>struct tb_service(9)</pink> β€” like the little baby struct that represents one Thunderbolt service πŸ¦‹ iykyk


✨ SYNOPSIS ✨

okay don't panic, here's the whole thing, typed out exactly, no cap:

struct tb_service {
    struct device dev;
    int id;
    const char *key;
    u32 prtcid;
    u32 prtcvers;
    u32 prtcrevs;
    u32 prtcstns;
    struct mutex lock;
    struct tb_property_dir *local_properties;
    struct tb_property_dir *remote_properties;
    struct dentry *debugfs_dir;
 };

like, that's the whole vibe check right there πŸ‘‘


🌸 Members 🌸

okay so now we go through every single field one by one because we do NOT skip ✨

  • dev β€” the XDomain device πŸ’…
  • id β€” the ID of the service, and yes bestie it's shown in sysfs 🫢
  • key β€” the protocol key, grabbed from the properties directory πŸ”‘
  • prtcid β€” the protocol ID, from the properties directory ✨
  • prtcvers β€” the protocol version, from the properties directory πŸ“–
  • prtcrevs β€” the protocol software revision, from the properties directory πŸ”
  • prtcstns β€” the protocol settings mask, from the properties directory πŸŽ€
  • lock β€” protects this structure, like a little bodyguard for the struct πŸ’€
  • local_properties β€” properties owned by the service driver 🏠
  • remote_properties β€” properties read from the remote service, and these are read-only, so don't even think about writing to them πŸ™ˆ
  • debugfs_dir β€” pointer to the service debugfs directory. it's always created when debugfs is enabled, and service drivers can use it to add their own entries under the service πŸ¦‹

πŸ’œ Description πŸ’œ

so basically, each domain exposes a set of services it supports as a collection of properties 🌈 and for each service there's gonna be one corresponding struct tb_service. the service drivers get bound to these, that's just how it goes ✨

now, service drivers can add their own dynamic properties to local_properties β€” slay, go off β€” but whenever they do so, lock must be held. fr fr, held. every time 🫢 not optional, not negotiable πŸ’…

bestie listen: the lock thing is not a suggestion, ok? if you're touching local_properties you're holding lock. periodt πŸ’€

πŸŽ€ SEE ALSO πŸŽ€

  • Kernel file ./include/linux/thunderbolt.h β€” go read it, it's giving main character energy πŸ‘‘
  • enum tb_security_level(9)
  • struct tb(9)
  • struct tb_property_dir(9)
  • struct tb_property(9)
  • enum tb_link_width(9)
  • struct tb_xdomain(9)
  • struct tb_protocol_handler(9)
  • struct tb_service_driver(9)
  • struct tb_nhi(9)
  • struct tb_ring(9)
  • enum ring_desc_flags(9)
  • struct ring_frame(9)
  • tb_ring_rx(9)
  • tb_ring_tx(9)
  • tb_ring_dma_device(9)

like, that's a whole friend group of references, and they all ate πŸ’…βœ¨


and that's the page, bestie 🫢 it lives in ./include/linux, it's tagged October 2026, and if you ever forget what page you're on just remember: struct tb_service(9) πŸ’– mwah, go hold that lock πŸ’œ

πŸ“¦ where this page comes from