multipath-tools: replace leading spaces with tabs II
[multipath-tools/.git] / libmultipath / checkers / cciss.h
1 #ifndef CCISS_H
2 #define CCISS_H
3
4 #include <linux/types.h>
5 #include <linux/ioctl.h>
6
7 #define CCISS_IOC_MAGIC 'B'
8
9 /*
10  * transfer direction
11  */
12 #define XFER_NONE               0x00
13 #define XFER_WRITE              0x01
14 #define XFER_READ               0x02
15 #define XFER_RSVD               0x03
16
17 /*
18  * task attribute
19  */
20 #define ATTR_UNTAGGED           0x00
21 #define ATTR_SIMPLE             0x04
22 #define ATTR_HEADOFQUEUE        0x05
23 #define ATTR_ORDERED            0x06
24 #define ATTR_ACA                0x07
25
26 /*
27  * cdb type
28  */
29 #define TYPE_CMD                0x00
30 #define TYPE_MSG                0x01
31
32 #define SENSEINFOBYTES          32
33
34 /*
35  * Type defs used in the following structs
36  */
37 #define BYTE __u8
38 #define WORD __u16
39 #define HWORD __u16
40 #define DWORD __u32
41
42 #pragma pack(1)
43
44 //Command List Structure
45 typedef union _SCSI3Addr_struct {
46         struct {
47                 BYTE Dev;
48                 BYTE Bus:6;
49                 BYTE Mode:2;        // b00
50         } PeripDev;
51         struct {
52                 BYTE DevLSB;
53                 BYTE DevMSB:6;
54                 BYTE Mode:2;        // b01
55         } LogDev;
56         struct {
57                 BYTE Dev:5;
58                 BYTE Bus:3;
59                 BYTE Targ:6;
60                 BYTE Mode:2;        // b10
61         } LogUnit;
62 } SCSI3Addr_struct;
63
64 typedef struct _PhysDevAddr_struct {
65         DWORD             TargetId:24;
66         DWORD             Bus:6;
67         DWORD             Mode:2;
68         SCSI3Addr_struct  Target[2]; //2 level target device addr
69 } PhysDevAddr_struct;
70
71 typedef struct _LogDevAddr_struct {
72         DWORD            VolId:30;
73         DWORD            Mode:2;
74         BYTE             reserved[4];
75 } LogDevAddr_struct;
76
77 typedef union _LUNAddr_struct {
78         BYTE               LunAddrBytes[8];
79         SCSI3Addr_struct   SCSI3Lun[4];
80         PhysDevAddr_struct PhysDev;
81         LogDevAddr_struct  LogDev;
82 } LUNAddr_struct;
83
84 typedef struct _RequestBlock_struct {
85         BYTE   CDBLen;
86         struct {
87                 BYTE Type:3;
88                 BYTE Attribute:3;
89                 BYTE Direction:2;
90         } Type;
91         HWORD  Timeout;
92         BYTE   CDB[16];
93 } RequestBlock_struct;
94
95 typedef union _MoreErrInfo_struct{
96         struct {
97                 BYTE  Reserved[3];
98                 BYTE  Type;
99                 DWORD ErrorInfo;
100         } Common_Info;
101         struct{
102                 BYTE  Reserved[2];
103                 BYTE  offense_size;//size of offending entry
104                 BYTE  offense_num; //byte # of offense 0-base
105                 DWORD offense_value;
106         } Invalid_Cmd;
107 } MoreErrInfo_struct;
108
109 typedef struct _ErrorInfo_struct {
110         BYTE               ScsiStatus;
111         BYTE               SenseLen;
112         HWORD              CommandStatus;
113         DWORD              ResidualCnt;
114         MoreErrInfo_struct MoreErrInfo;
115         BYTE               SenseInfo[SENSEINFOBYTES];
116 } ErrorInfo_struct;
117
118 #pragma pack()
119
120 typedef struct _IOCTL_Command_struct {
121         LUNAddr_struct          LUN_info;
122         RequestBlock_struct     Request;
123         ErrorInfo_struct        error_info;
124         WORD                    buf_size;  /* size in bytes of the buf */
125         BYTE                    *buf;
126 } IOCTL_Command_struct;
127
128 typedef struct _LogvolInfo_struct{
129         __u32   LunID;
130         int     num_opens;  /* number of opens on the logical volume */
131         int     num_parts;  /* number of partitions configured on logvol */
132 } LogvolInfo_struct;
133
134 #define CCISS_PASSTHRU     _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct)
135 #define CCISS_GETLUNINFO   _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct)
136
137 int cciss_init( struct checker *);
138 void cciss_free (struct checker * c);
139 int cciss_tur( struct checker *);
140
141 #endif