Classes | Files | Defines | Typedefs | Enumerations | Functions

SCSI Library
[Agents]

Platform independent SCSI layer. More...

Collaboration diagram for SCSI Library:

Classes

struct  cdb_Buf_t
class  scsi_CDB
 Base class for all CDB commands. More...
class  cdb_Inquiry
 CDB class, specialized for INQUIRY. More...
class  cdb_TestUnitReady
 Implementation of Test Unit Ready SCSI command. More...
class  cdb_LoadUnload
class  cdb_Erase
 Erase medium. More...
class  cdb_Locate
 SCSI command for positioning (also used to change partition). More...
class  cdb_Rewind
 Rewind a tape. More...
class  cdb_Space
class  cdb_ReadPosition
 Get current logical position on tape. More...
class  cdb_ReportDensity
 Get capacity infor from the medium/tape drive. More...
class  cdb_WriteFileMarks
 Write filemarks command. More...
class  cdb_Read
 SCSI read command. More...
class  cdb_Write
 SCSI write command. More...
class  cdb_ModeSense
 SCSI Mode Sense command. More...
class  cdb_ModeSelect
 SCSI Mode Select command. More...
class  cdb_LogSense
 SCSI Log Sense command. More...
class  cdb_LogSelect
 SCSI Log Select command. More...
class  cdb_MoveMedium
 SCSI Move Medium command. More...
class  cdb_ReadElementStatus
 SCSI READ ELEMENT STATUS command. More...
class  cdb_InitElementStatus
 Initialize element status (media changer). More...
class  cdb_ReadAttribute
 Read MAM attributes. More...
class  cdb_WriteAttribute
 Write MAM attributes. More...
class  scsi_Data
 Wrapper for data, returned by SCSI subsystem. More...
class  data_Inquiry
 Inquiry Data. More...
class  data_Position
 Results of read position command. More...
class  data_Density
 Results of report density support CDB. More...
class  data_Mode
 Mode data class. More...
class  data_Log
 Log data class. More...
class  data_ElementStatus
 Element status data (media changer). More...
class  data_Attribute
 MAM data attribute. More...
struct  cdb_Inquiry_t
struct  cdb_Rewind_t
struct  cdb_LoadUnload_t
struct  cdb_TestUnitReady_t
struct  cdb_RequestSense_t
struct  cdb_Space_t
struct  cdb_Erase_t
struct  cdb_Write_t
struct  cdb_Read_t
struct  cdb_WriteFileMarks_t
struct  cdb_ReadPosition_t
struct  cdb_Locate_t
struct  cdb_ModeSense_t
struct  cdb_ModeSelect_t
struct  cdb_LogSense_t
struct  cdb_ReportDensity_t
struct  cdb_LogSelect_t
struct  cdb_InitElemStatus_t
struct  cdb_MoveMedium_t
struct  cdb_ReadElemStatus_t
struct  cdb_ReadAttribute_t
 CDB Read MAM Attribute. More...
struct  cdb_WriteAttribute_t
struct  data_PositionShort_t
struct  data_StdInquiry_t
struct  data_InqPages_t
 Page code 00h. More...
struct  data_InqSerialNo_t
 Page code 80h. More...
struct  data_InqDevId_t
struct  data_InqDeviceID_t
 Page code 83h. More...
union  data_Inquiry_t
 Union of all inquiry pages. More...
struct  data_FieldPointer_t
 Member of data_Sense_t if sense key is ILLEGAL_REQUEST and sskv is 1. More...
struct  data_RetryCount_t
 Member of data_Sense_t if sense key is RECOVERED ERROR, MEDIUM ERROR, HARDWARE ERROR and sskv is 1. More...
struct  data_Attribute_t
 MAM Attributes. More...
struct  data_Progress_t
 Member of data_Sense_t if sense key is NOT_READY and sskv is 1. More...
struct  data_AITRuntime_t
 Member of data_Sense_t if sskv is 0. More...
struct  data_AIT_Sense_t
struct  data_LTO_Sense_t
struct  data_Sense_t
struct  data_ModeTapeHdr_t
struct  data_ModeHdr_t
 Mode sense parameter header of 6-byte MODE SENSE/SELECT command. More...
struct  data_ModeGenBlkDesc_t
struct  data_ModePartPage_t
 (TAPE) Mode page 0x11: Partition info (used also for Page 0x32) More...
struct  data_ModeAITConfigPage_t
 (TAPE) Page 0x31: AIT device configuration page More...
struct  data_ModeDevCfgPage_t
 (TAPE) Device configuration page 0x10 More...
struct  data_ModeElemAddrPage_t
 (EXCHANGER) Element address assignment page 0x1d More...
struct  data_ModeAIT_t
struct  data_ModePartitions_t
struct  data_ModeCompressPage_t
struct  data_ModeCompress_t
struct  data_ModeDevConfig_t
struct  data_ModeElemAddr_t
struct  data_Mode_t
struct  data_LogHdr_t
struct  data_LogPartCapacity_t
 Log Page 31h (Tape capacity info). More...
struct  data_LogPages_t
 Log Page 31 parameter code 00h. More...
struct  data_LogTapeCapacity_t
struct  data_LogMICMedID_t
struct  data_LogMICFixedParam_t
 MIC Fixed Length Info Page (0x3D). More...
struct  data_LogMICFixed_t
struct  data_LogMICVarParam_t
 MIC Variable Length Info Page (0x3E). More...
struct  data_LogMICVar_t
struct  data_Log_t
struct  data_RDSHdr_t
struct  data_RDSDescriptor_t
struct  data_ReportDensitySupport_t
struct  data_ESHdr_t
struct  data_ESPageHdr_t
struct  data_ESDescriptor_t
class  scsi_SenseVnd
class  scsi_IO
 Interface class to access SCSI devices. More...
class  scsi_LnxSG
 Implementation of scsi_IO interface using Linux SCSI Generic (sg) driver. More...
class  scsi_UInt16
 Class that behaves like a UInt16_t. More...
class  scsi_Wrapper16
 Class thatis a wrapper around scsi_UInt16_t and behaves like a UInt16_t. More...
class  scsi_UInt24
 Class that behaves like a 24-bit integer. More...
class  scsi_Wrapper24
 Class thatis a wrapper around scsi_UInt24_t and behaves like a 24-bit integer. More...
