2 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH SCSI_CNAME 9F "Jan 16, 2006"
8 scsi_cname, scsi_dname, scsi_mname, scsi_rname, scsi_sname \- decode a SCSI
13 #include <sys/scsi/scsi.h>
17 \fBchar *\fR\fBscsi_cname\fR(\fBuchar_t\fR \fIcmd\fR, \fBchar **\fR\fIcmdvec\fR);
22 \fBchar *\fR\fBscsi_dname\fR(\fBint\fR \fIdtype\fR);
27 \fBchar *\fR\fBscsi_mname\fR(\fBuchar_t\fR \fImsg\fR);
32 \fBchar *\fR\fBscsi_rname\fR(\fBuchar_t\fR \fIreason\fR);
37 \fBchar *\fR\fBscsi_sname\fR(\fBuchar_t\fR \fIsense_key\fR);
43 Solaris DDI specific (Solaris DDI).
51 A \fBSCSI\fR command value.
60 Pointer to an array of command strings.
87 A packet reason value.
96 A \fBSCSI\fR sense key value.
102 The \fBscsi_cname()\fR function decodes \fBSCSI\fR commands. \fIcmdvec\fR is a
103 pointer to an array of strings. The first byte of the string is the command
104 value, and the remainder is the name of the command.
107 The \fBscsi_dname()\fR function decodes the peripheral device type (for
108 example, direct access or sequential access) in the inquiry data.
111 The \fBscsi_mname()\fR function decodes \fBSCSI \fRmessages.
114 The \fBscsi_rname()\fR function decodes packet completion reasons.
117 The \fBscsi_sname()\fR function decodes \fBSCSI\fR sense keys.
121 These functions return a pointer to a string. If an argument is invalid, they
122 return a string to that effect.
126 These functions can be called from user, interrupt, or kernel context.
129 \fBExample 1 \fRDecoding SCSI tape commands.
132 The \fBscsi_cname()\fR function decodes \fBSCSI \fRtape commands as follows:
137 static char *st_cmds[] = {
138 "\e000test unit ready",
140 "\e003request sense",
143 "\e020write file mark",
153 cmn_err(CE_CONT, "st: cmd=%s", scsi_cname(cmd, st_cmds));
160 \fIWriting Device Drivers\fR