base
This commit is contained in:
+102
@@ -0,0 +1,102 @@
|
||||
#ifndef __SOLARISIOCTL_H__
|
||||
#define __SOLARISIOCTL_H__
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <pthread.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h> /* File control definitions */
|
||||
#include <errno.h> /* Error number definitions */
|
||||
#include <unistd.h> /* fork() */
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <ftw.h>
|
||||
|
||||
#include <sys/mhd.h>
|
||||
#include <sys/scsi/impl/uscsi.h>
|
||||
#include <sys/scsi/generic/commands.h>
|
||||
#include <sys/scsi/generic/inquiry.h>
|
||||
|
||||
|
||||
#include "commdef.h"
|
||||
#include "interface.h"
|
||||
|
||||
typedef struct _SRB_IO_CONTROL sSRB_IO_CONTROL, *pSRB_IO_CONTROL;
|
||||
typedef struct _SRB_BUFFER sSRB_BUFFER, *pSRB_BUFFER;
|
||||
|
||||
|
||||
/*DeviceType*/
|
||||
#define ARECA_SATA_RAID 0x90000000
|
||||
/*FunctionCode*/
|
||||
#define FUNCTION_READ_RQBUFFER 0x0801
|
||||
#define FUNCTION_WRITE_WQBUFFER 0x0802
|
||||
#define FUNCTION_CLEAR_RQBUFFER 0x0803
|
||||
#define FUNCTION_CLEAR_WQBUFFER 0x0804
|
||||
#define FUNCTION_CLEAR_ALLQBUFFER 0x0805
|
||||
#define FUNCTION_RETURN_CODE_3F 0x0806
|
||||
#define FUNCTION_SAY_HELLO 0x0807
|
||||
#define FUNCTION_SAY_GOODBYE 0x0808
|
||||
/* ARECA IO CONTROL CODE*/
|
||||
#define ARCMSR_IOCTL_READ_RQBUFFER ARECA_SATA_RAID | FUNCTION_READ_RQBUFFER
|
||||
#define ARCMSR_IOCTL_WRITE_WQBUFFER ARECA_SATA_RAID | FUNCTION_WRITE_WQBUFFER
|
||||
#define ARCMSR_IOCTL_CLEAR_RQBUFFER ARECA_SATA_RAID | FUNCTION_CLEAR_RQBUFFER
|
||||
#define ARCMSR_IOCTL_CLEAR_WQBUFFER ARECA_SATA_RAID | FUNCTION_CLEAR_WQBUFFER
|
||||
#define ARCMSR_IOCTL_CLEAR_ALLQBUFFER ARECA_SATA_RAID | FUNCTION_CLEAR_ALLQBUFFER
|
||||
#define ARCMSR_IOCTL_RETURN_CODE_3F ARECA_SATA_RAID | FUNCTION_RETURN_CODE_3F
|
||||
#define ARCMSR_IOCTL_SAY_HELLO ARECA_SATA_RAID | FUNCTION_SAY_HELLO
|
||||
#define ARCMSR_IOCTL_SAY_GOODBYE ARECA_SATA_RAID | FUNCTION_SAY_GOODBYE
|
||||
/* ARECA IOCTL ReturnCode */
|
||||
#define ARCMSR_IOCTL_RETURNCODE_OK 0x00000001
|
||||
#define ARCMSR_IOCTL_RETURNCODE_ERROR 0x00000006
|
||||
#define ARCMSR_IOCTL_RETURNCODE_3F 0x0000003F
|
||||
#define SYSERR (-1)
|
||||
|
||||
typedef struct _SRB_IO_CONTROL
|
||||
{
|
||||
unsigned int HeaderLength;
|
||||
UCHAR Signature[8];
|
||||
unsigned int Timeout;
|
||||
unsigned int ControlCode;
|
||||
unsigned int ReturnCode;
|
||||
unsigned int Length;
|
||||
};
|
||||
|
||||
|
||||
typedef struct _SRB_BUFFER
|
||||
{
|
||||
sSRB_IO_CONTROL srbioctl; /*ioctl header*/
|
||||
UCHAR ioctldatabuffer[224];/*areca gui program does not accept more than 1031 byte*/
|
||||
};
|
||||
|
||||
|
||||
class SolarisIoctlInterface : public ArcInterface
|
||||
{
|
||||
public:
|
||||
SolarisIoctlInterface();
|
||||
~SolarisIoctlInterface();
|
||||
bool init(const int nScsiPort);
|
||||
int send(sIF_CMD_BLOCK *ifData);
|
||||
int recv(sIF_CMD_BLOCK *ifData);
|
||||
int syncSend(sIF_CMD_BLOCK *ifData);
|
||||
void requirelock();
|
||||
void releaselock();
|
||||
void *getDeviceHandle();
|
||||
BOOL ClearReadBuffer();
|
||||
BOOL ClearWriteBuffer();
|
||||
BOOL ClearReadWriteBuffer();
|
||||
int getMTU();
|
||||
private:
|
||||
HANDLE m_hScsi;
|
||||
int fd;
|
||||
pthread_mutex_t mut;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user