smartmontools  SVN Rev 5304
Utility to control and monitor storage systems with "S.M.A.R.T."
Classes | Macros | Enumerations | Functions | Variables
atacmds.h File Reference
#include "dev_interface.h"
#include "static_assert.h"
Include dependency graph for atacmds.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ata_identify_device
 
struct  ata_smart_attribute
 
struct  ata_smart_values
 
struct  ata_smart_threshold_entry
 
struct  ata_smart_thresholds_pvt
 
struct  ata_smart_errorlog_error_struct
 
struct  ata_smart_errorlog_command_struct
 
struct  ata_smart_errorlog_struct
 
struct  ata_smart_errorlog
 
struct  ata_smart_exterrlog_command
 
struct  ata_smart_exterrlog_error
 
struct  ata_smart_exterrlog_error_log
 
struct  ata_smart_exterrlog
 
struct  ata_smart_selftestlog_struct
 
struct  ata_smart_selftestlog
 
struct  ata_smart_extselftestlog_desc
 
struct  ata_smart_extselftestlog
 
struct  ata_smart_log_entry
 
struct  ata_smart_log_directory
 
struct  test_span
 
struct  ata_selective_self_test_log
 
struct  ata_sct_status_response
 
struct  ata_sct_error_recovery_control_command
 
struct  ata_sct_feature_control_command
 
struct  ata_sct_data_table_command
 
struct  ata_sct_temperature_history_table
 
struct  ata_selective_selftest_args
 
struct  ata_selective_selftest_args::span_args
 
class  ata_vendor_attr_defs
 
struct  ata_vendor_attr_defs::entry
 
class  firmwarebug_defs
 
struct  ata_size_info
 

Macros

#define ATACMDS_H_CVSID   "$Id: atacmds.h 5166 2021-01-15 18:02:19Z chrfranke $"
 
#define ATTR_PACKED
 
#define ATA_CHECK_POWER_MODE   0xe5
 
#define ATA_IDENTIFY_DEVICE   0xec
 
#define ATA_IDENTIFY_PACKET_DEVICE   0xa1
 
#define ATA_IDLE   0xe3
 
#define ATA_SMART_CMD   0xb0
 
#define ATA_SECURITY_FREEZE_LOCK   0xf5
 
#define ATA_SET_FEATURES   0xef
 
#define ATA_STANDBY   0xe2
 
#define ATA_STANDBY_IMMEDIATE   0xe0
 
#define ATA_DISABLE_AAM   0xc2
 
#define ATA_DISABLE_APM   0x85
 
#define ATA_DISABLE_WRITE_CACHE   0x82
 
#define ATA_DISABLE_READ_LOOK_AHEAD   0x55
 
#define ATA_ENABLE_AAM   0x42
 
#define ATA_ENABLE_APM   0x05
 
#define ATA_ENABLE_WRITE_CACHE   0x02
 
#define ATA_ENABLE_READ_LOOK_AHEAD   0xaa
 
#define ATA_ENABLE_DISABLE_DSN   0x63
 
#define ATA_READ_LOG_EXT   0x2F
 
#define ATA_WRITE_LOG_EXT   0x3f
 
#define ATA_SMART_READ_VALUES   0xd0
 
#define ATA_SMART_READ_THRESHOLDS   0xd1
 
#define ATA_SMART_AUTOSAVE   0xd2
 
#define ATA_SMART_SAVE   0xd3
 
#define ATA_SMART_IMMEDIATE_OFFLINE   0xd4
 
#define ATA_SMART_READ_LOG_SECTOR   0xd5
 
#define ATA_SMART_WRITE_LOG_SECTOR   0xd6
 
#define ATA_SMART_WRITE_THRESHOLDS   0xd7
 
#define ATA_SMART_ENABLE   0xd8
 
#define ATA_SMART_DISABLE   0xd9
 
#define ATA_SMART_STATUS   0xda
 
#define ATA_SMART_AUTO_OFFLINE   0xdb
 
#define OFFLINE_FULL_SCAN   0
 
#define SHORT_SELF_TEST   1
 
#define EXTEND_SELF_TEST   2
 
#define CONVEYANCE_SELF_TEST   3
 
#define SELECTIVE_SELF_TEST   4
 
#define ABORT_SELF_TEST   127
 
#define SHORT_CAPTIVE_SELF_TEST   129
 
#define EXTEND_CAPTIVE_SELF_TEST   130
 
#define CONVEYANCE_CAPTIVE_SELF_TEST   131
 
#define SELECTIVE_CAPTIVE_SELF_TEST   132
 
#define CAPTIVE_MASK   (0x01<<7)
 
#define NUMBER_ATA_SMART_ATTRIBUTES   30
 
#define ATTRIBUTE_FLAGS_PREFAILURE(x)   (x & 0x01)
 
#define ATTRIBUTE_FLAGS_ONLINE(x)   (x & 0x02)
 
#define ATTRIBUTE_FLAGS_PERFORMANCE(x)   (x & 0x04)
 
#define ATTRIBUTE_FLAGS_ERRORRATE(x)   (x & 0x08)
 
#define ATTRIBUTE_FLAGS_EVENTCOUNT(x)   (x & 0x10)
 
#define ATTRIBUTE_FLAGS_SELFPRESERVING(x)   (x & 0x20)
 
#define ATTRIBUTE_FLAGS_OTHER(x)   ((x) & 0xffc0)
 
#define SELECTIVE_FLAG_DOSCAN   (0x0002)
 
#define SELECTIVE_FLAG_PENDING   (0x0008)
 
#define SELECTIVE_FLAG_ACTIVE   (0x0010)
 
#define MAX_ATTRIBUTE_NUM   256
 

Enumerations

