SCSI_CNAME(9F) Kernel Functions for Drivers SCSI_CNAME(9F)

scsi_cname, scsi_dname, scsi_mname, scsi_rname, scsi_sname - decode a SCSI name

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

illumos DDI specific (illumos DDI).

A SCSI command value.


Pointer to an array of command strings.


Device type.


A message value.


A packet reason value.


A SCSI sense key value.

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.

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

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

Example 1 Decoding SCSI tape commands.

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

static char *st_cmds[] = {
            "\000test unit ready",
            "\003request sense",
            "\020write file mark",
            "\025mode select",
            "\031erase tape",
            "\032mode sense",
            "\033load tape",
    cmn_err(CE_CONT, "st: cmd=%s", scsi_cname(cmd, st_cmds));

Writing Device Drivers
January 16, 2006 OmniOS