|
smartmontools SVN Rev 3317
Utility to control and monitor storage systems with "S.M.A.R.T."
|
#include <stdio.h>#include <string.h>#include <errno.h>#include "config.h"#include "int64.h"#include "scsicmds.h"#include "atacmds.h"#include "dev_interface.h"#include "utility.h"
Go to the source code of this file.
Classes | |
| struct | scsi_opcode_name |
Defines | |
| #define | DEXCPT_ENABLE 0x08 |
| #define | EWASC_ENABLE 0x10 |
| #define | DEXCPT_DISABLE 0xf7 |
| #define | EWASC_DISABLE 0xef |
| #define | TEST_DISABLE 0xfb |
| #define | SCSI_IEC_MP_BYTE2_ENABLED 0x10 |
| #define | SCSI_IEC_MP_BYTE2_TEST_MASK 0x4 |
| #define | SCSI_IEC_MP_MRIE 6 |
| #define | SCSI_IEC_MP_INTERVAL_T 0 |
| #define | SCSI_IEC_MP_REPORT_COUNT 1 |
Functions | |
| void | dStrHex (const char *str, int len, int no_ascii) |
| const char * | scsi_get_opcode_name (UINT8 opcode) |
| void | scsi_do_sense_disect (const struct scsi_cmnd_io *io_buf, struct scsi_sense_disect *out) |
| int | scsiSimpleSenseFilter (const struct scsi_sense_disect *sinfo) |
| const char * | scsiErrString (int scsiErr) |
| int | scsi_vpd_dev_id_iter (const unsigned char *initial_desig_desc, int page_len, int *off, int m_assoc, int m_desig_type, int m_code_set) |
| int | scsi_decode_lu_dev_id (const unsigned char *b, int blen, char *s, int slen, int *transport) |
| int | scsiLogSense (scsi_device *device, int pagenum, int subpagenum, UINT8 *pBuf, int bufLen, int known_resp_len) |
| int | scsiLogSelect (scsi_device *device, int pcr, int sp, int pc, int pagenum, int subpagenum, UINT8 *pBuf, int bufLen) |
| int | scsiModeSense (scsi_device *device, int pagenum, int subpagenum, int pc, UINT8 *pBuf, int bufLen) |
| int | scsiModeSelect (scsi_device *device, int sp, UINT8 *pBuf, int bufLen) |
| int | scsiModeSense10 (scsi_device *device, int pagenum, int subpagenum, int pc, UINT8 *pBuf, int bufLen) |
| int | scsiModeSelect10 (scsi_device *device, int sp, UINT8 *pBuf, int bufLen) |
| int | scsiStdInquiry (scsi_device *device, UINT8 *pBuf, int bufLen) |
| int | scsiInquiryVpd (scsi_device *device, int vpd_page, UINT8 *pBuf, int bufLen) |
| int | scsiRequestSense (scsi_device *device, struct scsi_sense_disect *sense_info) |
| int | scsiSendDiagnostic (scsi_device *device, int functioncode, UINT8 *pBuf, int bufLen) |
| int | scsiReceiveDiagnostic (scsi_device *device, int pcv, int pagenum, UINT8 *pBuf, int bufLen) |
| static int | _testunitready (scsi_device *device, struct scsi_sense_disect *sinfo) |
| int | scsiTestUnitReady (scsi_device *device) |
| int | scsiReadDefect10 (scsi_device *device, int req_plist, int req_glist, int dl_format, UINT8 *pBuf, int bufLen) |
| int | scsiReadDefect12 (scsi_device *device, int req_plist, int req_glist, int dl_format, int addrDescIndex, UINT8 *pBuf, int bufLen) |
| int | scsiReadCapacity10 (scsi_device *device, unsigned int *last_lbap, unsigned int *lb_sizep) |
| int | scsiReadCapacity16 (scsi_device *device, UINT8 *pBuf, int bufLen) |
| uint64_t | scsiGetSize (scsi_device *device, unsigned int *lb_sizep, int *lb_per_pb_expp) |
| int | scsiGetProtPBInfo (scsi_device *device, unsigned char *rc16_12_31p) |
| int | scsiModePageOffset (const UINT8 *resp, int len, int modese_len) |
| int | scsiFetchIECmpage (scsi_device *device, struct scsi_iec_mode_page *iecp, int modese_len) |
| int | scsi_IsExceptionControlEnabled (const struct scsi_iec_mode_page *iecp) |
| int | scsi_IsWarningEnabled (const struct scsi_iec_mode_page *iecp) |
| int | scsiSetExceptionControlAndWarning (scsi_device *device, int enabled, const struct scsi_iec_mode_page *iecp) |
| int | scsiGetTemp (scsi_device *device, UINT8 *currenttemp, UINT8 *triptemp) |
| int | scsiCheckIE (scsi_device *device, int hasIELogPage, int hasTempLogPage, UINT8 *asc, UINT8 *ascq, UINT8 *currenttemp, UINT8 *triptemp) |
| const char * | scsiTapeAlertsTapeDevice (unsigned short code) |
| const char * | scsiTapeAlertsChangerDevice (unsigned short code) |
| const char * | scsiGetIEString (UINT8 asc, UINT8 ascq) |
| int | scsiSmartIBMOfflineTest (scsi_device *device) |
| int | scsiSmartDefaultSelfTest (scsi_device *device) |
| int | scsiSmartShortSelfTest (scsi_device *device) |
| int | scsiSmartExtendSelfTest (scsi_device *device) |
| int | scsiSmartShortCapSelfTest (scsi_device *device) |
| int | scsiSmartExtendCapSelfTest (scsi_device *device) |
| int | scsiSmartSelfTestAbort (scsi_device *device) |
| int | scsiFetchExtendedSelfTestTime (scsi_device *device, int *durationSec, int modese_len) |
| void | scsiDecodeErrCounterPage (unsigned char *resp, struct scsiErrorCounter *ecp) |
| void | scsiDecodeNonMediumErrPage (unsigned char *resp, struct scsiNonMediumError *nmep) |
| int | scsiCountFailedSelfTests (scsi_device *fd, int noisy) |
| int | scsiSelfTestInProgress (scsi_device *fd, int *inProgress) |
| int | scsiFetchControlGLTSD (scsi_device *device, int modese_len, int current) |
| int | scsiGetRPM (scsi_device *device, int modese_len, int *form_factorp) |
| int | scsiGetSetCache (scsi_device *device, int modese_len, short int *wcep, short int *rcdp) |
| int | scsiSetControlGLTSD (scsi_device *device, int enabled, int modese_len) |
| int | scsiFetchTransportProtocol (scsi_device *device, int modese_len) |
| const unsigned char * | sg_scsi_sense_desc_find (const unsigned char *sensep, int sense_len, int desc_type) |
| void | scsi_format_id_string (char *out, const unsigned char *in, int n) |
Variables | |
| const char * | scsicmds_c_cvsid |
| unsigned char | scsi_debugmode = 0 |
| supported_vpd_pages * | supported_vpd_pages_p = NULL |
| static struct scsi_opcode_name | opcode_name_arr [] |
| static const char * | vendor_specific = "<vendor specific>" |
| static const char * | TapeAlertsMessageTable [] |
| static const char * | ChangerTapeAlertsMessageTable [] |
| static const char * | strs_for_asc_5d [] |
| static const char * | strs_for_asc_b [] |
| static char | spare_buff [128] |
| #define DEXCPT_DISABLE 0xf7 |
Definition at line 1324 of file scsicmds.cpp.
| #define DEXCPT_ENABLE 0x08 |
Definition at line 1322 of file scsicmds.cpp.
| #define EWASC_DISABLE 0xef |
Definition at line 1325 of file scsicmds.cpp.
| #define EWASC_ENABLE 0x10 |
Definition at line 1323 of file scsicmds.cpp.
| #define SCSI_IEC_MP_BYTE2_ENABLED 0x10 |
Definition at line 1413 of file scsicmds.cpp.
| #define SCSI_IEC_MP_BYTE2_TEST_MASK 0x4 |
Definition at line 1414 of file scsicmds.cpp.
| #define SCSI_IEC_MP_INTERVAL_T 0 |
Definition at line 1417 of file scsicmds.cpp.
| #define SCSI_IEC_MP_MRIE 6 |
Definition at line 1416 of file scsicmds.cpp.
| #define SCSI_IEC_MP_REPORT_COUNT 1 |
Definition at line 1418 of file scsicmds.cpp.
| #define TEST_DISABLE 0xfb |
Definition at line 1326 of file scsicmds.cpp.
| static int _testunitready | ( | scsi_device * | device, |
| struct scsi_sense_disect * | sinfo | ||
| ) | [static] |
Definition at line 1027 of file scsicmds.cpp.
| void dStrHex | ( | const char * | str, |
| int | len, | ||
| int | no_ascii | ||
| ) |
Definition at line 90 of file scsicmds.cpp.
| int scsi_decode_lu_dev_id | ( | const unsigned char * | b, |
| int | blen, | ||
| char * | s, | ||
| int | slen, | ||
| int * | transport | ||
| ) |
Definition at line 329 of file scsicmds.cpp.
| void scsi_do_sense_disect | ( | const struct scsi_cmnd_io * | io_buf, |
| struct scsi_sense_disect * | out | ||
| ) |
Definition at line 194 of file scsicmds.cpp.
| void scsi_format_id_string | ( | char * | out, |
| const unsigned char * | in, | ||
| int | n | ||
| ) |
Definition at line 2755 of file scsicmds.cpp.
| const char* scsi_get_opcode_name | ( | UINT8 | opcode | ) |
Definition at line 175 of file scsicmds.cpp.
| int scsi_IsExceptionControlEnabled | ( | const struct scsi_iec_mode_page * | iecp | ) |
Definition at line 1381 of file scsicmds.cpp.
| int scsi_IsWarningEnabled | ( | const struct scsi_iec_mode_page * | iecp | ) |
Definition at line 1397 of file scsicmds.cpp.
| int scsi_vpd_dev_id_iter | ( | const unsigned char * | initial_desig_desc, |
| int | page_len, | ||
| int * | off, | ||
| int | m_assoc, | ||
| int | m_desig_type, | ||
| int | m_code_set | ||
| ) |
Definition at line 300 of file scsicmds.cpp.
| int scsiCheckIE | ( | scsi_device * | device, |
| int | hasIELogPage, | ||
| int | hasTempLogPage, | ||
| UINT8 * | asc, | ||
| UINT8 * | ascq, | ||
| UINT8 * | currenttemp, | ||
| UINT8 * | triptemp | ||
| ) |
Definition at line 1527 of file scsicmds.cpp.
| int scsiCountFailedSelfTests | ( | scsi_device * | fd, |
| int | noisy | ||
| ) |
Definition at line 2368 of file scsicmds.cpp.
| void scsiDecodeErrCounterPage | ( | unsigned char * | resp, |
| struct scsiErrorCounter * | ecp | ||
| ) |
Definition at line 2243 of file scsicmds.cpp.
| void scsiDecodeNonMediumErrPage | ( | unsigned char * | resp, |
| struct scsiNonMediumError * | nmep | ||
| ) |
Definition at line 2290 of file scsicmds.cpp.
| const char* scsiErrString | ( | int | scsiErr | ) |
Definition at line 256 of file scsicmds.cpp.
| int scsiFetchControlGLTSD | ( | scsi_device * | device, |
| int | modese_len, | ||
| int | current | ||
| ) |
Definition at line 2446 of file scsicmds.cpp.
| int scsiFetchExtendedSelfTestTime | ( | scsi_device * | device, |
| int * | durationSec, | ||
| int | modese_len | ||
| ) |
Definition at line 2205 of file scsicmds.cpp.
| int scsiFetchIECmpage | ( | scsi_device * | device, |
| struct scsi_iec_mode_page * | iecp, | ||
| int | modese_len | ||
| ) |
Definition at line 1334 of file scsicmds.cpp.
| int scsiFetchTransportProtocol | ( | scsi_device * | device, |
| int | modese_len | ||
| ) |
Definition at line 2694 of file scsicmds.cpp.
Definition at line 2081 of file scsicmds.cpp.
| int scsiGetProtPBInfo | ( | scsi_device * | device, |
| unsigned char * | rc16_12_31p | ||
| ) |
Definition at line 1272 of file scsicmds.cpp.
| int scsiGetRPM | ( | scsi_device * | device, |
| int | modese_len, | ||
| int * | form_factorp | ||
| ) |
Definition at line 2481 of file scsicmds.cpp.
| int scsiGetSetCache | ( | scsi_device * | device, |
| int | modese_len, | ||
| short int * | wcep, | ||
| short int * | rcdp | ||
| ) |
Definition at line 2522 of file scsicmds.cpp.
| uint64_t scsiGetSize | ( | scsi_device * | device, |
| unsigned int * | lb_sizep, | ||
| int * | lb_per_pb_expp | ||
| ) |
Definition at line 1227 of file scsicmds.cpp.
| int scsiGetTemp | ( | scsi_device * | device, |
| UINT8 * | currenttemp, | ||
| UINT8 * | triptemp | ||
| ) |
Definition at line 1504 of file scsicmds.cpp.
| int scsiInquiryVpd | ( | scsi_device * | device, |
| int | vpd_page, | ||
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 813 of file scsicmds.cpp.
| int scsiLogSelect | ( | scsi_device * | device, |
| int | pcr, | ||
| int | sp, | ||
| int | pc, | ||
| int | pagenum, | ||
| int | subpagenum, | ||
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 548 of file scsicmds.cpp.
| int scsiLogSense | ( | scsi_device * | device, |
| int | pagenum, | ||
| int | subpagenum, | ||
| UINT8 * | pBuf, | ||
| int | bufLen, | ||
| int | known_resp_len | ||
| ) |
Definition at line 455 of file scsicmds.cpp.
| int scsiModePageOffset | ( | const UINT8 * | resp, |
| int | len, | ||
| int | modese_len | ||
| ) |
Definition at line 1291 of file scsicmds.cpp.
| int scsiModeSelect | ( | scsi_device * | device, |
| int | sp, | ||
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 640 of file scsicmds.cpp.
| int scsiModeSelect10 | ( | scsi_device * | device, |
| int | sp, | ||
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 737 of file scsicmds.cpp.
| int scsiModeSense | ( | scsi_device * | device, |
| int | pagenum, | ||
| int | subpagenum, | ||
| int | pc, | ||
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 584 of file scsicmds.cpp.
| int scsiModeSense10 | ( | scsi_device * | device, |
| int | pagenum, | ||
| int | subpagenum, | ||
| int | pc, | ||
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 682 of file scsicmds.cpp.
| int scsiReadCapacity10 | ( | scsi_device * | device, |
| unsigned int * | last_lbap, | ||
| unsigned int * | lb_sizep | ||
| ) |
Definition at line 1151 of file scsicmds.cpp.
| int scsiReadCapacity16 | ( | scsi_device * | device, |
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 1193 of file scsicmds.cpp.
| int scsiReadDefect10 | ( | scsi_device * | device, |
| int | req_plist, | ||
| int | req_glist, | ||
| int | dl_format, | ||
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 1077 of file scsicmds.cpp.
| int scsiReadDefect12 | ( | scsi_device * | device, |
| int | req_plist, | ||
| int | req_glist, | ||
| int | dl_format, | ||
| int | addrDescIndex, | ||
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 1111 of file scsicmds.cpp.
| int scsiReceiveDiagnostic | ( | scsi_device * | device, |
| int | pcv, | ||
| int | pagenum, | ||
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 995 of file scsicmds.cpp.
| int scsiRequestSense | ( | scsi_device * | device, |
| struct scsi_sense_disect * | sense_info | ||
| ) |
Definition at line 875 of file scsicmds.cpp.
| int scsiSelfTestInProgress | ( | scsi_device * | fd, |
| int * | inProgress | ||
| ) |
Definition at line 2418 of file scsicmds.cpp.
| int scsiSendDiagnostic | ( | scsi_device * | device, |
| int | functioncode, | ||
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 956 of file scsicmds.cpp.
| int scsiSetControlGLTSD | ( | scsi_device * | device, |
| int | enabled, | ||
| int | modese_len | ||
| ) |
Definition at line 2624 of file scsicmds.cpp.
| int scsiSetExceptionControlAndWarning | ( | scsi_device * | device, |
| int | enabled, | ||
| const struct scsi_iec_mode_page * | iecp | ||
| ) |
Definition at line 1428 of file scsicmds.cpp.
| int scsiSimpleSenseFilter | ( | const struct scsi_sense_disect * | sinfo | ) |
Definition at line 218 of file scsicmds.cpp.
| int scsiSmartDefaultSelfTest | ( | scsi_device * | device | ) |
Definition at line 2135 of file scsicmds.cpp.
| int scsiSmartExtendCapSelfTest | ( | scsi_device * | device | ) |
Definition at line 2180 of file scsicmds.cpp.
| int scsiSmartExtendSelfTest | ( | scsi_device * | device | ) |
Definition at line 2157 of file scsicmds.cpp.
| int scsiSmartIBMOfflineTest | ( | scsi_device * | device | ) |
Definition at line 2113 of file scsicmds.cpp.
| int scsiSmartSelfTestAbort | ( | scsi_device * | device | ) |
Definition at line 2192 of file scsicmds.cpp.
| int scsiSmartShortCapSelfTest | ( | scsi_device * | device | ) |
Definition at line 2169 of file scsicmds.cpp.
| int scsiSmartShortSelfTest | ( | scsi_device * | device | ) |
Definition at line 2146 of file scsicmds.cpp.
| int scsiStdInquiry | ( | scsi_device * | device, |
| UINT8 * | pBuf, | ||
| int | bufLen | ||
| ) |
Definition at line 779 of file scsicmds.cpp.
| const char* scsiTapeAlertsChangerDevice | ( | unsigned short | code | ) |
Definition at line 1946 of file scsicmds.cpp.
| const char* scsiTapeAlertsTapeDevice | ( | unsigned short | code | ) |
Definition at line 1810 of file scsicmds.cpp.
| int scsiTestUnitReady | ( | scsi_device * | device | ) |
Definition at line 1054 of file scsicmds.cpp.
| const unsigned char* sg_scsi_sense_desc_find | ( | const unsigned char * | sensep, |
| int | sense_len, | ||
| int | desc_type | ||
| ) |
Definition at line 2728 of file scsicmds.cpp.
const char* ChangerTapeAlertsMessageTable[] [static] |
Definition at line 1819 of file scsicmds.cpp.
struct scsi_opcode_name opcode_name_arr[] [static] |
{
{TEST_UNIT_READY, "test unit ready"},
{REQUEST_SENSE, "request sense"},
{INQUIRY, "inquiry"},
{MODE_SELECT, "mode select(6)"},
{MODE_SENSE, "mode sense(6)"},
{START_STOP_UNIT, "start stop unit"},
{RECEIVE_DIAGNOSTIC, "receive diagnostic"},
{SEND_DIAGNOSTIC, "send diagnostic"},
{READ_CAPACITY_10, "read capacity(10)"},
{READ_DEFECT_10, "read defect list(10)"},
{LOG_SELECT, "log select"},
{LOG_SENSE, "log sense"},
{MODE_SELECT_10, "mode select(10)"},
{MODE_SENSE_10, "mode sense(10)"},
{SAT_ATA_PASSTHROUGH_16, "ata pass-through(16)"},
{READ_CAPACITY_16, "read capacity(16)"},
{REPORT_LUNS, "report luns"},
{SAT_ATA_PASSTHROUGH_12, "ata pass-through(12)"},
{READ_DEFECT_12, "read defect list(12)"},
}
Definition at line 147 of file scsicmds.cpp.
| unsigned char scsi_debugmode = 0 |
Definition at line 55 of file scsicmds.cpp.
| const char* scsicmds_c_cvsid |
"$Id: scsicmds.cpp 3807 2013-04-18 17:11:12Z chrfranke $" SCSICMDS_H_CVSID
Definition at line 51 of file scsicmds.cpp.
char spare_buff[128] [static] |
Definition at line 2078 of file scsicmds.cpp.
const char* strs_for_asc_5d[] [static] |
Definition at line 1958 of file scsicmds.cpp.
const char* strs_for_asc_b[] [static] |
{
"WARNING",
"WARNING - SPECIFIED TEMPERATURE EXCEEDED",
"WARNING - ENCLOSURE DEGRADED"}
Definition at line 2073 of file scsicmds.cpp.
Definition at line 57 of file scsicmds.cpp.
const char* TapeAlertsMessageTable[] [static] |
Definition at line 1585 of file scsicmds.cpp.
const char* vendor_specific = "<vendor specific>" [static] |
Definition at line 170 of file scsicmds.cpp.
1.7.4