VSCSI(4)

πŸ“¦ in nixpkgs unstable

okay bestie, welcome to VSCSI(4) from the Kernel Interfaces Manual β€” it's giving virtual SCSI controller realness and I'm literally obsessed πŸ’…βœ¨

πŸŽ€ NAME πŸŽ€

vscsi β€” virtual SCSI controller πŸ¦‹

✨ SYNOPSIS ✨

vscsi0 at root

#include <sys/types.h>
#include <sys/ioctl.h>
#include <scsi/scsi_all.h>
#include <dev/vscsivar.h>

πŸ’– DESCRIPTION πŸ’–

okay so the vscsi device is the middle bestie between the kernel SCSI midlayer and userland: it takes commands from the kernel SCSI midlayer and makes them available to userland for handling. Using this interface it is possible to implement virtual SCSI devices that are usable by the kernel. no cap.

These ioctl(2) commands are how userland dequeues SCSI commands and replies to them:

  • VSCSI_I2T struct vscsi_ioc_i2t * β€” dequeue a SCSI command. If no SCSI commands are available to dequeue, ioctl(2) will fail and set errno to EAGAIN.

When one or more SCSI commands are available to dequeue, select(2) will indicate the descriptor as ready to read.

                     struct vscsi_ioc_i2t {
                             int                     tag;

                             u_int                   target;
                             u_int                   lun;

                             struct scsi_generic     cmd;
                             size_t                  cmdlen;

                             size_t                  datalen;
                             int                     direction;
                     #define VSCSI_DIR_NONE          0
                     #define VSCSI_DIR_READ          1
                     #define VSCSI_DIR_WRITE         2
                     };
  • VSCSI_DATA_READ struct vscsi_ioc_data * and VSCSI_DATA_WRITE struct vscsi_ioc_data * β€” read or write data in response to a SCSI command identified by tag.
                     struct vscsi_ioc_data {
                             int                     tag;

                             void *                  data;
                             size_t                  datalen;
                     };
  • VSCSI_T2I struct vscsi_ioc_t2i * β€” signal completion of a SCSI command identified by tag.
                     struct vscsi_ioc_t2i {
                             int                     tag;

                             int                     status;
                     #define VSCSI_STAT_DONE         0
                     #define VSCSI_STAT_SENSE        1
                     #define VSCSI_STAT_RESET        2
                     #define VSCSI_STAT_ERR          3
                             struct scsi_sense_data  sense;
                     };
  • VSCSI_REQPROBE struct vscsi_ioc_devevent * and VSCSI_REQDETACH struct vscsi_ioc_devevent * β€” request a probe or a detach of the device at the addresses specified by the target and lun fields.
                     struct vscsi_ioc_devevent {
                             u_int                   target;
                             u_int                   lun;
                     };

πŸ—‚οΈ FILES πŸ—‚οΈ

  • /dev/vscsi0 β€” the path, right there, periodt πŸ’…

πŸ‘€ SEE ALSO πŸ‘€

go read these too bestie: ioctl(2), intro(4), scsi(4) β€” all iconic, fr fr.

🌸 HISTORY 🌸

The vscsi driver first appeared in OpenBSD 4.5 ✨

πŸ’œ AUTHORS πŸ’œ

David Gwynne <dlg@openbsd.org>. ty king 🫢


mwah πŸ’– this page is from the Debian edition, dated September 12, 2017, and it's literally the VSCSI(4) manual β€” bye bestie πŸŽ€

πŸ“¦ where this page comes from
  • nixpkgs unstable: cvs-export
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms