1scsi_cname(9F) Kernel Functions for Drivers scsi_cname(9F)
2
3
4
6 scsi_cname, scsi_dname, scsi_mname, scsi_rname, scsi_sname - decode a
7 SCSI name
8
10 #include <sys/scsi/scsi.h>
11
12
13
14 char *scsi_cname(uchar_t cmd, char **cmdvec);
15
16
17 char *scsi_dname(int dtype);
18
19
20 char *scsi_mname(uchar_t msg);
21
22
23 char *scsi_rname(uchar_t reason);
24
25
26 char *scsi_sname(uchar_t sense_key);
27
28
30 Solaris DDI specific (Solaris DDI).
31
33 cmd A SCSI command value.
34
35
36 cmdvec Pointer to an array of command strings.
37
38
39 dtype Device type.
40
41
42 msg A message value.
43
44
45 reason A packet reason value.
46
47
48 sense_key A SCSI sense key value.
49
50
52 The scsi_cname() function decodes SCSI commands. cmdvec is a pointer to
53 an array of strings. The first byte of the string is the command value,
54 and the remainder is the name of the command.
55
56
57 The scsi_dname() function decodes the peripheral device type (for exam‐
58 ple, direct access or sequential access) in the inquiry data.
59
60
61 The scsi_mname() function decodes SCSI messages.
62
63
64 The scsi_rname() function decodes packet completion reasons.
65
66
67 The scsi_sname() function decodes SCSI sense keys.
68
70 These functions return a pointer to a string. If an argument is
71 invalid, they return a string to that effect.
72
74 These functions can be called from user, interrupt, or kernel context.
75
77 Example 1 Decoding SCSI tape commands.
78
79
80 The scsi_cname() function decodes SCSI tape commands as follows:
81
82
83 static char *st_cmds[] = {
84 "\000test unit ready",
85 "\001rewind",
86 "\003request sense",
87 "\010read",
88 "\012write",
89 "\020write file mark",
90 "\021space",
91 "\022inquiry",
92 "\025mode select",
93 "\031erase tape",
94 "\032mode sense",
95 "\033load tape",
96 NULL
97 };
98 ..
99 cmn_err(CE_CONT, "st: cmd=%s", scsi_cname(cmd, st_cmds));
100
101
103 Writing Device Drivers
104
105
106
107SunOS 5.11 16 Jan 2006 scsi_cname(9F)