• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef SG_LIB_DATA_H
2 #define SG_LIB_DATA_H
3 
4 /*
5  * Copyright (c) 2007-2018 Douglas Gilbert.
6  * All rights reserved.
7  * Use of this source code is governed by a BSD-style
8  * license that can be found in the BSD_LICENSE file.
9  */
10 
11 /*
12  * This header file contains some structure declarations and array name
13  * declarations which are defined in the sg_lib_data.c .
14  * Typically this header does not need to be exposed to users of the
15  * sg_lib interface declared in sg_libs.h .
16  */
17 
18 #include <stdint.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /* Operation codes with associated service actions that change or qualify
25  * the command name */
26 #define SG_EXTENDED_COPY 0x83 /* since spc4r34 became next entry */
27 #define SG_3PARTY_COPY_OUT 0x83 /* new in spc4r34: Third party copy out */
28 #define SG_RECEIVE_COPY 0x84  /* since spc4r34 became next entry */
29 #define SG_3PARTY_COPY_IN 0x84 /* new in spc4r34: Third party copy in */
30 #define SG_MAINTENANCE_IN 0xa3
31 #define SG_MAINTENANCE_OUT 0xa4
32 #define SG_PERSISTENT_RESERVE_IN 0x5e
33 #define SG_PERSISTENT_RESERVE_OUT 0x5f
34 #define SG_READ_ATTRIBUTE 0x8c
35 #define SG_READ_BUFFER 0x3c     /* now READ BUFFER(10) */
36 #define SG_READ_BUFFER_16 0x9b
37 #define SG_READ_POSITION 0x34   /* SSC command with service actions */
38 #define SG_SANITIZE 0x48
39 #define SG_SERVICE_ACTION_BIDI 0x9d
40 #define SG_SERVICE_ACTION_IN_12 0xab
41 #define SG_SERVICE_ACTION_IN_16 0x9e
42 #define SG_SERVICE_ACTION_OUT_12 0xa9
43 #define SG_SERVICE_ACTION_OUT_16 0x9f
44 #define SG_VARIABLE_LENGTH_CMD 0x7f
45 #define SG_WRITE_BUFFER 0x3b
46 #define SG_ZONING_OUT 0x94
47 #define SG_ZONING_IN 0x95
48 
49 
50 
51 struct sg_lib_simple_value_name_t {
52     int value;
53     const char * name;
54 };
55 
56 struct sg_lib_value_name_t {
57     int value;
58     int peri_dev_type; /* 0 -> SPC and/or PDT_DISK, >0 -> PDT */
59     const char * name;
60 };
61 
62 struct sg_lib_asc_ascq_t {
63     unsigned char asc;          /* additional sense code */
64     unsigned char ascq;         /* additional sense code qualifier */
65     const char * text;
66 };
67 
68 struct sg_lib_asc_ascq_range_t {
69     unsigned char asc;  /* additional sense code (ASC) */
70     unsigned char ascq_min;     /* ASCQ minimum in range */
71     unsigned char ascq_max;     /* ASCQ maximum in range */
72     const char * text;
73 };
74 
75 /* First use: SCSI status, sense_key, asc, ascq tuple */
76 struct sg_lib_4tuple_u8 {
77     uint8_t t1;
78     uint8_t t2;
79     uint8_t t3;
80     uint8_t t4;
81 };
82 
83 
84 extern const char * sg_lib_version_str;
85 
86 extern struct sg_lib_value_name_t sg_lib_normal_opcodes[];
87 extern struct sg_lib_value_name_t sg_lib_read_buff_arr[];
88 extern struct sg_lib_value_name_t sg_lib_write_buff_arr[];
89 extern struct sg_lib_value_name_t sg_lib_maint_in_arr[];
90 extern struct sg_lib_value_name_t sg_lib_maint_out_arr[];
91 extern struct sg_lib_value_name_t sg_lib_pr_in_arr[];
92 extern struct sg_lib_value_name_t sg_lib_pr_out_arr[];
93 extern struct sg_lib_value_name_t sg_lib_sanitize_sa_arr[];
94 extern struct sg_lib_value_name_t sg_lib_serv_in12_arr[];
95 extern struct sg_lib_value_name_t sg_lib_serv_out12_arr[];
96 extern struct sg_lib_value_name_t sg_lib_serv_in16_arr[];
97 extern struct sg_lib_value_name_t sg_lib_serv_out16_arr[];
98 extern struct sg_lib_value_name_t sg_lib_serv_bidi_arr[];
99 extern struct sg_lib_value_name_t sg_lib_xcopy_sa_arr[];
100 extern struct sg_lib_value_name_t sg_lib_rec_copy_sa_arr[];
101 extern struct sg_lib_value_name_t sg_lib_variable_length_arr[];
102 extern struct sg_lib_value_name_t sg_lib_zoning_out_arr[];
103 extern struct sg_lib_value_name_t sg_lib_zoning_in_arr[];
104 extern struct sg_lib_value_name_t sg_lib_read_attr_arr[];
105 extern struct sg_lib_value_name_t sg_lib_read_pos_arr[];
106 extern struct sg_lib_asc_ascq_range_t sg_lib_asc_ascq_range[];
107 extern struct sg_lib_asc_ascq_t sg_lib_asc_ascq[];
108 extern struct sg_lib_value_name_t sg_lib_scsi_feature_sets[];
109 extern const char * sg_lib_sense_key_desc[];
110 extern const char * sg_lib_pdt_strs[];
111 extern const char * sg_lib_transport_proto_strs[];
112 extern int sg_lib_pdt_decay_arr[];
113 
114 extern struct sg_lib_value_name_t sg_lib_nvme_cmd_status_arr[];
115 extern struct sg_lib_4tuple_u8 sg_lib_scsi_status_sense_arr[];
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif
122