STRUCT TBSTREAM_DEV(9)
π struct tbstream_dev(9) β the Kernel API Manual, bestie edition
okay so this one lives in the kernel API manual and it's literally all about struct tbstream_dev, aka the stream character device. yes bestie, the character device that does the tunneling. let's get into it π
β¨ NAME β¨
struct tbstream_dev β Stream character device. that's it, that's the vibe. π¦
πΈ SYNOPSIS πΈ
here's the whole struct, character for character, no cap:
struct tbstream_dev {
struct config_group group;
struct tbstream *stream;
struct miscdevice misc;
struct kref kref;
int index;
int in_hopid;
int out_hopid;
unsigned int ring_size;
unsigned int throttling;
bool busy_poll;
int users;
bool closed;
bool removed;
wait_queue_head_t wait;
struct mutex lock;
struct tbstream_ring tx_ring;
struct tbstream_ring rx_ring;
struct list_head list;
};
yes there are two whole rings, we stan π
π Members π
lowkey the most important part, so let's go member by member, no skipping, fr fr β¨
groupβ the ConfigFS group for this device. it's giving organizational queen πstreamβ pointer to the stream if it's attached, andNULLotherwise. so check it before you dereference it, bestie, i'm begging πmiscβ the character device used for tunneling. main character energy, honestlykrefβ the reference count. keep it balanced or things get ugly πindexβ a unique identifier for the character device. every device needs its own little name tag πin_hopidβ the In HopIDout_hopidβ the Out HopID. in and out, balanced, iconic πring_sizeβ the size of the ringsthrottlingβ interrupt throttling rate in ns. yes, nanoseconds, we're precise here βbusy_pollβ instead of interrupts, busy poll the rings. different strategy, same energy π₯usersβ number of times cdev has been openedclosedβ set when a CLOSE packet was receivedremovedβ userspace removed the ConfigFS group underneath. rude but okay πwaitβ waitqueue for open, read and write. it's where everyone waits their turn π«Άlockβ the lock protecting this structure. do not skip the lock, i'm serious πtx_ringβ transmit ringrx_ringβ receive ringlistβ stream devices are linked through this. friendship bracelet behavior, honestly π
π§ SEE ALSO π§
go read these next, iykyk:
- Kernel file
./drivers/thunderbolt/stream.c enum tbstream_frame_pdf(9)struct tbstream_frame(9)struct tbstream_ring(9)struct tbstream_group(9)struct tbstream(9)
ok that's the whole page, no gatekeeping π go forth and tunnel responsibly, bestie. and remember:streamcan beNULL, take thelock, and check that kref π«Ά
and that's a wrap! this iconic little doc comes from ./drivers/thunderbolt in the Kernel API Manual, dated October 2026. slay, periodt, bye! πΈβ¨π
π¦ 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