STRUCT VIRTIO_CHAN(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 as struct 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:


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