1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
'\" 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]
.TH SCSI_VALIDATE_SENSE 9F "April 9, 2016"
.SH NAME
scsi_validate_sense \- find descriptor in SCSI sense data
.SH SYNOPSIS
.nf
#include <sys/scsi/scsi.h>
\fBint\fR \fBscsi_validate_sense\fR(\fBuint8_t *\fR\fIsense_buffer\fR, \fBint\fR \fIsense_buf_len\fR,
\fBint *\fR\fIflags\fR);
.fi
.SH INTERFACE LEVEL
illumos DDI specific (illumos DDI).
.SH PARAMETERS
.ne 2
.na
\fB\fIsense_buffer\fR\fR
.ad
.RS 17n
Pointer to a buffer containing \fBSCSI\fR sense data. The sense data is
expected in wire format starting at the response code.
.RE
.sp
.ne 2
.na
\fB\fIsense_buf_len\fR\fR
.ad
.RS 17n
Length of sense buffer in bytes.
.RE
.sp
.ne 2
.na
\fB\fIflags\fR\fR
.ad
.RS 17n
Returns additional properties of the sense data.
.RE
.SH DESCRIPTION
The \fBscsi_validate_sense()\fR function returns the format of the sense data
contained in the provided sense buffer. If the response code field in the sense
data is not recognized or if there is not enough sense data to include sense
key, asc, and ascq then \fBscsi_validate_sense()\fR returns
\fBSENSE_UNUSABLE\fR. If the buffer contains usable sense data in fixed format,
the function returns \fBSENSE_FIXED_FORMAT\fR. If the buffer contains usable
sense data in descriptor format, the function returns \fBSENSE_DESCR_FORMAT\fR.
.sp
.LP
The following flags may be set as appropriate depending on the sense data:
.sp
.ne 2
.na
\fB\fBSNS_BUF_OVERFLOW\fR\fR
.ad
.RS 20n
The sense data buffer provided for the request is too small to hold all the
sense data.
.RE
.sp
.ne 2
.na
\fB\fBSNS_BUF_DEFERRED\fR\fR
.ad
.RS 20n
The sense data contained in the buffer relates to an error that has occurred
during the processing of a successfully completed command, such as a cached
write that could not be committed to the media.
.RE
.SH RETURN VALUES
.ne 2
.na
\fB\fBSENSE_UNUSABLE\fR\fR
.ad
.RS 22n
The response code from the sense data is unrecognized or not enough sense data
present to provide the \fBsense key\fR, \fBasc\fR, and \fBascq\fR.
.RE
.sp
.ne 2
.na
\fB\fBSENSE_FIXED_FORMAT\fR\fR
.ad
.RS 22n
The sense data in the buffer is in "fixed format".
.RE
.sp
.ne 2
.na
\fB\fBSENSE_DESCR_FORMAT\fR\fR
.ad
.RS 22n
The sense data in the buffer is in "descriptor format".
.RE
.SH CONTEXT
The \fBscsi_validate_sense()\fR function can be called from user or interrupt
context.
.SH SEE ALSO
.BR scsi_ext_sense_fields (9F),
.BR scsi_find_sense_descr (9F),
.BR scsi_sense_asc (9F),
.BR scsi_sense_ascq (9F),
.BR scsi_sense_cmdspecific_uint64 (9F),
.BR scsi_sense_info_uint64 (9F),
.BR scsi_sense_key (9F)
|