enum  smart_command_set {
  ENABLE , DISABLE , AUTOSAVE , IMMEDIATE_OFFLINE ,
  AUTO_OFFLINE , STATUS , STATUS_CHECK , READ_VALUES ,
  READ_THRESHOLDS , READ_LOG , IDENTIFY , PIDENTIFY ,
  CHECK_POWER_MODE , WRITE_LOG
}
 
enum  { SEL_RANGE , SEL_REDO , SEL_NEXT , SEL_CONT }
 
enum  ata_vendor_def_prior { PRIOR_DEFAULT , PRIOR_DATABASE , PRIOR_USER }
 
enum  ata_attr_raw_format {
  RAWFMT_DEFAULT , RAWFMT_RAW8 , RAWFMT_RAW16 , RAWFMT_RAW48 ,
  RAWFMT_HEX48 , RAWFMT_RAW56 , RAWFMT_HEX56 , RAWFMT_RAW64 ,
  RAWFMT_HEX64 , RAWFMT_RAW16_OPT_RAW16 , RAWFMT_RAW16_OPT_AVG16 , RAWFMT_RAW24_OPT_RAW8 ,
  RAWFMT_RAW24_DIV_RAW24 , RAWFMT_RAW24_DIV_RAW32 , RAWFMT_SEC2HOUR , RAWFMT_MIN2HOUR ,
  RAWFMT_HALFMIN2HOUR , RAWFMT_MSEC24_HOUR32 , RAWFMT_TEMPMINMAX , RAWFMT_TEMP10X
}
 
enum  {
  ATTRFLAG_INCREASING = 0x01 , ATTRFLAG_NO_NORMVAL = 0x02 , ATTRFLAG_NO_WORSTVAL = 0x04 , ATTRFLAG_HDD_ONLY = 0x08 ,
  ATTRFLAG_SSD_ONLY = 0x10
}
 
enum  firmwarebug_t {
  BUG_NONE = 0 , BUG_NOLOGDIR , BUG_SAMSUNG , BUG_SAMSUNG2 ,
  BUG_SAMSUNG3 , BUG_XERRORLBA
}
 
enum  ata_attr_state {
  ATTRSTATE_NON_EXISTING , ATTRSTATE_NO_NORMVAL , ATTRSTATE_NO_THRESHOLD , ATTRSTATE_OK ,
  ATTRSTATE_FAILED_PAST , ATTRSTATE_FAILED_NOW
}
 

Functions

 STATIC_ASSERT (sizeof(ata_identify_device)==512)
 
 STATIC_ASSERT (sizeof(ata_smart_attribute)==12)
 
 STATIC_ASSERT (sizeof(ata_smart_values)==512)
 
 STATIC_ASSERT (sizeof(ata_smart_threshold_entry)==12)
 
 STATIC_ASSERT (sizeof(ata_smart_thresholds_pvt)==512)
 
 STATIC_ASSERT (sizeof(ata_smart_errorlog_error_struct)==30)
 
 STATIC_ASSERT (sizeof(ata_smart_errorlog_command_struct)==12)
 
 STATIC_ASSERT (sizeof(ata_smart_errorlog_struct)==90)
 
 STATIC_ASSERT (sizeof(ata_smart_errorlog)==512)
 
 STATIC_ASSERT (sizeof(ata_smart_exterrlog_command)==18)
 
 STATIC_ASSERT (sizeof(ata_smart_exterrlog_error)==34)
 
 STATIC_ASSERT (sizeof(ata_smart_exterrlog_error_log)==124)
 
 STATIC_ASSERT (sizeof(ata_smart_exterrlog)==512)
 
 STATIC_ASSERT (sizeof(ata_smart_selftestlog_struct)==24)
 
 STATIC_ASSERT (sizeof(ata_smart_selftestlog)==512)
 
 STATIC_ASSERT (sizeof(ata_smart_extselftestlog_desc)==26)
 
 STATIC_ASSERT (sizeof(ata_smart_extselftestlog)==512)
 
 STATIC_ASSERT (sizeof(ata_smart_log_entry)==2)
 
 STATIC_ASSERT (sizeof(ata_smart_log_directory)==512)
 
 STATIC_ASSERT (sizeof(test_span)==16)
 
 STATIC_ASSERT (sizeof(ata_selective_self_test_log)==512)
 
 STATIC_ASSERT (sizeof(ata_sct_status_response)==512)
 
 STATIC_ASSERT (sizeof(ata_sct_error_recovery_control_command)==512)
 
 STATIC_ASSERT (sizeof(ata_sct_feature_control_command)==512)
 
 STATIC_ASSERT (sizeof(ata_sct_data_table_command)==512)
 
 STATIC_ASSERT (sizeof(ata_sct_temperature_history_table)==512)
 
int ata_read_identity (ata_device *device, ata_identify_device *buf, bool fix_swapped_id, unsigned char *raw_buf=0)
 
int ataCheckPowerMode (ata_device *device)
 
bool ata_nodata_command (ata_device *device, unsigned char command, int sector_count=-1)
 
bool ata_set_features (ata_device *device, unsigned char features, int sector_count=-1)
 
int ataReadSmartValues (ata_device *device, struct ata_smart_values *)
 
int ataReadSmartThresholds (ata_device *device, struct ata_smart_thresholds_pvt *)
 
int ataReadErrorLog (ata_device *device, ata_smart_errorlog *data, firmwarebug_defs firmwarebugs)
 
int ataReadSelfTestLog (ata_device *device, ata_smart_selftestlog *data, firmwarebug_defs firmwarebugs)
 
int ataReadSelectiveSelfTestLog (ata_device *device, struct ata_selective_self_test_log *data)
 
int ataReadLogDirectory (ata_device *device, ata_smart_log_directory *, bool gpl)
 
bool ataWriteLogExt (ata_device *device, unsigned char logaddr, unsigned page, void *data, unsigned nsectors)
 
bool ataReadLogExt (ata_device *device, unsigned char logaddr, unsigned char features, unsigned page, void *data, unsigned nsectors)
 
bool ataReadSmartLog (ata_device *device, unsigned char logaddr, void *data, unsigned nsectors)
 
bool ataReadExtErrorLog (ata_device *device, ata_smart_exterrlog *log, unsigned page, unsigned nsectors, firmwarebug_defs firmwarebugs)
 
bool ataReadExtSelfTestLog (ata_device *device, ata_smart_extselftestlog *log, unsigned nsectors)
 
int ataReadSCTStatus (ata_device *device, ata_sct_status_response *sts)
 
int ataReadSCTTempHist (ata_device *device, ata_sct_temperature_history_table *tmh, ata_sct_status_response *sts)
 
int ataSetSCTTempInterval (ata_device *device, unsigned interval, bool persistent)
 
int ataGetSCTErrorRecoveryControltime (ata_device *device, unsigned type, unsigned short &time_limit, bool power_on)
 
int ataSetSCTErrorRecoveryControltime (ata_device *device, unsigned type, unsigned short time_limit, bool power_on, bool mfg_default)
 
int ataEnableSmart (ata_device *device)
 
int ataDisableSmart (ata_device *device)
 
int ataEnableAutoSave (ata_device *device)
 
int ataDisableAutoSave (ata_device *device)
 
int ataEnableAutoOffline (ata_device *device)
 
int ataDisableAutoOffline (ata_device *device)
 
int ataSmartTest (ata_device *device, int testtype, bool force, const ata_selective_selftest_args &args, const ata_smart_values *sv, uint64_t num_sectors)
 
int ataWriteSelectiveSelfTestLog (ata_device *device, ata_selective_selftest_args &args, const ata_smart_values *sv, uint64_t num_sectors, const ata_selective_selftest_args *prev_spans=0)
 
int ata_get_wwn (const ata_identify_device *id, unsigned &oui, uint64_t &unique_id)
 
int ata_get_rotation_rate (const ata_identify_device *id)
 
int ataDoesSmartWork (ata_device *device)
 
int ataSmartSupport (const ata_identify_device *drive)
 
int ataGetSetSCTWriteCacheReordering (ata_device *device, bool enable, bool persistent, bool set)
 
int ataGetSetSCTWriteCache (ata_device *device, unsigned short state, bool persistent, bool set)
 
int ataIsSmartEnabled (const ata_identify_device *drive)
 
int ataSmartStatus2 (ata_device *device)
 
bool isSmartErrorLogCapable (const ata_smart_values *data, const ata_identify_device *identity)
 
bool isSmartTestLogCapable (const ata_smart_values *data, const ata_identify_device *identity)
 
bool isGeneralPurposeLoggingCapable (const ata_identify_device *identity)
 
bool isSupportExecuteOfflineImmediate (const ata_smart_values *data)
 
bool isSupportAutomaticTimer (const ata_smart_values *data)
 
bool isSupportOfflineAbort (const ata_smart_values *data)
 
bool isSupportOfflineSurfaceScan (const ata_smart_values *data)
 
bool isSupportSelfTest (const ata_smart_values *data)
 
bool isSupportConveyanceSelfTest (const ata_smart_values *data)
 
bool isSupportSelectiveSelfTest (const ata_smart_values *data)
 
bool isSCTCapable (const ata_identify_device *drive)
 
bool isSCTErrorRecoveryControlCapable (const ata_identify_device *drive)
 
bool isSCTFeatureControlCapable (const ata_identify_device *drive)
 
bool isSCTDataTableCapable (const ata_identify_device *drive)
 
int TestTime (const ata_smart_values *data, int testtype)
 
ata_attr_state ata_get_attr_state (const ata_smart_attribute &attr, int attridx, const ata_smart_threshold_entry *thresholds, const ata_vendor_attr_defs &defs, unsigned char *threshval=0)
 
uint64_t ata_get_attr_raw_value (const ata_smart_attribute &attr, const ata_vendor_attr_defs &defs)
 
std::string ata_format_attr_raw_value (const ata_smart_attribute &attr, const ata_vendor_attr_defs &defs)
 
std::string ata_get_smart_attr_name (unsigned char id, const ata_vendor_attr_defs &defs, int rpm=0)
 
void checksumwarning (const char *string)
 
int ata_find_attr_index (unsigned char id, const ata_smart_values &smartval)
 
unsigned char ata_return_temperature_value (const ata_smart_values *data, const ata_vendor_attr_defs &defs)
 
bool parse_attribute_def (const char *opt, ata_vendor_attr_defs &defs, ata_vendor_def_prior priority)
 
unsigned char get_unc_attr_id (bool offline, const ata_vendor_attr_defs &defs, bool &increase)
 
std::string create_vendor_attribute_arg_list ()
 
bool parse_firmwarebug_def (const char *opt, firmwarebug_defs &firmwarebugs)
 
const char * get_valid_firmwarebug_args ()
 
int smartcommandhandler (ata_device *device, smart_command_set command, int select, char *data)
 
void ata_get_size_info (const ata_identify_device *id, ata_size_info &sizes)
 
void ata_format_id_string (char *out, const unsigned char *in, int n)
 
unsigned char checksum (const void *data)
 
ata_deviceget_parsed_ata_device (smart_interface *intf, const char *dev_name)
 

Variables

struct ata_identify_device ATTR_PACKED
 
unsigned char ata_debugmode
 
bool dont_print_serial_number
 

Macro Definition Documentation

◆ ABORT_SELF_TEST

#define ABORT_SELF_TEST   127

Definition at line 102 of file atacmds.h.

◆ ATA_CHECK_POWER_MODE

#define ATA_CHECK_POWER_MODE   0xe5

Definition at line 52 of file atacmds.h.

◆ ATA_DISABLE_AAM

#define ATA_DISABLE_AAM   0xc2

Definition at line 65 of file atacmds.h.

◆ ATA_DISABLE_APM

#define ATA_DISABLE_APM   0x85

Definition at line 66 of file atacmds.h.

◆ ATA_DISABLE_READ_LOOK_AHEAD

#define ATA_DISABLE_READ_LOOK_AHEAD   0x55

Definition at line 68 of file atacmds.h.

◆ ATA_DISABLE_WRITE_CACHE

#define ATA_DISABLE_WRITE_CACHE   0x82

Definition at line 67 of file atacmds.h.

◆ ATA_ENABLE_AAM

#define ATA_ENABLE_AAM   0x42

Definition at line 69 of file atacmds.h.

◆ ATA_ENABLE_APM

#define ATA_ENABLE_APM   0x05

Definition at line 70 of file atacmds.h.

◆ ATA_ENABLE_DISABLE_DSN

#define ATA_ENABLE_DISABLE_DSN   0x63

Definition at line 73 of file atacmds.h.

◆ ATA_ENABLE_READ_LOOK_AHEAD

#define ATA_ENABLE_READ_LOOK_AHEAD   0xaa

Definition at line 72 of file atacmds.h.

◆ ATA_ENABLE_WRITE_CACHE

#define ATA_ENABLE_WRITE_CACHE   0x02

Definition at line 71 of file atacmds.h.

◆ ATA_IDENTIFY_DEVICE

#define ATA_IDENTIFY_DEVICE   0xec

Definition at line 53 of file atacmds.h.

◆ ATA_IDENTIFY_PACKET_DEVICE

#define ATA_IDENTIFY_PACKET_DEVICE   0xa1

Definition at line 54 of file atacmds.h.

◆ ATA_IDLE

#define ATA_IDLE   0xe3

Definition at line 55 of file atacmds.h.

◆ ATA_READ_LOG_EXT

#define ATA_READ_LOG_EXT   0x2F

Definition at line 76 of file atacmds.h.

◆ ATA_SECURITY_FREEZE_LOCK

#define ATA_SECURITY_FREEZE_LOCK   0xf5

Definition at line 57 of file atacmds.h.

◆ ATA_SET_FEATURES

#define ATA_SET_FEATURES   0xef

Definition at line 59 of file atacmds.h.

◆ ATA_SMART_AUTO_OFFLINE

#define ATA_SMART_AUTO_OFFLINE   0xdb

Definition at line 94 of file atacmds.h.

◆ ATA_SMART_AUTOSAVE

#define ATA_SMART_AUTOSAVE   0xd2

Definition at line 83 of file atacmds.h.

◆ ATA_SMART_CMD

#define ATA_SMART_CMD   0xb0

Definition at line 56 of file atacmds.h.

◆ ATA_SMART_DISABLE

#define ATA_SMART_DISABLE   0xd9

Definition at line 90 of file atacmds.h.

◆ ATA_SMART_ENABLE

#define ATA_SMART_ENABLE   0xd8

Definition at line 89 of file atacmds.h.

◆ ATA_SMART_IMMEDIATE_OFFLINE

#define ATA_SMART_IMMEDIATE_OFFLINE   0xd4

Definition at line 85 of file atacmds.h.

◆ ATA_SMART_READ_LOG_SECTOR

#define ATA_SMART_READ_LOG_SECTOR   0xd5

Definition at line 86 of file atacmds.h.

◆ ATA_SMART_READ_THRESHOLDS

#define ATA_SMART_READ_THRESHOLDS   0xd1

Definition at line 82 of file atacmds.h.

◆ ATA_SMART_READ_VALUES

#define ATA_SMART_READ_VALUES   0xd0

Definition at line 81 of file atacmds.h.

◆ ATA_SMART_SAVE

#define ATA_SMART_SAVE   0xd3

Definition at line 84 of file atacmds.h.

◆ ATA_SMART_STATUS

#define ATA_SMART_STATUS   0xda

Definition at line 91 of file atacmds.h.

◆ ATA_SMART_WRITE_LOG_SECTOR

#define ATA_SMART_WRITE_LOG_SECTOR   0xd6

Definition at line 87 of file atacmds.h.

◆ ATA_SMART_WRITE_THRESHOLDS

#define ATA_SMART_WRITE_THRESHOLDS   0xd7

Definition at line 88 of file atacmds.h.

◆ ATA_STANDBY

#define ATA_STANDBY   0xe2

Definition at line 61 of file atacmds.h.

◆ ATA_STANDBY_IMMEDIATE

#define ATA_STANDBY_IMMEDIATE   0xe0

Definition at line 62 of file atacmds.h.

◆ ATA_WRITE_LOG_EXT

#define ATA_WRITE_LOG_EXT   0x3f

Definition at line 77 of file atacmds.h.

◆ ATACMDS_H_CVSID

#define ATACMDS_H_CVSID   "$Id: atacmds.h 5166 2021-01-15 18:02:19Z chrfranke $"

Definition at line 16 of file atacmds.h.

◆ ATTR_PACKED

Definition at line 26 of file atacmds.h.

◆ ATTRIBUTE_FLAGS_ERRORRATE

#define ATTRIBUTE_FLAGS_ERRORRATE (   x)    (x & 0x08)

Definition at line 183 of file atacmds.h.

◆ ATTRIBUTE_FLAGS_EVENTCOUNT

#define ATTRIBUTE_FLAGS_EVENTCOUNT (   x)    (x & 0x10)

Definition at line 186 of file atacmds.h.

◆ ATTRIBUTE_FLAGS_ONLINE

#define ATTRIBUTE_FLAGS_ONLINE (   x)    (x & 0x02)

Definition at line 174 of file atacmds.h.

◆ ATTRIBUTE_FLAGS_OTHER

#define ATTRIBUTE_FLAGS_OTHER (   x)    ((x) & 0xffc0)

Definition at line 192 of file atacmds.h.

◆ ATTRIBUTE_FLAGS_PERFORMANCE

#define ATTRIBUTE_FLAGS_PERFORMANCE (   x)    (x & 0x04)

Definition at line 180 of file atacmds.h.

◆ ATTRIBUTE_FLAGS_PREFAILURE

#define ATTRIBUTE_FLAGS_PREFAILURE (   x)    (x & 0x01)

Definition at line 164 of file atacmds.h.

◆ ATTRIBUTE_FLAGS_SELFPRESERVING

#define ATTRIBUTE_FLAGS_SELFPRESERVING (   x)    (x & 0x20)

Definition at line 189 of file atacmds.h.

◆ CAPTIVE_MASK

#define CAPTIVE_MASK   (0x01<<7)

Definition at line 107 of file atacmds.h.

◆ CONVEYANCE_CAPTIVE_SELF_TEST

#define CONVEYANCE_CAPTIVE_SELF_TEST   131

Definition at line 105 of file atacmds.h.

◆ CONVEYANCE_SELF_TEST

#define CONVEYANCE_SELF_TEST   3

Definition at line 100 of file atacmds.h.

◆ EXTEND_CAPTIVE_SELF_TEST

#define EXTEND_CAPTIVE_SELF_TEST   130

Definition at line 104 of file atacmds.h.

◆ EXTEND_SELF_TEST

#define EXTEND_SELF_TEST   2

Definition at line 99 of file atacmds.h.

◆ MAX_ATTRIBUTE_NUM

#define MAX_ATTRIBUTE_NUM   256

Definition at line 945 of file atacmds.h.

◆ NUMBER_ATA_SMART_ATTRIBUTES

#define NUMBER_ATA_SMART_ATTRIBUTES   30

Definition at line 110 of file atacmds.h.

◆ OFFLINE_FULL_SCAN

#define OFFLINE_FULL_SCAN   0

Definition at line 97 of file atacmds.h.

◆ SELECTIVE_CAPTIVE_SELF_TEST

#define SELECTIVE_CAPTIVE_SELF_TEST   132

Definition at line 106 of file atacmds.h.

◆ SELECTIVE_FLAG_ACTIVE

#define SELECTIVE_FLAG_ACTIVE   (0x0010)

Definition at line 501 of file atacmds.h.

◆ SELECTIVE_FLAG_DOSCAN

#define SELECTIVE_FLAG_DOSCAN   (0x0002)

Definition at line 499 of file atacmds.h.

◆ SELECTIVE_FLAG_PENDING

#define SELECTIVE_FLAG_PENDING   (0x0008)

Definition at line 500 of file atacmds.h.

◆ SELECTIVE_SELF_TEST

#define SELECTIVE_SELF_TEST   4

Definition at line 101 of file atacmds.h.

◆ SHORT_CAPTIVE_SELF_TEST

#define SHORT_CAPTIVE_SELF_TEST   129

Definition at line 103 of file atacmds.h.

◆ SHORT_SELF_TEST

#define SHORT_SELF_TEST   1

Definition at line 98 of file atacmds.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SEL_RANGE 
SEL_REDO 
SEL_NEXT 
SEL_CONT 

Definition at line 605 of file atacmds.h.

◆ anonymous enum

anonymous enum
Enumerator
ATTRFLAG_INCREASING 
ATTRFLAG_NO_NORMVAL 
ATTRFLAG_NO_WORSTVAL 
ATTRFLAG_HDD_ONLY 
ATTRFLAG_SSD_ONLY 

Definition at line 673 of file atacmds.h.

◆ ata_attr_raw_format

Enumerator
RAWFMT_DEFAULT 
RAWFMT_RAW8 
RAWFMT_RAW16 
RAWFMT_RAW48 
RAWFMT_HEX48 
RAWFMT_RAW56 
RAWFMT_HEX56 
RAWFMT_RAW64 
RAWFMT_HEX64 
RAWFMT_RAW16_OPT_RAW16 
RAWFMT_RAW16_OPT_AVG16 
RAWFMT_RAW24_OPT_RAW8 
RAWFMT_RAW24_DIV_RAW24 
RAWFMT_RAW24_DIV_RAW32 
RAWFMT_SEC2HOUR 
RAWFMT_MIN2HOUR 
RAWFMT_HALFMIN2HOUR 
RAWFMT_MSEC24_HOUR32 
RAWFMT_TEMPMINMAX 
RAWFMT_TEMP10X 

Definition at line 648 of file atacmds.h.

◆ ata_attr_state

Enumerator
ATTRSTATE_NON_EXISTING 
ATTRSTATE_NO_NORMVAL 
ATTRSTATE_NO_THRESHOLD 
ATTRSTATE_OK 
ATTRSTATE_FAILED_PAST 
ATTRSTATE_FAILED_NOW 

Definition at line 901 of file atacmds.h.

◆ ata_vendor_def_prior

Enumerator
PRIOR_DEFAULT 
PRIOR_DATABASE 
PRIOR_USER 

Definition at line 640 of file atacmds.h.

◆ firmwarebug_t

Enumerator
BUG_NONE 
BUG_NOLOGDIR 
BUG_SAMSUNG 
BUG_SAMSUNG2 
BUG_SAMSUNG3 
BUG_XERRORLBA 

Definition at line 712 of file atacmds.h.

◆ smart_command_set

Enumerator
ENABLE 
DISABLE 
AUTOSAVE 
IMMEDIATE_OFFLINE 
AUTO_OFFLINE 
STATUS 
STATUS_CHECK 
READ_VALUES 
READ_THRESHOLDS 
READ_LOG 
IDENTIFY 
PIDENTIFY 
CHECK_POWER_MODE 
WRITE_LOG 

Definition at line 29 of file atacmds.h.

Function Documentation

◆ ata_find_attr_index()

int ata_find_attr_index ( unsigned char  id,
const ata_smart_values smartval 
)

Definition at line 2146 of file atacmds.cpp.

◆ ata_format_attr_raw_value()

std::string ata_format_attr_raw_value ( const ata_smart_attribute attr,
const ata_vendor_attr_defs defs 
)

Definition at line 1920 of file atacmds.cpp.

◆ ata_format_id_string()

void ata_format_id_string ( char *  out,
const unsigned char *  in,
int  n 
)

Definition at line 762 of file atacmds.cpp.

◆ ata_get_attr_raw_value()

uint64_t ata_get_attr_raw_value ( const ata_smart_attribute attr,
const ata_vendor_attr_defs defs 
)

Definition at line 1846 of file atacmds.cpp.

◆ ata_get_attr_state()

ata_attr_state ata_get_attr_state ( const ata_smart_attribute attr,
int  attridx,
const ata_smart_threshold_entry thresholds,
const ata_vendor_attr_defs defs,
unsigned char *  threshval = 0 
)

Definition at line 1796 of file atacmds.cpp.

◆ ata_get_rotation_rate()

int ata_get_rotation_rate ( const ata_identify_device id)

Definition at line 920 of file atacmds.cpp.

◆ ata_get_size_info()

void ata_get_size_info ( const ata_identify_device id,
ata_size_info sizes 
)

Definition at line 658 of file atacmds.cpp.

◆ ata_get_smart_attr_name()

std::string ata_get_smart_attr_name ( unsigned char  id,
const ata_vendor_attr_defs defs,
int  rpm = 0 
)

Definition at line 2127 of file atacmds.cpp.

◆ ata_get_wwn()

int ata_get_wwn ( const ata_identify_device id,
unsigned &  oui,
uint64_t &  unique_id 
)

Definition at line 900 of file atacmds.cpp.

◆ ata_nodata_command()

bool ata_nodata_command ( ata_device device,
unsigned char  command,
int  sector_count = -1 
)

Definition at line 787 of file atacmds.cpp.

◆ ata_read_identity()

int ata_read_identity ( ata_device device,
ata_identify_device buf,
bool  fix_swapped_id,
unsigned char *  raw_buf = 0 
)

Definition at line 817 of file atacmds.cpp.

◆ ata_return_temperature_value()

unsigned char ata_return_temperature_value ( const ata_smart_values data,
const ata_vendor_attr_defs defs 
)

Definition at line 2159 of file atacmds.cpp.

◆ ata_set_features()

bool ata_set_features ( ata_device device,
unsigned char  features,
int  sector_count = -1 
)

Definition at line 799 of file atacmds.cpp.

◆ ataCheckPowerMode()

int ataCheckPowerMode ( ata_device device)

Definition at line 777 of file atacmds.cpp.

◆ ataDisableAutoOffline()

int ataDisableAutoOffline ( ata_device device)

Definition at line 1581 of file atacmds.cpp.

◆ ataDisableAutoSave()

int ataDisableAutoSave ( ata_device device)

Definition at line 1558 of file atacmds.cpp.

◆ ataDisableSmart()

int ataDisableSmart ( ata_device device)

Definition at line 1543 of file atacmds.cpp.

◆ ataDoesSmartWork()

int ataDoesSmartWork ( ata_device device)

Definition at line 1593 of file atacmds.cpp.

◆ ataEnableAutoOffline()

int ataEnableAutoOffline ( ata_device device)

Definition at line 1570 of file atacmds.cpp.

◆ ataEnableAutoSave()

int ataEnableAutoSave ( ata_device device)

Definition at line 1551 of file atacmds.cpp.

◆ ataEnableSmart()

int ataEnableSmart ( ata_device device)

Definition at line 1536 of file atacmds.cpp.

◆ ataGetSCTErrorRecoveryControltime()

int ataGetSCTErrorRecoveryControltime ( ata_device device,
unsigned  type,
unsigned short &  time_limit,
bool  power_on 
)

Definition at line 2510 of file atacmds.cpp.

◆ ataGetSetSCTWriteCache()

int ataGetSetSCTWriteCache ( ata_device device,
unsigned short  state,
bool  persistent,
bool  set 
)

Definition at line 2356 of file atacmds.cpp.

◆ ataGetSetSCTWriteCacheReordering()

int ataGetSetSCTWriteCacheReordering ( ata_device device,
bool  enable,
bool  persistent,
bool  set 
)

Definition at line 2349 of file atacmds.cpp.

◆ ataIsSmartEnabled()

int ataIsSmartEnabled ( const ata_identify_device drive)

Definition at line 951 of file atacmds.cpp.

◆ ataReadErrorLog()

int ataReadErrorLog ( ata_device device,
ata_smart_errorlog data,
firmwarebug_defs  firmwarebugs 
)

Definition at line 1424 of file atacmds.cpp.

◆ ataReadExtErrorLog()

bool ataReadExtErrorLog ( ata_device device,
ata_smart_exterrlog log,
unsigned  page,
unsigned  nsectors,
firmwarebug_defs  firmwarebugs 
)

Definition at line 1491 of file atacmds.cpp.

◆ ataReadExtSelfTestLog()

bool ataReadExtSelfTestLog ( ata_device device,
ata_smart_extselftestlog log,
unsigned  nsectors 
)

Definition at line 1061 of file atacmds.cpp.

◆ ataReadLogDirectory()

int ataReadLogDirectory ( ata_device device,
ata_smart_log_directory data,
bool  gpl 
)

Definition at line 1164 of file atacmds.cpp.

◆ ataReadLogExt()

bool ataReadLogExt ( ata_device device,
unsigned char  logaddr,
unsigned char  features,
unsigned  page,
void *  data,
unsigned  nsectors 
)

Definition at line 1111 of file atacmds.cpp.

◆ ataReadSCTStatus()

int ataReadSCTStatus ( ata_device device,
ata_sct_status_response sts 
)

Definition at line 2188 of file atacmds.cpp.

◆ ataReadSCTTempHist()

int ataReadSCTTempHist ( ata_device device,
ata_sct_temperature_history_table tmh,
ata_sct_status_response sts 
)

Definition at line 2220 of file atacmds.cpp.

◆ ataReadSelectiveSelfTestLog()

int ataReadSelectiveSelfTestLog ( ata_device device,
struct ata_selective_self_test_log data 
)

Definition at line 1184 of file atacmds.cpp.

◆ ataReadSelfTestLog()

int ataReadSelfTestLog ( ata_device device,
ata_smart_selftestlog data,
firmwarebug_defs  firmwarebugs 
)

Definition at line 1013 of file atacmds.cpp.

◆ ataReadSmartLog()

bool ataReadSmartLog ( ata_device device,
unsigned char  logaddr,
void *  data,
unsigned  nsectors 
)

Definition at line 1143 of file atacmds.cpp.

◆ ataReadSmartThresholds()

int ataReadSmartThresholds ( ata_device device,
struct ata_smart_thresholds_pvt data 
)

Definition at line 1518 of file atacmds.cpp.

◆ ataReadSmartValues()

int ataReadSmartValues ( ata_device device,
struct ata_smart_values data 
)

Definition at line 967 of file atacmds.cpp.

◆ ataSetSCTErrorRecoveryControltime()

int ataSetSCTErrorRecoveryControltime ( ata_device device,
unsigned  type,
unsigned short  time_limit,
bool  power_on,
bool  mfg_default 
)

Definition at line 2516 of file atacmds.cpp.

◆ ataSetSCTTempInterval()

int ataSetSCTTempInterval ( ata_device device,
unsigned  interval,
bool  persistent 
)

Definition at line 2363 of file atacmds.cpp.

◆ ataSmartStatus2()

int ataSmartStatus2 ( ata_device device)

Definition at line 1604 of file atacmds.cpp.

◆ ataSmartSupport()

int ataSmartSupport ( const ata_identify_device drive)

Definition at line 936 of file atacmds.cpp.

◆ ataSmartTest()

int ataSmartTest ( ata_device device,
int  testtype,
bool  force,
const ata_selective_selftest_args args,
const ata_smart_values sv,
uint64_t  num_sectors 
)

Definition at line 1611 of file atacmds.cpp.

◆ ataWriteLogExt()

bool ataWriteLogExt ( ata_device device,
unsigned char  logaddr,
unsigned  page,
void *  data,
unsigned  nsectors 
)

Definition at line 1080 of file atacmds.cpp.

◆ ataWriteSelectiveSelfTestLog()

int ataWriteSelectiveSelfTestLog ( ata_device device,
ata_selective_selftest_args args,
const ata_smart_values sv,
uint64_t  num_sectors,
const ata_selective_selftest_args prev_spans = 0 
)

Definition at line 1213 of file atacmds.cpp.

◆ checksum()

unsigned char checksum ( const void *  data)

Definition at line 716 of file atacmds.cpp.

◆ checksumwarning()

void checksumwarning ( const char *  string)

Definition at line 1455 of file smartctl.cpp.

◆ create_vendor_attribute_arg_list()

std::string create_vendor_attribute_arg_list ( )

Definition at line 262 of file atacmds.cpp.

◆ get_parsed_ata_device()

ata_device* get_parsed_ata_device ( smart_interface intf,
const char *  dev_name 
)

Definition at line 2838 of file atacmds.cpp.

◆ get_unc_attr_id()

unsigned char get_unc_attr_id ( bool  offline,
const ata_vendor_attr_defs defs,
bool &  increase 
)

Definition at line 53 of file atacmds.cpp.

◆ get_valid_firmwarebug_args()

const char* get_valid_firmwarebug_args ( )

Definition at line 297 of file atacmds.cpp.

◆ isGeneralPurposeLoggingCapable()

bool isGeneralPurposeLoggingCapable ( const ata_identify_device identity)

Definition at line 1769 of file atacmds.cpp.

◆ isSCTCapable()

bool isSCTCapable ( const ata_identify_device drive)
inline

Definition at line 886 of file atacmds.h.

◆ isSCTDataTableCapable()

bool isSCTDataTableCapable ( const ata_identify_device drive)
inline

Definition at line 895 of file atacmds.h.

◆ isSCTErrorRecoveryControlCapable()

bool isSCTErrorRecoveryControlCapable ( const ata_identify_device drive)
inline

Definition at line 889 of file atacmds.h.

◆ isSCTFeatureControlCapable()

bool isSCTFeatureControlCapable ( const ata_identify_device drive)
inline

Definition at line 892 of file atacmds.h.

◆ isSmartErrorLogCapable()

bool isSmartErrorLogCapable ( const ata_smart_values data,
const ata_identify_device identity 
)

Definition at line 1731 of file atacmds.cpp.

◆ isSmartTestLogCapable()

bool isSmartTestLogCapable ( const ata_smart_values data,
const ata_identify_device identity 
)

Definition at line 1750 of file atacmds.cpp.

◆ isSupportAutomaticTimer()

bool isSupportAutomaticTimer ( const ata_smart_values data)
inline

Definition at line 868 of file atacmds.h.

◆ isSupportConveyanceSelfTest()

bool isSupportConveyanceSelfTest ( const ata_smart_values data)
inline

Definition at line 880 of file atacmds.h.

◆ isSupportExecuteOfflineImmediate()

bool isSupportExecuteOfflineImmediate ( const ata_smart_values data)
inline

Definition at line 862 of file atacmds.h.

◆ isSupportOfflineAbort()

bool isSupportOfflineAbort ( const ata_smart_values data)
inline

Definition at line 871 of file atacmds.h.

◆ isSupportOfflineSurfaceScan()

bool isSupportOfflineSurfaceScan ( const ata_smart_values data)
inline

Definition at line 874 of file atacmds.h.

◆ isSupportSelectiveSelfTest()

bool isSupportSelectiveSelfTest ( const ata_smart_values data)
inline

Definition at line 883 of file atacmds.h.

◆ isSupportSelfTest()

bool isSupportSelfTest ( const ata_smart_values data)
inline

Definition at line 877 of file atacmds.h.

◆ parse_attribute_def()

bool parse_attribute_def ( const char *  opt,
ata_vendor_attr_defs defs,
ata_vendor_def_prior  priority 
)

Definition at line 149 of file atacmds.cpp.

◆ parse_firmwarebug_def()

bool parse_firmwarebug_def ( const char *  opt,
firmwarebug_defs firmwarebugs 
)

Definition at line 277 of file atacmds.cpp.

◆ smartcommandhandler()

int smartcommandhandler ( ata_device device,
smart_command_set  command,
int  select,
char *  data 
)

Definition at line 431 of file atacmds.cpp.

◆ STATIC_ASSERT() [1/26]

STATIC_ASSERT ( sizeof(ata_identify_device = =512)

◆ STATIC_ASSERT() [2/26]

STATIC_ASSERT ( sizeof(ata_sct_data_table_command = =512)

◆ STATIC_ASSERT() [3/26]

STATIC_ASSERT ( sizeof(ata_sct_error_recovery_control_command = =512)

◆ STATIC_ASSERT() [4/26]

STATIC_ASSERT ( sizeof(ata_sct_feature_control_command = =512)

◆ STATIC_ASSERT() [5/26]

STATIC_ASSERT ( sizeof(ata_sct_status_response = =512)

◆ STATIC_ASSERT() [6/26]

STATIC_ASSERT ( sizeof(ata_sct_temperature_history_table = =512)

◆ STATIC_ASSERT() [7/26]

STATIC_ASSERT ( sizeof(ata_selective_self_test_log = =512)

◆ STATIC_ASSERT() [8/26]

STATIC_ASSERT ( sizeof(ata_smart_attribute = =12)

◆ STATIC_ASSERT() [9/26]

STATIC_ASSERT ( sizeof(ata_smart_errorlog = =512)

◆ STATIC_ASSERT() [10/26]

STATIC_ASSERT ( sizeof(ata_smart_errorlog_command_struct = =12)

◆ STATIC_ASSERT() [11/26]

STATIC_ASSERT ( sizeof(ata_smart_errorlog_error_struct = =30)

◆ STATIC_ASSERT() [12/26]

STATIC_ASSERT ( sizeof(ata_smart_errorlog_struct = =90)

◆ STATIC_ASSERT() [13/26]

STATIC_ASSERT ( sizeof(ata_smart_exterrlog = =512)

◆ STATIC_ASSERT() [14/26]

STATIC_ASSERT ( sizeof(ata_smart_exterrlog_command = =18)

◆ STATIC_ASSERT() [15/26]

STATIC_ASSERT ( sizeof(ata_smart_exterrlog_error = =34)

◆ STATIC_ASSERT() [16/26]

STATIC_ASSERT ( sizeof(ata_smart_exterrlog_error_log = =124)

◆ STATIC_ASSERT() [17/26]

STATIC_ASSERT ( sizeof(ata_smart_extselftestlog = =512)

◆ STATIC_ASSERT() [18/26]

STATIC_ASSERT ( sizeof(ata_smart_extselftestlog_desc = =26)

◆ STATIC_ASSERT() [19/26]

STATIC_ASSERT ( sizeof(ata_smart_log_directory = =512)

◆ STATIC_ASSERT() [20/26]

STATIC_ASSERT ( sizeof(ata_smart_log_entry = =2)

◆ STATIC_ASSERT() [21/26]

STATIC_ASSERT ( sizeof(ata_smart_selftestlog = =512)

◆ STATIC_ASSERT() [22/26]

STATIC_ASSERT ( sizeof(ata_smart_selftestlog_struct = =24)

◆ STATIC_ASSERT() [23/26]

STATIC_ASSERT ( sizeof(ata_smart_threshold_entry = =12)

◆ STATIC_ASSERT() [24/26]

STATIC_ASSERT ( sizeof(ata_smart_thresholds_pvt = =512)

◆ STATIC_ASSERT() [25/26]

STATIC_ASSERT ( sizeof(ata_smart_values = =512)

◆ STATIC_ASSERT() [26/26]

STATIC_ASSERT ( sizeof(test_span = =16)

◆ TestTime()

int TestTime ( const ata_smart_values data,
int  testtype 
)

Definition at line 1700 of file atacmds.cpp.

Variable Documentation

◆ ata_debugmode

unsigned char ata_debugmode
extern

Definition at line 33 of file atacmds.cpp.

◆ ATTR_PACKED

◆ dont_print_serial_number

bool dont_print_serial_number
extern

Definition at line 37 of file atacmds.cpp.