2 .\" Nate Lawson. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Neither the name of the author nor the names of any co-contributors
10 .\" may be used to endorse or promote products derived from this software
11 .\" without specific prior written permission.
13 .\" THIS SOFTWARE IS PROVIDED BY Nate Lawson AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" $FreeBSD: src/share/man/man4/targ.4,v 1.3.2.1 2003/02/18 22:07:11 njl Exp $
26 .\" $DragonFly: src/share/man/man4/targ.4,v 1.6 2008/07/09 16:23:55 thomas Exp $
33 .Nd SCSI target emulator driver
39 driver provides an interface for usermode programs to emulate SCSI target
41 A sample program that emulates a disk drive (similar to
44 .Pa /usr/share/examples/scsi_target .
48 driver supplies control devices,
52 If a device is already in use,
58 After opening the device, the file descriptor must be bound to a
59 specific bus/target/LUN and enabled to process CCBs using the
64 to send CCBs to the SIM and
68 to see if responses are ready.
69 Pointers to completed CCBs are returned via
71 Any data transfers requested by the user CCBs are done via zero-copy IO.
75 calls are defined in the header file
76 .In bus/cam/scsi/scsi_targetio.h .
77 .Bl -tag -width ".Dv TARGIOCDISABLE"
79 .Pq Vt "struct ioc_enable_lun"
80 Enable target mode on the LUN specified by the following structure:
81 .Bd -literal -offset indent
82 struct ioc_enable_lun {
84 target_id_t target_id;
91 The selected path (bus), target, and LUN must not already be in use or
98 are non-zero, reception of vendor-specific commands
100 .It Dv TARGIOCDISABLE
101 Disable target mode and abort all pending CCBs.
102 The CCBs may optionally be read as they complete.
104 can then be called to activate a different LUN.
105 Multiple disable calls have no effect.
108 system call automatically disables target mode if enabled.
113 debugging if the argument is non-zero, otherwise disables
117 .Bl -tag -width ".Pa /sys/bus/cam/scsi/scsi_target.c" -compact
118 .It In bus/cam/scsi/scsi_targetio.h
119 describes the usermode interface.
120 .It Pa /sys/bus/cam/scsi/scsi_target.c
121 is the driver source file.
123 are the control devices.
126 .Pa /usr/share/examples/scsi_target ,
131 .%T "FreeBSD Target Information"
132 .%O http://www.root.org/~nate/freebsd/
138 driver first appeared in
141 .An Justin T. Gibbs .
146 .An Nate Lawson Aq nate@root.org .
152 drivers fully support target mode.
156 driver does not support tagged queuing in target mode.