xref: /titanic_44/usr/src/man/man9f/scsi_cname.9f (revision 1410cb930a3e26032c59c6835837a28c47366b3c)
te
Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
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.
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.
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]
SCSI_CNAME 9F "Jan 16, 2006"
NAME
scsi_cname, scsi_dname, scsi_mname, scsi_rname, scsi_sname - decode a SCSI name
SYNOPSIS

#include <sys/scsi/scsi.h>



char *scsi_cname(uchar_t cmd, char **cmdvec);

char *scsi_dname(int dtype);

char *scsi_mname(uchar_t msg);

char *scsi_rname(uchar_t reason);

char *scsi_sname(uchar_t sense_key);
INTERFACE LEVEL

Solaris DDI specific (Solaris DDI).

PARAMETERS
cmd

A SCSI command value.

cmdvec

Pointer to an array of command strings.

dtype

Device type.

msg

A message value.

reason

A packet reason value.

sense_key

A SCSI sense key value.

DESCRIPTION

The scsi_cname() function decodes SCSI commands. cmdvec is a pointer to an array of strings. The first byte of the string is the command value, and the remainder is the name of the command.

The scsi_dname() function decodes the peripheral device type (for example, direct access or sequential access) in the inquiry data.

The scsi_mname() function decodes SCSI messages.

The scsi_rname() function decodes packet completion reasons.

The scsi_sname() function decodes SCSI sense keys.

RETURN VALUES

These functions return a pointer to a string. If an argument is invalid, they return a string to that effect.

CONTEXT

These functions can be called from user, interrupt, or kernel context.

EXAMPLES

Example 1 Decoding SCSI tape commands.

The scsi_cname() function decodes SCSI tape commands as follows:

static char *st_cmds[] = {
 "\e000test unit ready",
 "\e001rewind", 
 "\e003request sense",
 "\e010read",
 "\e012write",
 "\e020write file mark",
 "\e021space",
 "\e022inquiry",
 "\e025mode select",
 "\e031erase tape",
 "\e032mode sense",
 "\e033load tape",
 NULL
 };
 ..
 cmn_err(CE_CONT, "st: cmd=%s", scsi_cname(cmd, st_cmds));
SEE ALSO

Writing Device Drivers