Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OpenBSD-5.7)
Apropos / Subsearch:
optional field

VSCSI(4)                 BSD Kernel Interfaces Manual                 VSCSI(4)

     vscsi -- virtual SCSI controller

     vscsi0 at root

     #include <&lt;sys/types.h>&gt;
     #include <&lt;sys/ioctl.h>&gt;
     #include <&lt;scsi/scsi_all.h>&gt;
     #include <&lt;dev/vscsivar.h>&gt;

     The vscsi device takes commands from the kernel SCSI midlayer and makes
     them available to userland for handling.  Using this interface it is pos-
     sible to implement virtual SCSI devices that are usable by the kernel.

     The following ioctl(2) commands are provided to allow userland to dequeue
     SCSI commands and reply 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 *
     VSCSI_DATA_WRITE struct vscsi_ioc_data *
             Read or write data in response to a SCSI command identified by

                   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 *
     VSCSI_REQDETACH struct vscsi_ioc_devevent *
             Request a probe or a detach of the device at the addresses speci-
             fied by the target and lun fields.

                   struct vscsi_ioc_devevent {
                           u_int                   target;
                           u_int                   lun;


     ioctl(2), intro(4), scsi(4)

     The vscsi driver first appeared in OpenBSD 4.5.

     David Gwynne <dlg@openbsd.org>.

BSD                              June 28, 2014                             BSD