+// Possible values for span_args.mode
+enum {
+ SEL_RANGE, // MIN-MAX
+ SEL_REDO, // redo this
+ SEL_NEXT, // do next range
+ SEL_CONT // redo or next depending of last test status
+};
+
+// Arguments for selective self-test
+struct ata_selective_selftest_args
+{
+ // Arguments for each span
+ struct span_args
+ {
+ uint64_t start; // First block
+ uint64_t end; // Last block
+ int mode; // SEL_*, see above
+
+ span_args()
+ : start(0), end(0), mode(SEL_RANGE) { }
+ };
+
+ span_args span[5]; // Range and mode for 5 spans
+ int num_spans; // Number of spans
+ int pending_time; // One plus time in minutes to wait after powerup before restarting
+ // interrupted offline scan after selective self-test.
+ int scan_after_select; // Run offline scan after selective self-test:
+ // 0: don't change,
+ // 1: turn off scan after selective self-test,
+ // 2: turn on scan after selective self-test.
+
+ ata_selective_selftest_args()
+ : num_spans(0), pending_time(0), scan_after_select(0) { }
+};
+
+// Priority for vendor attribute defs
+enum ata_vendor_def_prior
+{
+ PRIOR_DEFAULT,
+ PRIOR_DATABASE,
+ PRIOR_USER
+};
+
+// Raw attribute value print formats
+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,
+};
+
+// Attribute flags
+enum {
+ ATTRFLAG_INCREASING = 0x01, // Value not reset (for reallocated/pending counts)
+ ATTRFLAG_NO_NORMVAL = 0x02, // Normalized value not valid
+ ATTRFLAG_NO_WORSTVAL = 0x04, // Worst value not valid
+ ATTRFLAG_HDD_ONLY = 0x08, // DEFAULT setting for HDD only
+ ATTRFLAG_SSD_ONLY = 0x10, // DEFAULT setting for SSD only
+};
+
+// Vendor attribute display defs for all attribute ids
+class ata_vendor_attr_defs
+{
+public:
+ struct entry
+ {
+ std::string name; // Attribute name, empty for default
+ ata_attr_raw_format raw_format; // Raw value print format
+ ata_vendor_def_prior priority; // Setting priority
+ unsigned flags; // ATTRFLAG_*
+ char byteorder[8+1]; // String [012345rvwz] to define byte order
+
+ entry()
+ : raw_format(RAWFMT_DEFAULT),
+ priority(PRIOR_DEFAULT),
+ flags(0)
+ { byteorder[0] = 0; }
+ };
+
+ entry & operator[](unsigned char id)
+ { return m_defs[id]; }
+
+ const entry & operator[](unsigned char id) const
+ { return m_defs[id]; }
+
+private:
+ entry m_defs[256];
+};
+
+
+// Possible values for firmwarebugs
+enum firmwarebug_t {
+ BUG_NONE = 0,
+ BUG_NOLOGDIR,
+ BUG_SAMSUNG,
+ BUG_SAMSUNG2,
+ BUG_SAMSUNG3,
+ BUG_XERRORLBA
+};
+
+// Set of firmware bugs
+class firmwarebug_defs
+{
+public:
+ firmwarebug_defs()
+ : m_bugs(0) { }
+
+ bool is_set(firmwarebug_t bug) const
+ { return !!(m_bugs & (1 << bug)); }
+
+ void set(firmwarebug_t bug)
+ { m_bugs |= (1 << bug); }
+
+ void set(firmwarebug_defs bugs)
+ { m_bugs |= bugs.m_bugs; }
+
+private:
+ unsigned m_bugs;
+};
+
+
+// Print ATA debug messages?
+extern unsigned char ata_debugmode;
+
+// Suppress serial number?
+extern bool dont_print_serial_number;