class  scsi_UInt32
 Class that behaves like a UInt32_t. More...
class  scsi_Wrapper32
 Class thatis a wrapper around scsi_UInt16_t and behaves like a UInt16_t. More...

Files

file  scsi_types.h
 

Special numeric types are required for SCSI subsystem.


Defines

#define op_TEST_UNIT_READY   0x00
#define op_REZERO_UNIT   0x01
#define op_REWIND   (op_REZERO_UNIT)
#define op_REQUEST_SENSE   0x03
#define op_FORMAT   0x04
#define op_FORMAT_UNIT   (op_FORMAT)
#define op_FORMAT_MEDIUM   (op_FORMAT)
#define op_READ_BLOCK_LIMITS   0x05
#define op_REASSIGN_BLOCKS   0x07
#define op_INIT_ELEMENT_STATUS   (op_REASSIGN_BLOCKS)
#define op_READ_6   0x08
#define op_WRITE_6   0x0A
#define op_SEND   (op_WRITE_6)
#define op_SEND_MESSAGE   (op_WRITE_6)
#define op_PRINT   (op_WRITE_6)
#define op_SEEK_6   0x0B
#define op_SLEW_AND_PRINT   (op_SEEK_6)
#define op_READ_REVERSE   0x0F
#define op_WRITE_FILEMARKS   0x10
#define op_SYNCHRONIZE_BUFFER   (op_WRITE_FILEMARKS)
#define op_SPACE   0x11
#define op_INQUIRY   0x12
#define op_VERIFY_6   0x13
#define op_RECOVER_BUFFERED_DATA   0x14
#define op_MODE_SELECT   0x15
#define op_RESERVE   0x16
#define op_RESERVE_ELEMENT   (op_RESERVE)
#define op_RELEASE   0x17
#define op_RELEASE_ELEMENT   (op_RELEASE)
#define op_COPY   0x18
#define op_ERASE   0x19
#define op_MODE_SENSE   0x1A
#define op_START_STOP   0x1B
#define op_LOAD_UNLOAD   (op_START_STOP)
#define op_SCAN   (op_START_STOP)
#define op_STOP_PRINT   (op_START_STOP)
#define op_RECEIVE_DIAGNOSTIC   0x1C
#define op_SEND_DIAGNOSTIC   0x1D
#define op_ALLOW_MEDIUM_REMOVAL   0x1E
#define op_READ_FORMAT_CAPACITIES   0x23
#define op_SET_WINDOW   0x24
#define op_READ_CAPACITY   0x25
#define op_READ_CARD_CAPACITY   (op_READ_CAPACITY)
#define op_GET_WINDOW   (op_READ_CAPACITY)
#define op_READ_10   0x28
#define op_WRITE_10   0x2a
#define op_SEEK_10   0x2b
#define op_LOCATE   (op_SEEK_10)
#define op_WRITE_VERIFY   0x2e
#define op_VERIFY_10   0x2f
#define op_SEARCH_HIGH   0x30
#define op_SEARCH_EQUAL   0x31
#define op_SEARCH_LOW   0x32
#define op_SET_LIMITS   0x33
#define op_PRE_FETCH   0x34
#define op_READ_POSITION   0x34
#define op_SYNCHRONIZE_CACHE   0x35
#define op_LOCK_UNLOCK_CACHE   0x36
#define op_READ_DEFECT_DATA   0x37
#define op_MEDIUM_SCAN   0x38
#define op_COMPARE   0x39
#define op_COPY_VERIFY   0x3a
#define op_WRITE_BUFFER   0x3b
#define op_READ_BUFFER   0x3c
#define op_UPDATE_BLOCK   0x3d
#define op_READ_LONG   0x3e
#define op_WRITE_LONG   0x3f
#define op_CHANGE_DEFINITION   0x40
#define op_WRITE_SAME   0x41
#define op_READ_TOC   0x43
#define op_REPORT_DENSITY_SUPPORT   0x44
#define op_LOG_SELECT   0x4c
#define op_LOG_SENSE   0x4d
#define op_MODE_SELECT_10   0x55
#define op_RESERVE_10   0x56
#define op_RELEASE_10   0x57
#define op_MODE_SENSE_10   0x5a
#define op_PERSISTENT_RESERVE_IN   0x5e
#define op_PERSISTENT_RESERVE_OUT   0x5f
#define op_READ_ATTRIBUTE   0x8c
#define op_WRITE_ATTRIBUTE   0x8d
#define op_MOVE_MEDIUM   0xa5
#define op_READ_12   0xa8
#define op_WRITE_12   0xaa
#define op_WRITE_VERIFY_12   0xae
#define op_SEARCH_HIGH_12   0xb0
#define op_SEARCH_EQUAL_12   0xb1
#define op_SEARCH_LOW_12   0xb2
#define op_READ_ELEMENT_STATUS   0xb8
#define op_SEND_VOLUME_TAG   0xb6
#define op_WRITE_LONG_2   0xea
#define st_STATUS_MASK   0x3E
#define sns_NOT_DEFERRED   0x70
#define sns_DEFERRED   0x71
#define inqstd_VENDOR_ID_LEN_d   (8)
#define inqstd_PRODUCT_ID_LEN_d   (16)
#define inqstd_PROD_REVISION_LEN_d   (4)
#define mic_AVAILABLE_d   UInt16_t(0x03)
#define mic_SIZEVOLNOTE_d   UInt16_t(0x04)
#define mic_SERNUM_d   UInt16_t(0x06)
#define mic_NOTEMAP_d   UInt16_t(0x14)
#define mic_SIZEPARTNOTE_d   UInt16_t(0x18)
 Parameter code for partition 0.
#define mic_DATAVOLNOTE_d   UInt16_t(0x01)
#define mic_DATAPARTNOTE_d   UInt16_t(0x02)
 Parameter code for partition 0.
#define mic_MAXNOTESIZE_d   (1024*16)
 Maximum size that is read/written from/to MIC.
#define scsi_TIMEOUT_FOREVER_d   (UINT_MAX)
#define scsi_TIMEOUT_NORMAL_d   (20*60*1000)
#define scsi_TIMEOUT_LONG_d   (30*60*1000)
#define scsi_TIMEOUT_LONGLONG_d   (200*60*1000)
#define scsi_TIMEOUT_FORMAT_d   (12*60*60*1000)

