⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scsi-defs.h

📁 开源备份软件源码 AMANDA, the Advanced Maryland Automatic Network Disk Archiver, is a backup system that a
💻 H
📖 第 1 页 / 共 3 页
字号:
    PackedBit DTDC :2;#endif    unsigned char res1[3];} DisconnectReconnectPage_T;/* ======================================================= *//* EAAPage_T *//* ======================================================= */typedef struct {#ifdef LITTLE_ENDIAN_BITFIELDS    PackedBit PageCode : 6;    PackedBit RSVD     : 1;    PackedBit PS       : 1;#else    PackedBit PS       : 1;    PackedBit RSVD     : 1;    PackedBit PageCode : 6;#endif    unsigned char ParameterListLength;    unsigned char MediumTransportElementAddress[2];    unsigned char NoMediumTransportElements[2];    unsigned char FirstStorageElementAddress[2];    unsigned char NoStorageElements[2];    unsigned char FirstImportExportElementAddress[2];    unsigned char NoImportExportElements[2];    unsigned char FirstDataTransferElementAddress[2];    unsigned char NoDataTransferElements[2];    unsigned char res[2];} EAAPage_T;    /* ======================================================= *//* TransPortGeometryDescriptorPage_T *//* ======================================================= */typedef struct {#ifdef LITTLE_ENDIAN_BITFIELDS    PackedBit PageCode : 6;    PackedBit RSVD     : 1;    PackedBit PS       : 1;#else    PackedBit PS       : 1;    PackedBit RSVD     : 1;    PackedBit PageCode : 6;#endif    unsigned char ParameterListLength;#ifdef LITTLE_ENDIAN_BITFIELDS    PackedBit Rotate    : 1;    PackedBit res       : 7;#else    PackedBit res       : 7;    PackedBit Rotate    : 1;#endif    unsigned char MemberNumber;} TransportGeometryDescriptorPage_T;  /* ======================================================= *//* DeviceCapabilitiesPage_T *//* ======================================================= */typedef struct{#ifdef LITTLE_ENDIAN_BITFIELDS    PackedBit PageCode : 6;    PackedBit RSVD     : 1;    PackedBit PS       : 1;#else    PackedBit PS       : 1;    PackedBit RSVD     : 1;    PackedBit PageCode : 6;#endif    unsigned char ParameterLength;#ifdef LITTLE_ENDIAN_BITFIELDS    PackedBit MT        : 1;    PackedBit ST        : 1;    PackedBit IE        : 1;    PackedBit DT        : 1;    PackedBit res1      : 4;#else    PackedBit res1      : 4;    PackedBit DT        : 1;    PackedBit IE        : 1;    PackedBit ST        : 1;    PackedBit MT        : 1;#endif    unsigned char res;#ifdef LITTLE_ENDIAN_BITFIELDS    PackedBit MT2MT     : 1;    PackedBit MT2ST     : 1;    PackedBit MT2IE     : 1;    PackedBit MT2DT     : 1;    PackedBit res2      : 4;#else    PackedBit res2      : 4;    PackedBit MT2DT     : 1;    PackedBit MT2IE     : 1;    PackedBit MT2ST     : 1;    PackedBit MT2MT     : 1;#endif#ifdef LITTLE_ENDIAN_BITFIELDS    PackedBit ST2MT     : 1;    PackedBit ST2ST     : 1;    PackedBit ST2IE     : 1;    PackedBit ST2DT     : 1;    PackedBit res3      : 4;#else    PackedBit res3      : 4;    PackedBit ST2DT     : 1;    PackedBit ST2IE     : 1;    PackedBit ST2ST     : 1;    PackedBit ST2MT     : 1;#endif#ifdef LITTLE_ENDIAN_BITFIELDS    PackedBit IE2MT     : 1;    PackedBit IE2ST     : 1;    PackedBit IE2IE     : 1;    PackedBit IE2DT     : 1;    PackedBit res4      : 4;#else    PackedBit res4      : 4;    PackedBit IE2DT     : 1;    PackedBit IE2IE     : 1;    PackedBit IE2ST     : 1;    PackedBit IE2MT     : 1;#endif#ifdef LITTLE_ENDIAN_BITFIELDS    PackedBit DT2MT     : 1;    PackedBit DT2ST     : 1;    PackedBit DT2IE     : 1;    PackedBit DT2DT     : 1;    PackedBit res5      : 4;#else    PackedBit res5      : 4;    PackedBit DT2DT     : 1;    PackedBit DT2IE     : 1;    PackedBit DT2ST     : 1;    PackedBit DT2MT     : 1;#endif    unsigned char res0819[12];} DeviceCapabilitiesPage_T;  /* ======================================================= *//* ModePageEXB10hLCD_T *//* ======================================================= */typedef struct ModePageEXB10hLCD{  unsigned char PageCode;  unsigned char ParameterListLength;#ifdef LITTLE_ENDIAN_BITFIELDS  PackedBit WriteLine4 : 1;  PackedBit WriteLine3 : 1;  PackedBit WriteLine2 : 1;  PackedBit WriteLine1 : 1;  PackedBit res        : 4;#else  PackedBit res        : 4;  PackedBit WriteLine1 : 1;  PackedBit WriteLine2 : 1;  PackedBit WriteLine3 : 1;  PackedBit WriteLine4 : 1;#endif  unsigned char reserved;  unsigned char line1[20];  unsigned char line2[20];  unsigned char line3[20];  unsigned char line4[20];} ModePageEXB10hLCD_T;/* ======================================================= *//* ModePageEXBBaudRatePage_T *//* ======================================================= */typedef struct ModePageEXBBaudRatePage{  unsigned char PageCode;  unsigned char ParameterListLength;  unsigned char BaudRate[2];} ModePageEXBBaudRatePage_T;/* ======================================================= *//* ModePageEXB120VendorUnique_T *//* ======================================================= */typedef struct ModePageEXB120VendorUnique{#ifdef  LITTLE_ENDIAN_BITFIELDS    PackedBit PageCode : 6;    PackedBit RSVD0    : 1;    PackedBit PS       : 1;#else    PackedBit PS       : 1;    PackedBit RSVD0    : 1;    PackedBit PageCode : 6;#endif    unsigned char ParameterListLength;#ifdef LITTLE_ENDIAN_BITFIELDS    PackedBit MDC  : 2;    PackedBit NRDC : 1;    PackedBit RSVD : 1;    PackedBit NBL  : 1;    PackedBit PRTY : 1;    PackedBit UINT : 1;    PackedBit AINT : 1;#else    PackedBit AINT : 1;    PackedBit UINT : 1;    PackedBit PRTY : 1;    PackedBit NBL  : 1;    PackedBit RSVD : 1;    PackedBit NRDC : 1;    PackedBit MDC  : 2;#endif    unsigned char MaxParityRetries;    unsigned char DisplayMessage[60];} ModePageEXB120VendorUnique_T;/* ======================================================= *//* ModePageTreeFrogVendorUnique_T *//* ======================================================= */typedef struct ModePageTreeFrogVendorUnique{#ifdef  LITTLE_ENDIAN_BITFIELDS    PackedBit PageCode : 6;    PackedBit res0     : 1;    PackedBit PS       : 1;#else    PackedBit PS       : 1;    PackedBit res0     : 1;    PackedBit PageCode : 6;#endif    unsigned char ParameterListLength;#ifdef LITTLE_ENDIAN_BITFIELDS    PackedBit EBARCO  : 1;    PackedBit CHKSUM  : 1;    PackedBit res2    : 6;#else    PackedBit res2    : 6;    PackedBit CHKSUM  : 1;    PackedBit EBARCO  : 1;#endif    unsigned char res3;    unsigned char res4;    unsigned char res5;    unsigned char res6;    unsigned char res7;    unsigned char res8;    unsigned char res9;} ModePageTreeFrogVendorUnique_T;/* ======================================================= *//* ElementInfo_T *//* ======================================================= */typedef struct ElementInfo{    int type;       /* CHANGER - 1, STORAGE - 2, TAPE - 4 */    int address;    /* Adress of this Element */    int from;       /* From where did it come */    char status;    /* F -> Full, E -> Empty */    char VolTag[TAG_SIZE+1]; /* Label Info if Barcode reader exsist */    unsigned char ASC;  /* Additional Sense Code from read element status */    unsigned char ASCQ; /* */    unsigned char scsi; /* if DTE, which scsi address */  PackedBit svalid : 1;  PackedBit invert : 1;  PackedBit full   : 1;  PackedBit impexp : 1;  PackedBit except : 1;  PackedBit access : 1;  PackedBit inenab : 1;  PackedBit exenab : 1;} ElementInfo_T;typedef struct {    char *ident;                  /* Name of the device from inquiry */    char *type;                   /* Device Type, tape|robot */    int (*function_move)(int, int, int);    int (*function_status)(int, int);    int (*function_reset_status)(int);    int (*function_free)(void);    int (*function_eject)(char *, int);    int (*function_clean)(char *);    int (*function_rewind)(int);    int (*function_barcode)(int);    int (*function_search)(void);    int (*function_error)(int, unsigned char, unsigned char, unsigned char, unsigned char, RequestSense_T *);} ChangerCMD_T ;typedef struct {    unsigned char command;        /* The SCSI command byte */    int length;                   /* How long */    char *name;                   /* Name of the command */} SC_COM_T;typedef struct OpenFiles {    int fd;                       /* The filedescriptor */#ifdef HAVE_CAM_LIKE_SCSI    struct cam_device *curdev;#endif  unsigned char avail;          /* Is this device available */  unsigned char devopen;        /* Is the device open */  unsigned char inqdone;        /* Did we try to get device infos, was an open sucessfull */  unsigned char SCSI;           /* Can we send SCSI commands */  int flags;                    /* Can be used for some flags ... */  char *dev;                    /* The device which is used */  char *type;			/* Type of device, tape/changer */  char *ConfigName;             /* The name in the config */  char ident[17];               /* The identifier from the inquiry command */  ChangerCMD_T *functions;      /* Pointer to the function array for this device */  SCSIInquiry_T *inquiry;       /* The result from the Inquiry */} OpenFiles_T;typedef struct LogPageDecode {    int LogPage;    char *ident;    void (*decode)(LogParameter_T *, size_t);} LogPageDecode_T;typedef struct {   char *ident;        /* Ident as returned from the inquiry */   char *vendor;       /* Vendor as returned from the inquiry */   unsigned char type; /* removable .... */   unsigned char sense;/* Sense key as returned from the device */   unsigned char asc;  /* ASC as set in the sense struct */   unsigned char ascq; /* ASCQ as set in the sense struct */   int  ret;           /* What we think that we should return on this conditon */   char text[80];      /* A short text describing this condition */} SenseType_T;                                                                                    /* ======================================================= *//* Function-Declaration *//* ======================================================= */int SCSI_OpenDevice(int);int OpenDevice(int, char *DeviceName, char *ConfigName, char *ident);int SCSI_CloseDevice(int DeviceFD); int CloseDevice(char *, int); int Tape_Eject(int);int Tape_Status(int);void DumpSense(void);int Sense2Action(char *ident,			unsigned char type,			unsigned char ignsense,			unsigned char sense,			unsigned char asc,			unsigned char ascq,			char **text);int SCSI_ExecuteCommand(int DeviceFD,                        Direction_T Direction,                        CDB_T CDB,                        size_t CDB_Length,                        void *DataBuffer,                        size_t DataBufferLength,                        RequestSense_T *RequestSense,                        size_t RequestSenseLength);int Tape_Ioctl(int DeviceFD, int command);void ChangerStatus(char * option,			char * labelfile,			int HasBarCode,			char *changer_file,			char *changer_dev,			char *tape_device);int SCSI_Inquiry(int, SCSIInquiry_T *, size_t);int PrintInquiry(SCSIInquiry_T *);int DecodeSCSI(CDB_T CDB, char *string);int RequestSense(int fd, ExtendedRequestSense_T *s, int ClearErrorCounters);int DecodeSense(RequestSense_T *sense, char *pstring, FILE *out);int DecodeExtSense(ExtendedRequestSense_T *sense, char *pstring, FILE *out);void ChgExit(char *, char *, int);void ChangerReplay(char *option);void ChangerStatus(char *option, char *labelfile, int HasBarCode, char *changer_file, char *changer_dev, char *tape_device);int BarCode(int fd);int MapBarCode(char *labelfile, MBC_T *);int Tape_Ready(int fd, time_t wait_time);void Inventory(char *labelfile, int drive, int eject, int start, int stop, int clean);void ChangerDriverVersion(void);void PrintConf(void);int LogSense(int fd);int ScanBus(int print);void DebugPrint(int level, int section, char * fmt, ...);int DecodeSense(RequestSense_T *sense, char *pstring, FILE *out);void SCSI_OS_Version(void);int get_clean_state(char *tapedev);int find_empty(int fd, int start, int count);int get_slot_count(int fd);int get_drive_count(int fd);int GetCurrentSlot(int fd, int drive);void DumpDev(OpenFiles_T *p, char *device);int isempty(int fd, int slot);#endif	/* !SCSIDEFS_H *//* * Local variables: * indent-tabs-mode: nil * c-file-style: gnu * End: */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -