---
name: "vscsi"
section: "4"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["openbsd"]
url: "https://new.carta.tech/vscsi"
---

# vscsi(4)

virtual SCSI controller

## 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

The **vscsi** device 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.

The following [ioctl(2)](/ioctl/2.md) 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)](/ioctl/2.md) will fail and set *errno* to EAGAIN.

  When one or more SCSI commands are available to dequeue, [select(2)](/select/2.md) 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 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 \**

  - 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

  ## SEE ALSO

[ioctl(2)](/ioctl/2.md), [intro(4)](/intro/4.md), [scsi(4)](/scsi/4.md)

## HISTORY

The **vscsi** driver first appeared in OpenBSD 4.5.

## AUTHORS

David Gwynne ⟨*dlg@openbsd.org*⟩.