Typedefs

typedef set< UInt8_tdata_PageSet
typedef UInt8_t scsi_UInt16_t [2]
typedef UInt8_t scsi_UInt24_t [3]
typedef UInt8_t scsi_UInt32_t [4]

Enumerations

enum  Direction_e {
  TRANSFER_NONE = -1, TRANSFER_OUT = -2,
  TRANSFER_IN = -3, TRANSFER_INOUT = -4,
  TRANSFER_UNKNOWN = -5
}
enum  spaceUnit_e {
  spaceBlocks = 0x0, spaceFileMarks = 0x1,
  spaceEndOfData = 0x3, spaceSetMarks = 0x4
}
 

Tape positioning command.

More...
enum  Mode_t { mode_DDS = 0, mode_AIT = 1 }
enum  scsi_Status_e {
  st_GOOD = 0x00, st_CHECK_CONDITION = 0x02,
  st_CONDITION_GOOD = 0x04, st_BUSY = 0x08,
  st_INTERMEDIATE_GOOD = 0x10, st_INTERMEDIATE_C_GOOD = 0x14,
  st_RESERVATION_CONFLICT = 0x18, st_COMMAND_TERMINATED = 0x22,
  st_QUEUE_FULL = 0x28, st_ACA_ACTIVE = 0x30
}
 

SCSI-3 status codes:

More...
enum  scsi_SenseKey_e {
  sk_NO_SENSE = 0x00, sk_RECOVERED_ERROR = 0x01,
  sk_NOT_READY = 0x02, sk_MEDIUM_ERROR = 0x03,
  sk_HARDWARE_ERROR = 0x04, sk_ILLEGAL_REQUEST = 0x05,
  sk_UNIT_ATTENTION = 0x06, sk_DATA_PROTECT = 0x07,
  sk_BLANK_CHECK = 0x08, sk_VENDOR_SPECIFIC = 0x09,
  sk_COPY_ABORTED = 0x0A, sk_ABORTED_COMMAND = 0x0B,
  sk_OBSOLETE = 0x0C, sk_VOLUME_OVERFLOW = 0x0D,
  sk_MISCOMPARE = 0x0E, sk_RESERVED = 0x0F
}
enum  scsi_DeviceType_e {
  dt_DISK = 0x00, dt_TAPE = 0x01,
  dt_PRINTER = 0x02, dt_PROCESSOR = 0x03,
  dt_WORM = 0x04, dt_ROM = 0x05,
  dt_SCANNER = 0x06, dt_MOD = 0x07,
  dt_MEDIUM_CHANGER = 0x08, dt_COMM = 0x09,
  dt_PRESS1 = 0x0A, dt_PRESS2 = 0x0B,
  dt_STORAGE_ARRAY = 0x0C, dt_ENCLOSURE = 0x0D,
  dt_RBC = 0x0E, dt_OCRW = 0x0F,
  dt_RESERVED2 = 0x10, dt_OSD = 0x11,
  dt_NO_LUN = 0x7F
}

Functions

UInt8_t scsi_CommandSize (UInt8_t a_cdbCode)
bool scsi_IsVendorSpecificASC (UInt8_t a_asc, UInt8_t a_ascq)
IVD_SCSI_DECL_d const char * scsi_GetDeviceTypeText (scsi_DeviceType_e a_dt)
const string scsi_GetOpcodeText (UInt16_t a_opcode)
const char * scsi_GetStatusText (scsi_Status_e a_status)
const char * scsi_GetSenseKeyText (scsi_SenseKey_e a_sense)
const scsi_SenseVndscsi_GetVndAddSnsTbl (const string &a_vendor, const string &a_product)
const string scsi_GetSenseAdditional (UInt8_t a_asc, UInt8_t a_ascq, const scsi_SenseVnd *a_vndErr)
const string scsi_GetASCText (const data_Sense_t &a_sense, const scsi_SenseVnd *a_vndErr)
const string scsi_GetSenseText (const data_Sense_t &a_sense, scsi_DeviceType_e a_dt, const scsi_SenseVnd *a_vndErr)

Detailed Description

Platform independent SCSI layer.


Define Documentation

#define inqstd_PROD_REVISION_LEN_d   (4)

Definition at line 225 of file scsi_const.h.

Referenced by scsi_IO::InqStandard().

#define inqstd_PRODUCT_ID_LEN_d   (16)

Definition at line 224 of file scsi_const.h.

Referenced by scsi_IO::InqStandard().

#define inqstd_VENDOR_ID_LEN_d   (8)

Definition at line 223 of file scsi_const.h.

Referenced by scsi_IO::InqStandard().

#define mic_AVAILABLE_d   UInt16_t(0x03)

Definition at line 228 of file scsi_const.h.

Referenced by bea_MicMemory::GetAvailable(), data_Log::GetMICAvailSize(), and Micfree().

#define mic_DATAPARTNOTE_d   UInt16_t(0x02)

Parameter code for partition 0.

Just add partition index for other partitions.

Definition at line 244 of file scsi_const.h.

Referenced by Micnotelen().

#define mic_DATAVOLNOTE_d   UInt16_t(0x01)
#define mic_MAXNOTESIZE_d   (1024*16)

Maximum size that is read/written from/to MIC.

Definition at line 247 of file scsi_const.h.

Referenced by data_Log::SetMICNote().

#define mic_NOTEMAP_d   UInt16_t(0x14)

Definition at line 231 of file scsi_const.h.

Referenced by Micnotemap().

#define mic_SERNUM_d   UInt16_t(0x06)
#define mic_SIZEPARTNOTE_d   UInt16_t(0x18)

Parameter code for partition 0.

Add partition offset for other partitions.

Definition at line 236 of file scsi_const.h.

Referenced by bea_MicMemory::GetSize().

#define mic_SIZEVOLNOTE_d   UInt16_t(0x04)

Definition at line 229 of file scsi_const.h.

Referenced by bea_MicMemory::GetSize(), Micnotesize(), and bea_MicMemory::Read().

#define op_ALLOW_MEDIUM_REMOVAL   0x1E

Definition at line 77 of file scsi_const.h.

#define op_CHANGE_DEFINITION   0x40

Definition at line 107 of file scsi_const.h.

#define op_COMPARE   0x39

