www.pudn.com > raid.rar > raid.h


#ifndef _RAID_IOCTL_H_
#define _RAID_IOCTL_H_

#include 
#include "m_defs.h"
#include "scsiio.h"
#include "sasio.h"

#define DEV_NAME_LEN	16

struct mio_common {
	void		*bc_cookie;
};

#define MIOCLOCATE 0
struct mio_locate {
	void		*bl_cookie;
	char		*bl_name;
};


/* RAID section */

#define MIOCINQ 32
struct mioc_inq {
	void		*bi_cookie;

	char		bi_dev[16];	/* controller device */
	int		bi_novol;	/* nr of volumes */
	int		bi_nodisk;	/* nr of total disks */
};

#define MIOCDISK 33
/* structure that represents a disk in a RAID volume */
struct mioc_disk {
	void		*bd_cookie;

	int		bd_volid;	/* associate with volume */
	int		bd_diskid;	/* virtual disk */
	int		bd_status;	/* current status */
#define MIOC_SDONLINE		0x00
#define MIOC_SDONLINE_S		"Online"
#define MIOC_SDOFFLINE		0x01
#define MIOC_SDOFFLINE_S	"Offline"
#define MIOC_SDFAILED		0x02
#define MIOC_SDFAILED_S 	"Failed"
#define MIOC_SDREBUILD		0x03
#define MIOC_SDREBUILD_S	"Rebuild"
#define MIOC_SDHOTSPARE		0x04
#define MIOC_SDHOTSPARE_S	"Hot spare"
#define MIOC_SDUNUSED		0x05
#define MIOC_SDUNUSED_S		"Unused"
#define MIOC_SDINVALID		0xff
#define MIOC_SDINVALID_S	"Invalid"
	int		bd_resv;	/* align */
	unsigned long long	bd_size;	/* size of the disk */

	/* physical data */
	unsigned short	bd_channel;
	unsigned short	bd_target;
	unsigned short	bd_lun;
	unsigned short	bd_other_id;	/* unused for now  */
	char		bd_vendor[32];	/* scsi string */
	char		bd_serial[32];	/* serial number */
	char		bd_procdev[16];	/* processor device */
};




#define MIOCVOL 34
/* structure that represents a RAID volume */
struct mioc_vol {
	void		*bv_cookie;

	int		bv_volid;	/* volume id */
	int		bv_resv1;	/* for binary compatibility */
	int		bv_status;	/* current status */
#define MIOC_SVONLINE		0x00
#define MIOC_SVONLINE_S		"Online"
#define MIOC_SVOFFLINE		0x01
#define MIOC_SVOFFLINE_S	"Offline"
#define MIOC_SVDEGRADED		0x02
#define MIOC_SVDEGRADED_S	"Degraded"
#define MIOC_SVSCRUB			0x03
#define MIOC_SVSCRUB_S		"Scrubed"
#define MIOC_SVINVALID		0xff
#define MIOC_SVINVALID_S	"Invalid"

	int		bv_resv2;	/* align */
	unsigned long long	bv_size;	/* size of the disk */
	int		bv_level;	/* raid level */
	int		bv_nodisk;	/* nr of drives */

	char		bv_dev[16];	/* device */
	char		bv_vendor[32];	/* scsi string */

	int		bv_percent;
	int		bv_seconds;
};

#define MIOCALARM 35
struct mioc_alarm {
	void		*ba_cookie;

	int		ba_resv1;	/* for binary compatibility */
	int		ba_resv2;	/* for binary compatibility */
	int		ba_status;	/* only used with get state */
	int		ba_resv3;	/* for binary compatibility */

	int		ba_opcode;
#define MIOC_SADISABLE		0x00	/* disable alarm */
#define MIOC_SAENABLE		0x01	/* enable alarm */
#define MIOC_SASILENCE		0x02	/* silence alarm */
#define MIOC_GASTATUS		0x03	/* get status */
#define MIOC_SATEST		0x04	/* test alarm */
};

#define MIOCBLINK 36
struct mioc_blink {
	void		*bb_cookie;

	int		bb_resv1;	/* for binary compatibility */
	int		bb_resv2;	/* for binary compatibility */
	int		bb_status;	/* current status */
#define MIOC_SBUNBLINK		0x00	/* disable blinking */
#define MIOC_SBBLINK		0x01	/* enable blink */
#define MIOC_SBALARM		0x02	/* enable alarm blink */
	int		bb_resv3;	/* for binary compatibility */

	int		bb_target;
	int		bb_channel;
};

#define MIOCSETSTATE 37
struct mioc_setstate {
	void		*bs_cookie;

	int		bs_resv1;	/* for binary compatibility */
	int		bs_resv2;	/* for binary compatibility */
	int		bs_status;	/* change to this status */
#define MIOC_SSONLINE		0x00	/* online disk */
#define MIOC_SSOFFLINE		0x01	/* offline disk */
#define MIOC_SSHOTSPARE		0x02	/* mark as hotspare */
	int		bs_resv3;	/* for binary compatibility */

	unsigned short	bs_channel;
	unsigned short	bs_target;
	unsigned short	bs_lun;
	unsigned short	bs_other_id;	/* unused for now  */

	int		bs_resv4;
};

#define MIOC_INQ		0x0001
#define MIOC_DISK		0x0002
#define MIOC_VOL		0x0004
#define MIOC_ALARM		0x0008
#define MIOC_BLINK		0x0010
#define MIOC_SETSTATE		0x0020


extern int ReadDellRaidInfo();

#endif /*  _RAID_IOCTL_H_ */