STRUCT VIRTIO_CHAN(9)
π struct virtio_chan(9) π
okay so bestie, welcome to the struct virtio_chan page from the Kernel API Manual β yes we're in the kernel docs now, put your hair up, we're going in π
β¨ NAME β¨
struct virtio_chan β literally just the per-instance transport info, that's it, that's the whole vibe π¦
πΈ SYNOPSIS πΈ
here's the whole thing, copy it exactly please, no typos, we do not freelance struct definitions in this house π
struct virtio_chan {
bool inuse;
spinlock_t lock;
struct p9_client *client;
struct virtio_device *vdev;
struct virtqueue *vq;
int ring_bufs_avail;
wait_queue_head_t *vc_wq;
unsigned long p9_max_pages;
struct scatterlist sg[VIRTQUEUE_NUM];
char *tag;
struct list_head chan_list;
};
π§ Members π§
okay breaking it down field by field, iykyk π
inuseβ tells you whether this channel is in use or not. main character boolean fr.lockβ the lock that protects multiple elements within this structure. she's the bodyguard of the struct πclientβ the client instance.vdevβ the virtio dev associated with this channel.vqβ the virtio queue associated with this channel.ring_bufs_availβ a flag saying there's some space available in the ring buf. little signal, big job β¨vc_wqβ the wait queue for waiting for a thing to be added to the ring buf. she waits πp9_max_pagesβ the maximum number of pinned pages.sgβ the scatter gather list used to pack a request (protected? β¦yeah the manpage literally asks that, question mark and all, we don't know either π). it's declared asstruct scatterlist sg[VIRTQUEUE_NUM];π«Άtagβ the name that identifies a mount, null terminated.chan_listβ the linked list of channels. group chat energy, she's on the list π
π₯ Description π₯
so the whole point: we keep all per-channel information in this one structure. where does it live? it gets allocated within the device's dev->mem space. and a pointer to this structure gets put in the transport private. that's it, that's the lore π¦
ngl that's the entire description, no cap, the manpage is short and we respect her for it.
π SEE ALSO π
the kernel file ./net/9p/trans_virtio.c and all her friends, linking out like:
p9_virtio_close(9)req_done(9)pack_sg_list(9)pack_sg_list_p(9)p9_virtio_request(9)p9_virtio_zc_request(9)p9_virtio_probe(9)p9_virtio_create(9)p9_virtio_remove(9)
and that's the page!! this one comes from ./net/9p and it's dated October 2026 β shoutout to the source and the date, iconic of them, 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