Definition at line 100 of file scsi_const.h.

#define op_COPY   0x18

Definition at line 68 of file scsi_const.h.

#define op_COPY_VERIFY   0x3a

Definition at line 101 of file scsi_const.h.

#define op_ERASE   0x19

Definition at line 69 of file scsi_const.h.

#define op_FORMAT   0x04

Definition at line 43 of file scsi_const.h.

#define op_FORMAT_MEDIUM   (op_FORMAT)

Definition at line 45 of file scsi_const.h.

#define op_FORMAT_UNIT   (op_FORMAT)

Definition at line 44 of file scsi_const.h.

#define op_GET_WINDOW   (op_READ_CAPACITY)

Definition at line 82 of file scsi_const.h.

#define op_INIT_ELEMENT_STATUS   (op_REASSIGN_BLOCKS)

Definition at line 48 of file scsi_const.h.

#define op_INQUIRY   0x12

Definition at line 60 of file scsi_const.h.

#define op_LOAD_UNLOAD   (op_START_STOP)

Definition at line 72 of file scsi_const.h.

#define op_LOCATE   (op_SEEK_10)

Definition at line 87 of file scsi_const.h.

#define op_LOCK_UNLOCK_CACHE   0x36

Definition at line 97 of file scsi_const.h.

#define op_LOG_SELECT   0x4c

Definition at line 111 of file scsi_const.h.

#define op_LOG_SENSE   0x4d

Definition at line 112 of file scsi_const.h.

#define op_MEDIUM_SCAN   0x38

Definition at line 99 of file scsi_const.h.

#define op_MODE_SELECT   0x15

Definition at line 63 of file scsi_const.h.

#define op_MODE_SELECT_10   0x55

Definition at line 113 of file scsi_const.h.

#define op_MODE_SENSE   0x1A

Definition at line 70 of file scsi_const.h.

#define op_MODE_SENSE_10   0x5a

Definition at line 116 of file scsi_const.h.

#define op_MOVE_MEDIUM   0xa5

Definition at line 121 of file scsi_const.h.

#define op_PERSISTENT_RESERVE_IN   0x5e

Definition at line 117 of file scsi_const.h.

#define op_PERSISTENT_RESERVE_OUT   0x5f

Definition at line 118 of file scsi_const.h.

#define op_PRE_FETCH   0x34

Definition at line 94 of file scsi_const.h.

#define op_PRINT   (op_WRITE_6)

Definition at line 53 of file scsi_const.h.

#define op_READ_10   0x28

Definition at line 84 of file scsi_const.h.

Referenced by scsi_LnxSG::DoIOCtl(), and scsi_IO::IOCtl().

#define op_READ_12   0xa8

Definition at line 122 of file scsi_const.h.

#define op_READ_6   0x08

Definition at line 49 of file scsi_const.h.

Referenced by scsi_LnxSG::DoIOCtl(), and scsi_IO::IOCtl().

#define op_READ_ATTRIBUTE   0x8c

Definition at line 119 of file scsi_const.h.

#define op_READ_BLOCK_LIMITS   0x05

Definition at line 46 of file scsi_const.h.

#define op_READ_BUFFER   0x3c

Definition at line 103 of file scsi_const.h.

#define op_READ_CAPACITY   0x25

Definition at line 80 of file scsi_const.h.

#define op_READ_CARD_CAPACITY   (op_READ_CAPACITY)

Definition at line 81 of file scsi_const.h.

#define op_READ_DEFECT_DATA   0x37

Definition at line 98 of file scsi_const.h.

#define op_READ_ELEMENT_STATUS   0xb8

Definition at line 128 of file scsi_const.h.

#define op_READ_FORMAT_CAPACITIES   0x23

Definition at line 78 of file scsi_const.h.

#define op_READ_LONG   0x3e

Definition at line 105 of file scsi_const.h.

#define op_READ_POSITION   0x34

Definition at line 95 of file scsi_const.h.

#define op_READ_REVERSE   0x0F

Definition at line 56 of file scsi_const.h.

#define op_READ_TOC   0x43

Definition at line 109 of file scsi_const.h.

#define op_REASSIGN_BLOCKS   0x07

Definition at line 47 of file scsi_const.h.

#define op_RECEIVE_DIAGNOSTIC   0x1C

Definition at line 75 of file scsi_const.h.

#define op_RECOVER_BUFFERED_DATA   0x14

Definition at line 62 of file scsi_const.h.

#define op_RELEASE   0x17

Definition at line 66 of file scsi_const.h.

#define op_RELEASE_10   0x57

Definition at line 115 of file scsi_const.h.

#define op_RELEASE_ELEMENT   (op_RELEASE)

Definition at line 67 of file scsi_const.h.

#define op_REPORT_DENSITY_SUPPORT   0x44

Definition at line 110 of file scsi_const.h.

#define op_REQUEST_SENSE   0x03

Definition at line 42 of file scsi_const.h.

#define op_RESERVE   0x16

Definition at line 64 of file scsi_const.h.

#define op_RESERVE_10   0x56

Definition at line 114 of file scsi_const.h.

#define op_RESERVE_ELEMENT   (op_RESERVE)

Definition at line 65 of file scsi_const.h.

#define op_REWIND   (op_REZERO_UNIT)

Definition at line 41 of file scsi_const.h.

#define op_REZERO_UNIT   0x01

Definition at line 40 of file scsi_const.h.

#define op_SCAN   (op_START_STOP)

Definition at line 73 of file scsi_const.h.

#define op_SEARCH_EQUAL   0x31

Definition at line 91 of file scsi_const.h.

#define op_SEARCH_EQUAL_12   0xb1

Definition at line 126 of file scsi_const.h.

#define op_SEARCH_HIGH   0x30

Definition at line 90 of file scsi_const.h.

#define op_SEARCH_HIGH_12   0xb0

Definition at line 125 of file scsi_const.h.

#define op_SEARCH_LOW   0x32

Definition at line 92 of file scsi_const.h.

#define op_SEARCH_LOW_12   0xb2

Definition at line 127 of file scsi_const.h.

#define op_SEEK_10   0x2b

Definition at line 86 of file scsi_const.h.

#define op_SEEK_6   0x0B

Definition at line 54 of file scsi_const.h.

#define op_SEND   (op_WRITE_6)

Definition at line 51 of file scsi_const.h.

