Blame libmultipath/checkers/cciss.h

Packit Service 0af388
#ifndef CCISS_H
Packit Service 0af388
#define CCISS_H
Packit Service 0af388
Packit Service 0af388
#include <linux/types.h>
Packit Service 0af388
#include <linux/ioctl.h>
Packit Service 0af388
Packit Service 0af388
#define CCISS_IOC_MAGIC 'B'
Packit Service 0af388
Packit Service 0af388
/*
Packit Service 0af388
 * transfer direction
Packit Service 0af388
 */
Packit Service 0af388
#define XFER_NONE		0x00
Packit Service 0af388
#define XFER_WRITE		0x01
Packit Service 0af388
#define XFER_READ		0x02
Packit Service 0af388
#define XFER_RSVD		0x03
Packit Service 0af388
Packit Service 0af388
/*
Packit Service 0af388
 * task attribute
Packit Service 0af388
 */
Packit Service 0af388
#define ATTR_UNTAGGED		0x00
Packit Service 0af388
#define ATTR_SIMPLE		0x04
Packit Service 0af388
#define ATTR_HEADOFQUEUE	0x05
Packit Service 0af388
#define ATTR_ORDERED		0x06
Packit Service 0af388
#define ATTR_ACA		0x07
Packit Service 0af388
Packit Service 0af388
/*
Packit Service 0af388
 * cdb type
Packit Service 0af388
 */
Packit Service 0af388
#define TYPE_CMD		0x00
Packit Service 0af388
#define TYPE_MSG		0x01
Packit Service 0af388
Packit Service 0af388
#define SENSEINFOBYTES		32
Packit Service 0af388
Packit Service 0af388
/*
Packit Service 0af388
 * Type defs used in the following structs
Packit Service 0af388
 */
Packit Service 0af388
#define BYTE __u8
Packit Service 0af388
#define WORD __u16
Packit Service 0af388
#define HWORD __u16
Packit Service 0af388
#define DWORD __u32
Packit Service 0af388
Packit Service 0af388
#pragma pack(1)
Packit Service 0af388
Packit Service 0af388
//Command List Structure
Packit Service 0af388
typedef union _SCSI3Addr_struct {
Packit Service 0af388
	struct {
Packit Service 0af388
		BYTE Dev;
Packit Service 0af388
		BYTE Bus:6;
Packit Service 0af388
		BYTE Mode:2;        // b00
Packit Service 0af388
	} PeripDev;
Packit Service 0af388
	struct {
Packit Service 0af388
		BYTE DevLSB;
Packit Service 0af388
		BYTE DevMSB:6;
Packit Service 0af388
		BYTE Mode:2;        // b01
Packit Service 0af388
	} LogDev;
Packit Service 0af388
	struct {
Packit Service 0af388
		BYTE Dev:5;
Packit Service 0af388
		BYTE Bus:3;
Packit Service 0af388
		BYTE Targ:6;
Packit Service 0af388
		BYTE Mode:2;        // b10
Packit Service 0af388
	} LogUnit;
Packit Service 0af388
} SCSI3Addr_struct;
Packit Service 0af388
Packit Service 0af388
typedef struct _PhysDevAddr_struct {
Packit Service 0af388
	DWORD             TargetId:24;
Packit Service 0af388
	DWORD             Bus:6;
Packit Service 0af388
	DWORD             Mode:2;
Packit Service 0af388
	SCSI3Addr_struct  Target[2]; //2 level target device addr
Packit Service 0af388
} PhysDevAddr_struct;
Packit Service 0af388
Packit Service 0af388
typedef struct _LogDevAddr_struct {
Packit Service 0af388
	DWORD            VolId:30;
Packit Service 0af388
	DWORD            Mode:2;
Packit Service 0af388
	BYTE             reserved[4];
Packit Service 0af388
} LogDevAddr_struct;
Packit Service 0af388
Packit Service 0af388
typedef union _LUNAddr_struct {
Packit Service 0af388
	BYTE               LunAddrBytes[8];
Packit Service 0af388
	SCSI3Addr_struct   SCSI3Lun[4];
Packit Service 0af388
	PhysDevAddr_struct PhysDev;
Packit Service 0af388
	LogDevAddr_struct  LogDev;
Packit Service 0af388
} LUNAddr_struct;
Packit Service 0af388
Packit Service 0af388
typedef struct _RequestBlock_struct {
Packit Service 0af388
	BYTE   CDBLen;
Packit Service 0af388
	struct {
Packit Service 0af388
		BYTE Type:3;
Packit Service 0af388
		BYTE Attribute:3;
Packit Service 0af388
		BYTE Direction:2;
Packit Service 0af388
	} Type;
Packit Service 0af388
	HWORD  Timeout;
Packit Service 0af388
	BYTE   CDB[16];
Packit Service 0af388
} RequestBlock_struct;
Packit Service 0af388
Packit Service 0af388
typedef union _MoreErrInfo_struct{
Packit Service 0af388
	struct {
Packit Service 0af388
		BYTE  Reserved[3];
Packit Service 0af388
		BYTE  Type;
Packit Service 0af388
		DWORD ErrorInfo;
Packit Service 0af388
	} Common_Info;
Packit Service 0af388
	struct{
Packit Service 0af388
		BYTE  Reserved[2];
Packit Service 0af388
		BYTE  offense_size;//size of offending entry
Packit Service 0af388
		BYTE  offense_num; //byte # of offense 0-base
Packit Service 0af388
		DWORD offense_value;
Packit Service 0af388
	} Invalid_Cmd;
Packit Service 0af388
} MoreErrInfo_struct;
Packit Service 0af388
Packit Service 0af388
typedef struct _ErrorInfo_struct {
Packit Service 0af388
	BYTE               ScsiStatus;
Packit Service 0af388
	BYTE               SenseLen;
Packit Service 0af388
	HWORD              CommandStatus;
Packit Service 0af388
	DWORD              ResidualCnt;
Packit Service 0af388
	MoreErrInfo_struct MoreErrInfo;
Packit Service 0af388
	BYTE               SenseInfo[SENSEINFOBYTES];
Packit Service 0af388
} ErrorInfo_struct;
Packit Service 0af388
Packit Service 0af388
#pragma pack()
Packit Service 0af388
Packit Service 0af388
typedef struct _IOCTL_Command_struct {
Packit Service 0af388
	LUNAddr_struct		LUN_info;
Packit Service 0af388
	RequestBlock_struct	Request;
Packit Service 0af388
	ErrorInfo_struct	error_info;
Packit Service 0af388
	WORD			buf_size;  /* size in bytes of the buf */
Packit Service 0af388
	BYTE			*buf;
Packit Service 0af388
} IOCTL_Command_struct;
Packit Service 0af388
Packit Service 0af388
typedef struct _LogvolInfo_struct{
Packit Service 0af388
	__u32   LunID;
Packit Service 0af388
	int     num_opens;  /* number of opens on the logical volume */
Packit Service 0af388
	int     num_parts;  /* number of partitions configured on logvol */
Packit Service 0af388
} LogvolInfo_struct;
Packit Service 0af388
Packit Service 0af388
#define CCISS_PASSTHRU     _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct)
Packit Service 0af388
#define CCISS_GETLUNINFO   _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct)
Packit Service 0af388
Packit Service 0af388
int cciss_init( struct checker *);
Packit Service 0af388
void cciss_free (struct checker * c);
Packit Service 0af388
int cciss_tur( struct checker *);
Packit Service 0af388
Packit Service 0af388
#endif