xref: /openbsd-src/share/man/man4/vscsi.4 (revision a28daedfc357b214be5c701aa8ba8adb29a7f1c2)
1.\"	$OpenBSD: vscsi.4,v 1.3 2008/12/04 06:29:21 jmc Exp $
2.\"
3.\" Copyright (c) 2008 David Gwynne <dlg@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: December 4 2008 $
18.Dt VSCSI 4
19.Os
20.Sh NAME
21.Nm vscsi
22.Nd Virtual SCSI controller
23.Sh SYNOPSIS
24.Cd "vscsi0 at root"
25.Cd "scsibus* at vscsi?"
26.Pp
27.Fd #include <sys/types.h>
28.Fd #include <sys/ioctl.h>
29.Fd #include <sys/scsi/scsi_all.h>
30.Fd #include <sys/dev/vscsivar.h>
31.Sh DESCRIPTION
32The
33.Nm
34device takes commands from the kernel SCSI midlayer and makes them available
35to userland for handling.
36Using this interface it is possible to implement virtual SCSI devices that are
37usable by the kernel.
38.Pp
39The following
40.Xr ioctl 2
41commands are provided to allow userland to dequeue SCSI commands and reply to
42them:
43.Pp
44.Bl -tag -width Ds -compact
45.It VSCSI_I2T (struct vscsi_ioc_i2t *)
46Dequeue a SCSI command.
47.Bd -literal -offset indent
48struct vscsi_ioc_i2t {
49	int			tag;
50
51	u_int			target;
52	u_int			lun;
53
54	struct scsi_generic	cmd;
55	size_t			cmdlen;
56
57	size_t			datalen;
58	int			direction;
59#define VSCSI_DIR_NONE		0
60#define VSCSI_DIR_READ		1
61#define VSCSI_DIR_WRITE		2
62};
63.Ed
64.Pp
65.It VSCSI_DATA_READ (struct vscsi_ioc_data *)
66.It VSCSI_DATA_WRITE (struct vscsi_ioc_data *)
67Read or write data in response to a SCSI command identified by tag.
68.Bd -literal -offset indent
69struct vscsi_ioc_data {
70	int			tag;
71
72	void *			data;
73	size_t			datalen;
74};
75.Ed
76.Pp
77.It VSCSI_T2I (struct vscsi_ioc_t2i *)
78Signal completion of a SCSI command identified by tag.
79.Bd -literal -offset indent
80struct vscsi_ioc_t2i {
81	int			tag;
82
83	int			status;
84#define VSCSI_STAT_DONE		0
85#define VSCSI_STAT_SENSE	1
86#define VSCSI_STAT_ERR		2
87	struct scsi_sense_data	sense;
88	size_t			senselen;
89};
90.Ed
91.El
92.Sh FILES
93.Bl -tag -width /dev/vscsi0
94.It /dev/vscsi0
95.El
96.Sh SEE ALSO
97.Xr ioctl 2 ,
98.Xr intro 4 ,
99.Xr scsi 4 ,
100.Xr MAKEDEV 8
101.Sh HISTORY
102The
103.Nm
104driver first appeared in
105.Ox 4.5 .
106.Sh AUTHORS
107.An David Gwynne Aq dlg@openbsd.org .
108