#define op_SEND_DIAGNOSTIC   0x1D

Definition at line 76 of file scsi_const.h.

#define op_SEND_MESSAGE   (op_WRITE_6)

Definition at line 52 of file scsi_const.h.

#define op_SEND_VOLUME_TAG   0xb6

Definition at line 129 of file scsi_const.h.

#define op_SET_LIMITS   0x33

Definition at line 93 of file scsi_const.h.

#define op_SET_WINDOW   0x24

Definition at line 79 of file scsi_const.h.

#define op_SLEW_AND_PRINT   (op_SEEK_6)

Definition at line 55 of file scsi_const.h.

#define op_SPACE   0x11

Definition at line 59 of file scsi_const.h.

#define op_START_STOP   0x1B

Definition at line 71 of file scsi_const.h.

#define op_STOP_PRINT   (op_START_STOP)

Definition at line 74 of file scsi_const.h.

#define op_SYNCHRONIZE_BUFFER   (op_WRITE_FILEMARKS)

Definition at line 58 of file scsi_const.h.

#define op_SYNCHRONIZE_CACHE   0x35

Definition at line 96 of file scsi_const.h.

#define op_TEST_UNIT_READY   0x00

Definition at line 39 of file scsi_const.h.

#define op_UPDATE_BLOCK   0x3d

Definition at line 104 of file scsi_const.h.

#define op_VERIFY_10   0x2f

Definition at line 89 of file scsi_const.h.

#define op_VERIFY_6   0x13

Definition at line 61 of file scsi_const.h.

#define op_WRITE_10   0x2a

Definition at line 85 of file scsi_const.h.

Referenced by scsi_LnxSG::DoIOCtl(), and scsi_IO::IOCtl().

#define op_WRITE_12   0xaa

Definition at line 123 of file scsi_const.h.

#define op_WRITE_6   0x0A

Definition at line 50 of file scsi_const.h.

Referenced by scsi_LnxSG::DoIOCtl(), and scsi_IO::IOCtl().

#define op_WRITE_ATTRIBUTE   0x8d

Definition at line 120 of file scsi_const.h.

#define op_WRITE_BUFFER   0x3b

Definition at line 102 of file scsi_const.h.

#define op_WRITE_FILEMARKS   0x10

Definition at line 57 of file scsi_const.h.

#define op_WRITE_LONG   0x3f

Definition at line 106 of file scsi_const.h.

#define op_WRITE_LONG_2   0xea

Definition at line 130 of file scsi_const.h.

#define op_WRITE_SAME   0x41

Definition at line 108 of file scsi_const.h.

#define op_WRITE_VERIFY   0x2e

Definition at line 88 of file scsi_const.h.

#define op_WRITE_VERIFY_12   0xae

Definition at line 124 of file scsi_const.h.

#define scsi_TIMEOUT_FOREVER_d   (UINT_MAX)

Definition at line 37 of file scsi_io.h.

#define scsi_TIMEOUT_FORMAT_d   (12*60*60*1000)

Definition at line 42 of file scsi_io.h.

Referenced by Append(), bea_TapeMedium::AppendVolume(), Fmt(), and bea_TapeMedium::Format().

#define scsi_TIMEOUT_LONG_d   (30*60*1000)

Definition at line 40 of file scsi_io.h.

Referenced by Inventory(), and la_SCSILibrary::Status().

#define scsi_TIMEOUT_LONGLONG_d   (200*60*1000)

Definition at line 41 of file scsi_io.h.

#define scsi_TIMEOUT_NORMAL_d   (20*60*1000)

Definition at line 39 of file scsi_io.h.

#define sns_DEFERRED   0x71

Definition at line 194 of file scsi_const.h.

Referenced by scsi_GetSenseText().

#define sns_NOT_DEFERRED   0x70

Definition at line 193 of file scsi_const.h.

Referenced by scsi_GetSenseText().

#define st_STATUS_MASK   0x3E

Definition at line 169 of file scsi_const.h.


Typedef Documentation

typedef set<UInt8_t> data_PageSet

Definition at line 40 of file data.h.

typedef UInt8_t scsi_UInt16_t[2]

Definition at line 61 of file scsi_types.h.

typedef UInt8_t scsi_UInt24_t[3]

Definition at line 62 of file scsi_types.h.

typedef UInt8_t scsi_UInt32_t[4]

Definition at line 63 of file scsi_types.h.


Enumeration Type Documentation

Enumerator:
TRANSFER_NONE 
TRANSFER_OUT 
TRANSFER_IN 
TRANSFER_INOUT 
TRANSFER_UNKNOWN 

Definition at line 65 of file cdb.h.

                 {
        TRANSFER_NONE   = -1,
        TRANSFER_OUT    = -2,
        TRANSFER_IN     = -3,
        TRANSFER_INOUT  = -4,
        TRANSFER_UNKNOWN= -5
    } Direction_e;

enum Mode_t
Enumerator:
mode_DDS 

DDS mode.

mode_AIT 

AIT mode.

Definition at line 42 of file data.h.

             {
    mode_DDS            = 0,
    mode_AIT            = 1
} Mode_t;

Enumerator:
dt_DISK 
dt_TAPE 
dt_PRINTER 
dt_PROCESSOR 
dt_WORM 
dt_ROM 
dt_SCANNER 
dt_MOD 
dt_MEDIUM_CHANGER 
dt_COMM 
dt_PRESS1 
dt_PRESS2 
dt_STORAGE_ARRAY 
dt_ENCLOSURE 
dt_RBC 
dt_OCRW 
dt_RESERVED2 
dt_OSD 
dt_NO_LUN 

Definition at line 199 of file scsi_const.h.

             {
    dt_DISK             = 0x00,
    dt_TAPE             = 0x01,
    dt_PRINTER          = 0x02,
    dt_PROCESSOR        = 0x03,    /* HP scanners use this */
    dt_WORM             = 0x04,    /* Treated as ROM by our system */
    dt_ROM              = 0x05,
    dt_SCANNER          = 0x06,
    dt_MOD              = 0x07,    /* Magneto-optical disk - treated as dt_DISK */
    dt_MEDIUM_CHANGER   = 0x08,
    dt_COMM             = 0x09,    /* Communications device */
    dt_PRESS1           = 0x0A,    /* Pre-press devices */
    dt_PRESS2           = 0x0B,
    dt_STORAGE_ARRAY    = 0x0C,
    dt_ENCLOSURE        = 0x0D,    /* Enclosure Services Device */
    dt_RBC              = 0x0E,    /* RBC Simplified direct-access device (e.g., magnetic disk) */
    dt_OCRW             = 0x0F,    /* OCRW Optical card reader/writer device */
    dt_RESERVED2        = 0x10,
    dt_OSD              = 0x11,    /* OSD Object-based Storage Device */
    dt_NO_LUN           = 0x7F
} scsi_DeviceType_e;

Enumerator:
sk_NO_SENSE 
sk_RECOVERED_ERROR 
sk_NOT_READY 
sk_MEDIUM_ERROR 
sk_HARDWARE_ERROR 
sk_ILLEGAL_REQUEST 
sk_UNIT_ATTENTION 
sk_DATA_PROTECT 
sk_BLANK_CHECK 
sk_VENDOR_SPECIFIC 
sk_COPY_ABORTED 
sk_ABORTED_COMMAND 
sk_OBSOLETE 
sk_VOLUME_OVERFLOW 
sk_MISCOMPARE 
sk_RESERVED 

Definition at line 174 of file scsi_const.h.

             {
    sk_NO_SENSE            = 0x00,
    sk_RECOVERED_ERROR     = 0x01,
    sk_NOT_READY           = 0x02,
    sk_MEDIUM_ERROR        = 0x03,
    sk_HARDWARE_ERROR      = 0x04,
    sk_ILLEGAL_REQUEST     = 0x05,
    sk_UNIT_ATTENTION      = 0x06,
    sk_DATA_PROTECT        = 0x07,
    sk_BLANK_CHECK         = 0x08,
    sk_VENDOR_SPECIFIC     = 0x09,
    sk_COPY_ABORTED        = 0x0A,
    sk_ABORTED_COMMAND     = 0x0B,
    sk_OBSOLETE            = 0x0C,
    sk_VOLUME_OVERFLOW     = 0x0D,
    sk_MISCOMPARE          = 0x0E,
    sk_RESERVED            = 0x0F
} scsi_SenseKey_e;

SCSI-3 status codes:

0x00 - GOOD 0x02 - CHECK CONDITION 0x04 - CONDITION MET 0x08 - BUSY 0x10 - INTERMEDIATE 0x14 - INTERMEDIATE-CONDITION MET 0x18 - RESERVATION CONFLICT 0x22 - COMMAND TERMINATED 0x28 - TASK SET FULL 0x30 - ACA ACTIVE

Linux SG: Use "sg_io_hdr_t.status" (not "sg_io_hdr_t.masked_status") byte and mask it with 0x3E to strip vendor specific bytes.

Enumerator:
st_GOOD 
st_CHECK_CONDITION 
st_CONDITION_GOOD 
st_BUSY 
st_INTERMEDIATE_GOOD 
st_INTERMEDIATE_C_GOOD 
st_RESERVATION_CONFLICT 
st_COMMAND_TERMINATED 
st_QUEUE_FULL 
st_ACA_ACTIVE 

Definition at line 156 of file scsi_const.h.

             {
    st_GOOD                 = 0x00,
    st_CHECK_CONDITION      = 0x02,
    st_CONDITION_GOOD       = 0x04,
    st_BUSY                 = 0x08,
    st_INTERMEDIATE_GOOD    = 0x10,
    st_INTERMEDIATE_C_GOOD  = 0x14,
    st_RESERVATION_CONFLICT = 0x18,
    st_COMMAND_TERMINATED   = 0x22,
    st_QUEUE_FULL           = 0x28,
    st_ACA_ACTIVE           = 0x30 // auto contingent allegiance
} scsi_Status_e;

Tape positioning command.

Enumerator:
spaceBlocks 
spaceFileMarks 
spaceEndOfData 
spaceSetMarks 

Definition at line 270 of file cdb.h.

                 {
    spaceBlocks         = 0x0,
    spaceFileMarks      = 0x1,
    spaceEndOfData      = 0x3,
    spaceSetMarks       = 0x4
};


Function Documentation

UInt8_t scsi_CommandSize ( UInt8_t  a_cdbCode  ) 

Definition at line 49 of file scsi_err.cpp.

Referenced by scsi_LnxSG::CheckDriverStatus(), scsi_LnxSG::CheckHostStatus(), and scsi_IO::IOCtl().

                                           {
    switch ((a_cdbCode >> 5) & 0x7) {
    case 0:
        return 6;
    case 1: case 2: case 6: case 7:
        return 10;
    case 3: case 5:
        return 12;
        break;
    case 4:
        return 16;
    default:
        return 10;
    }
}

Here is the caller graph for this function:

const string scsi_GetASCText ( const data_Sense_t a_sense,
const scsi_SenseVnd a_vndErr 
)

Definition at line 682 of file scsi_err.cpp.

References data_Sense_t::additionalLen, data_Sense_t::asc, data_Sense_t::ascq, cmn_Num2Str(), and scsi_GetSenseAdditional().

Referenced by scsi_IO::CheckStatusAndSense(), and scsi_IO::WaitToBecomeReady().

                                                                                         {

    // Additional qualifiers (+ FRU)
    if (a_sense.additionalLen > 6) {
        return
            string("[") + cmn_Num2Str(a_sense.asc, true) + string(",") +
            cmn_Num2Str(a_sense.ascq, true) + string("] ") +
            scsi_GetSenseAdditional(a_sense.asc, a_sense.ascq, a_vndErr);
    }
    else {
        static const string s_empty("");
        return s_empty;
    };

}

Here is the call graph for this function:

Here is the caller graph for this function:

IVD_SCSI_DECL_d const char* scsi_GetDeviceTypeText ( scsi_DeviceType_e  a_dt  ) 

Definition at line 97 of file scsi_err.cpp.

References dt_NO_LUN, scsi_DevType_t::m_dt, and scsi_DevType_t::m_text.

Referenced by la_SCSILibrary::EjectMedium(), scsi_IO::InqStandard(), main(), scsi_IO::Open(), la_SCSILibrary::Open(), bea_TapeDrive::Open(), scsi_DeviceList::Print(), and STapeOpen().

                                                           {
    for (int i = 0; ;i++) {
        const scsi_DevType_t &dtText = s_deviceType[i];
        if (dtText.m_dt == dt_NO_LUN ||dtText.m_dt == a_dt) {
            return dtText.m_text;
        }
    }
}

Here is the caller graph for this function:

const string scsi_GetOpcodeText ( UInt16_t  a_opcode  ) 

Definition at line 179 of file scsi_err.cpp.

References cmn_Num2Str(), s_grp0, s_grp1, s_grp2, s_grp4, s_grp5, s_reserved(), s_vendor(), and scsi_GROUP_m.

Referenced by scsi_LnxSG::CheckDriverStatus(), scsi_LnxSG::CheckHostStatus(), scsi_IO::CheckStatusAndSense(), and scsi_IO::IOCtl().

                                                   {
    const UInt32_t  group = scsi_GROUP_m(a_opcode);
    switch (group) {
        case 0: return string(s_grp0[a_opcode & 0x1F]) + string(" ") + cmn_Num2Str(a_opcode, true);
        case 1: return string(s_grp1[a_opcode & 0x1F]) + string(" ") + cmn_Num2Str(a_opcode, true);
        case 2: return string(s_grp2[a_opcode & 0x1F]) + string(" ") + cmn_Num2Str(a_opcode, true);
        case 3: return string(s_reserved) + string(" ") + cmn_Num2Str(a_opcode, true);
        case 4: return string(s_grp4[a_opcode & 0x1F]) + string(" ") + cmn_Num2Str(a_opcode, true);
        case 5: return string(s_grp5[a_opcode & 0x1F]) + string(" ") + cmn_Num2Str(a_opcode, true);
        case 6: return string(s_vendor) + string(" ") + cmn_Num2Str(a_opcode, true);
        case 7: return string(s_vendor) + string(" ") + cmn_Num2Str(a_opcode, true);
        default: return string("unknown") + string(" ") + cmn_Num2Str(a_opcode, true);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

const string scsi_GetSenseAdditional ( UInt8_t  a_asc,
UInt8_t  a_ascq,
const scsi_SenseVnd a_vndErr 
)

Definition at line 663 of file scsi_err.cpp.

References cmn_Num2Str(), scsi_SenseVnd::GetSenseText(), NULL, scsi_FindSenseText(), and scsi_IsVendorSpecificASC().

Referenced by data_ElementStatus::ParseElemStatus(), scsi_GetASCText(), and scsi_GetSenseText().

                                                                                                   {
    if (scsi_IsVendorSpecificASC(a_asc, a_ascq)) {
        if (a_vndErr == NULL) {
            // No device type specific sense code table
            ostringstream sstr;
            sstr
                << "Vendor specific ASC "
                << cmn_Num2Str(a_asc, true) << string(" ")
                << cmn_Num2Str(a_ascq, true);
            return sstr.str();
        }
        else {
            return a_vndErr->GetSenseText(a_asc, a_ascq);
        }
    }

    return scsi_FindSenseText(a_asc, a_ascq, s_senseAdditional);
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* scsi_GetSenseKeyText ( scsi_SenseKey_e  a_sense  ) 

Definition at line 249 of file scsi_err.cpp.

Referenced by scsi_IO::CheckStatusAndSense(), scsi_GetSenseText(), and scsi_IO::WaitToBecomeReady().

                                                             {
    return s_senseText[(int)a_senseKey].m_text;
}

Here is the caller graph for this function:

const string scsi_GetSenseText ( const data_Sense_t a_sense,
scsi_DeviceType_e  a_dt,
const scsi_SenseVnd a_vndErr 
)

Definition at line 711 of file scsi_err.cpp.

References data_Sense_t::additionalLen, data_Sense_t::ait, data_Sense_t::asc, data_Sense_t::ascq, data_FieldPointer_t::bitPtr, data_FieldPointer_t::bpv, data_FieldPointer_t::cd, data_AIT_Sense_t::clean, cmn_Num2Str(), data_RetryCount_t::count, dt_TAPE, data_Sense_t::eom, data_Sense_t::fileMark, data_FieldPointer_t::fldPtr, data_Sense_t::fPtr, data_Sense_t::fruCode, ie_IMPOSSIBLE, data_Sense_t::incorrectLength, data_Sense_t::infoBytes, data_Sense_t::isValid, data_AIT_Sense_t::mew, ntoh(), data_Progress_t::progress, data_Sense_t::progress, data_AIT_Sense_t::remainingTape, data_Sense_t::responseCode, data_Sense_t::retryCnt, data_AIT_Sense_t::rwErrorCnt, scsi_GetSenseAdditional(), scsi_GetSenseKeyText(), data_Sense_t::senseKey, sk_ABORTED_COMMAND, sk_BLANK_CHECK, sk_COPY_ABORTED, sk_DATA_PROTECT, sk_HARDWARE_ERROR, sk_ILLEGAL_REQUEST, sk_MEDIUM_ERROR, sk_MISCOMPARE, sk_NOT_READY, sk_OBSOLETE, sk_RECOVERED_ERROR, sk_RESERVED, sk_UNIT_ATTENTION, sk_VENDOR_SPECIFIC, sk_VOLUME_OVERFLOW, sns_DEFERRED, sns_NOT_DEFERRED, and data_FieldPointer_t::sskv.

Referenced by scsi_IO::CheckStatusAndSense(), and scsi_IO::WaitToBecomeReady().

                                                                                                                   {

    ostringstream snsTxt;

    snsTxt << endl;
    if (a_sense.responseCode == sns_NOT_DEFERRED) {
        snsTxt << "Current, ";
    }
    else if (a_sense.responseCode == sns_DEFERRED) {
        snsTxt << "Deferred, ";
    }
    else {
        snsTxt << "Unknown, ";
    }
    snsTxt
        << "(" << (int)a_sense.senseKey << ") "
        << scsi_GetSenseKeyText((scsi_SenseKey_e)a_sense.senseKey) << " ";

    if (a_sense.fileMark) snsTxt << "FM ";
    if (a_sense.eom) snsTxt << "EOM ";
    if (a_sense.incorrectLength) snsTxt << "ILI ";
    if (a_sense.isValid) {
        snsTxt << "INFO: " << hex << ntoh(a_sense.infoBytes) << " ";
    }

    if (a_sense.additionalLen > 7 && a_sense.fruCode > 0) {
        snsTxt << "FRU: " << (int)(a_sense.fruCode) << " ";
    }
    snsTxt << " ";

    // Command specific information (not displayed!)
    if (a_sense.additionalLen > 3) {
        // Empty
    }
    // Additional qualifiers (+ FRU)
    if (a_sense.additionalLen > 6) {
        snsTxt
            << "(" << cmn_Num2Str(a_sense.asc, true) << ", "
            <<        cmn_Num2Str(a_sense.ascq, true)  << ") "
            << scsi_GetSenseAdditional(a_sense.asc, a_sense.ascq, a_vndErr)
            << endl;
    }
    //Sense key specific
    if (a_sense.additionalLen > 9 && a_sense.fPtr.sskv != 0) {
        switch (a_sense.senseKey) {
            case sk_ILLEGAL_REQUEST:
            {
                if (a_sense.fPtr.cd == 0) {
                    snsTxt << "FPTR (DATA OUT)";
                }
                else {
                    snsTxt << "FPTR (COMMAND)";
                }
                scsi_Wrapper16 ptrW(a_sense.fPtr.fldPtr);
                snsTxt << ", byte: " << dec << ntoh(ptrW);
                if (a_sense.fPtr.bpv != 0) {
                    snsTxt << ", bit: " << (int)(a_sense.fPtr.bitPtr);
                }
                break;
            }
            case sk_NOT_READY:
            {
                scsi_Wrapper16 progressW(a_sense.progress.progress);
                snsTxt
                    << "PROGRESS (%): "
                    << (int)((ntoh(progressW) * 100) / 65536);
                break;
            }
            case sk_RECOVERED_ERROR:
            case sk_MEDIUM_ERROR:
            case sk_HARDWARE_ERROR:
            {
                scsi_Wrapper16 countW(a_sense.retryCnt.count);
                snsTxt << "RETRIES: " << ntoh(countW);
                break;
            }
            case sk_UNIT_ATTENTION:
            case sk_DATA_PROTECT:
            case sk_BLANK_CHECK:
            case sk_VENDOR_SPECIFIC:
            case sk_COPY_ABORTED:
            case sk_ABORTED_COMMAND:
            case sk_OBSOLETE:
            case sk_VOLUME_OVERFLOW:
            case sk_MISCOMPARE:
            case sk_RESERVED:
                break;
            default:
                throw ivd_InternalError(
                    ie_IMPOSSIBLE,
                    string("Impossible sense: ") +
                    string( scsi_GetSenseKeyText(
                        (scsi_SenseKey_e)a_sense.senseKey) ) );
                break;
        }
        snsTxt << endl;
    }
    if (a_dt == dt_TAPE) {
        // Additional sense bytes (Currently we display only AIT-2 codes)
        if (a_sense.additionalLen > 11) {
            if (a_sense.ait.rwErrorCnt > 0) {
                scsi_Wrapper32 errW(a_sense.ait.rwErrorCnt);
                snsTxt << "RW Error cnt : " << ntoh(errW) << " ";
            }
        }
        if (a_sense.additionalLen > 15) {
            scsi_Wrapper32 remW(a_sense.ait.remainingTape);
            snsTxt
                << "Remaining tape : " << ntoh(remW) << endl;
        }
        if (a_sense.additionalLen > 19) {
            if (a_sense.ait.clean != 0) {
                snsTxt << "CLEAN RQ ";
            }
            if (a_sense.ait.mew != 0) {
                snsTxt << "MEDIA WARNING ";
            }
        }
        snsTxt << endl;
    }

    return snsTxt.str();
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* scsi_GetStatusText ( scsi_Status_e  a_status  ) 

Definition at line 219 of file scsi_err.cpp.

References scsi_ErrDesc_t::m_text, and scsi_ErrDesc_t::st.

Referenced by scsi_IO::CheckStatusAndSense().

                                                       {
    for (int i = 0; ;i++) {
        const scsi_ErrDesc_t &stText = s_statusText[i];
        if (stText.st == 0xFF || a_status == stText.st) {
            return stText.m_text;
        }
    }
}

Here is the caller graph for this function:

const scsi_SenseVnd* scsi_GetVndAddSnsTbl ( const string &  a_vendor,
const string &  a_product 
)

Definition at line 623 of file scsi_err.cpp.

References dbg_DETAIL, dbg_NORM, log_DBG_m, log_FUNC_m, NULL, scsi_VndErrTable_t::product, scsi_GetVndAddSnsTbl(), scsi_VndErrTable_t::table, and scsi_VndErrTable_t::vendor.

Referenced by scsi_IO::InqStandard(), and scsi_GetVndAddSnsTbl().

                                                                                           {
    log_FUNC_m(scsi_GetVndAddSnsTbl);

    if (a_vendor.length() == 0 && a_product.length() == 0) {
            log_DBG_m(dbg_DETAIL, "Vendor/product not specified.");
            return NULL;
    }

    for (int i(0); ; ++i) {
        const scsi_VndErrTable_t& tbl(s_vndErrTable[i]);

        if (tbl.table == NULL) {
            log_DBG_m(dbg_DETAIL, "Error conversion table not found.");
            return NULL;
        }

        const char* vendor(tbl.vendor);
        const char* product(tbl.product);
        UInt32_t vndLen(strlen(vendor));
        UInt32_t prodLen(strlen(product));

        //
        // Compare only strings up to the length of the string in the
        // config file.
        //
        string subVendor(a_vendor.substr(0, vndLen) );
        string subProduct(a_product.substr(0, prodLen) );

        if (subVendor.compare(vendor) == 0 && subProduct.compare(product) == 0) {
            log_DBG_m(dbg_NORM,
                "Found error table entry: \'" << vendor << "\', \'" << product << "\'");

            return tbl.table;
        };
    }
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool scsi_IsVendorSpecificASC ( UInt8_t  a_asc,
UInt8_t  a_ascq 
)

Definition at line 698 of file scsi_err.cpp.

Referenced by data_ElementStatus::ParseElemStatus(), scsi_FindSenseText(), and scsi_GetSenseAdditional().

                                                             {
    if (a_asc >= 0x80) {
        return true;
    }
    else if (a_ascq >= 0x80) {
        return true;
    }
    else {
        return false;
    }
}

Here is the caller graph for this function: