open-isns: Fix warnings reported by gcc-4.5.2
[open-iscsi.git] / usr / scsi.h
blobd8ef951d943e3a806df5994e5b56af965e0d3865
1 /*
2 * this is from the linux kernel scsi_eh.h
3 */
4 #ifndef _SCSI_SCSI_H
5 #define _SCSI_SCSI_H
7 #include <stdint.h>
9 /*
10 * This is a slightly modified SCSI sense "descriptor" format header.
11 * The addition is to allow the 0x70 and 0x71 response codes. The idea
12 * is to place the salient data from either "fixed" or "descriptor" sense
13 * format into one structure to ease application processing.
15 * The original sense buffer should be kept around for those cases
16 * in which more information is required (e.g. the LBA of a MEDIUM ERROR).
18 struct scsi_sense_hdr { /* See SPC-3 section 4.5 */
19 uint8_t response_code; /* permit: 0x0, 0x70, 0x71, 0x72, 0x73 */
20 uint8_t sense_key;
21 uint8_t asc;
22 uint8_t ascq;
23 uint8_t byte4;
24 uint8_t byte5;
25 uint8_t byte6;
26 uint8_t additional_length; /* always 0 for fixed sense format */
29 static inline int scsi_sense_valid(struct scsi_sense_hdr *sshdr)
31 if (!sshdr)
32 return 0;
34 return (sshdr->response_code & 0x70) == 0x70;
37 extern int scsi_normalize_sense(const uint8_t *sense_buffer, int sb_len,
38 struct scsi_sense_hdr *sshdr);
40 #endif