diff --git a/src/applib/CMakeLists.txt b/src/applib/CMakeLists.txt index f883e87..1003eac 100644 --- a/src/applib/CMakeLists.txt +++ b/src/applib/CMakeLists.txt @@ -10,10 +10,13 @@ target_sources(applib PRIVATE async_command_executor.cpp async_command_executor.h app_builder_widget.h - app_gtkmm_features.h - app_gtkmm_utils.cpp - app_gtkmm_utils.h + app_gtkmm_tools.cpp + app_gtkmm_tools.h app_pcrecpp.h + ata_storage_property.cpp + ata_storage_property.h + ata_storage_property_descr.cpp + ata_storage_property_descr.h command_executor.h command_executor.cpp command_executor_3ware.h @@ -29,8 +32,8 @@ target_sources(applib PRIVATE smartctl_executor.cpp smartctl_executor_gui.h smartctl_executor.h - smartctl_parser.cpp - smartctl_parser.h + smartctl_text_parser.cpp + smartctl_text_parser.h storage_detector.cpp storage_detector.h storage_detector_helpers.h @@ -42,12 +45,8 @@ target_sources(applib PRIVATE storage_detector_win32.h storage_device.cpp storage_device.h - storage_property_colors.h - storage_property.cpp - storage_property_descr.cpp - storage_property_descr.h - storage_property.h storage_settings.h + warning_colors.h warning_level.h ) diff --git a/src/applib/app_gtkmm_features.h b/src/applib/app_gtkmm_features.h deleted file mode 100644 index 3869be9..0000000 --- a/src/applib/app_gtkmm_features.h +++ /dev/null @@ -1,39 +0,0 @@ -/****************************************************************************** -License: GNU General Public License v3.0 only -Copyright: - (C) 2008 - 2021 Alexander Shaduri -******************************************************************************/ -/// \file -/// \author Alexander Shaduri -/// \ingroup applib -/// \weakgroup applib -/// @{ - -#ifndef APP_GTKMM_FEATURES_H -#define APP_GTKMM_FEATURES_H - -#include "local_glibmm.h" -#include - - - -/// \def APP_GTKMM_CHECK_VERSION(major, minor, micro) -/// Similar to GTK_CHECK_VERSION, but for Gtkmm, which lacks this before gtkmm4. -/// This is useful as Gtk and Gtkmm versions may differ. -#ifndef APP_GTKMM_CHECK_VERSION - #define APP_GTKMM_CHECK_VERSION(major, minor, micro) \ - (GTKMM_MAJOR_VERSION > (major) \ - || (GTKMM_MAJOR_VERSION == (major) && (GTKMM_MINOR_VERSION > (minor) \ - || (GTKMM_MINOR_VERSION == (minor) && GTKMM_MICRO_VERSION >= (micro)) \ - ) \ - ) \ - ) -#endif - - - - - -#endif - -/// @} diff --git a/src/applib/app_gtkmm_utils.cpp b/src/applib/app_gtkmm_tools.cpp similarity index 99% rename from src/applib/app_gtkmm_utils.cpp rename to src/applib/app_gtkmm_tools.cpp index ecf71ed..9b917e6 100644 --- a/src/applib/app_gtkmm_utils.cpp +++ b/src/applib/app_gtkmm_tools.cpp @@ -15,7 +15,7 @@ Copyright: #include // std::strlen #include -#include "app_gtkmm_utils.h" +#include "app_gtkmm_tools.h" diff --git a/src/applib/app_gtkmm_utils.h b/src/applib/app_gtkmm_tools.h similarity index 86% rename from src/applib/app_gtkmm_utils.h rename to src/applib/app_gtkmm_tools.h index 1d9a035..e7c5768 100644 --- a/src/applib/app_gtkmm_utils.h +++ b/src/applib/app_gtkmm_tools.h @@ -9,14 +9,30 @@ Copyright: /// \weakgroup applib /// @{ -#ifndef APP_GTKMM_UTILS_H -#define APP_GTKMM_UTILS_H +#ifndef APP_GTKMM_TOOLS_H +#define APP_GTKMM_TOOLS_H #include #include +/// \def APP_GTKMM_CHECK_VERSION(major, minor, micro) +/// Similar to GTK_CHECK_VERSION, but for Gtkmm, which lacks this before gtkmm4. +/// This is useful as Gtk and Gtkmm versions may differ. +#ifndef APP_GTKMM_CHECK_VERSION + #define APP_GTKMM_CHECK_VERSION(major, minor, micro) \ + (GTKMM_MAJOR_VERSION > (major) \ + || (GTKMM_MAJOR_VERSION == (major) && (GTKMM_MINOR_VERSION > (minor) \ + || (GTKMM_MINOR_VERSION == (minor) && GTKMM_MICRO_VERSION >= (micro)) \ + ) \ + ) \ + ) +#endif + + + + /// Get column header widget of a tree view column. /// Note: This works only if the column has custom widget set. /// \return nullptr on failure. diff --git a/src/applib/ata_storage_property.cpp b/src/applib/ata_storage_property.cpp new file mode 100644 index 0000000..2b5001c --- /dev/null +++ b/src/applib/ata_storage_property.cpp @@ -0,0 +1,503 @@ +/****************************************************************************** +License: GNU General Public License v3.0 only +Copyright: + (C) 2008 - 2021 Alexander Shaduri +******************************************************************************/ +/// \file +/// \author Alexander Shaduri +/// \ingroup applib +/// \weakgroup applib +/// @{ + +#include "local_glibmm.h" +#include +#include // not iosfwd - it doesn't work +#include +#include +#include + +#include "hz/string_num.h" // number_to_string +#include "hz/stream_cast.h" // stream_cast<> +#include "hz/format_unit.h" // format_time_length +#include "hz/string_algo.h" // string_join +#include "hz/string_num.h" // number_to_string + +#include "ata_storage_property.h" + + + +std::ostream& operator<< (std::ostream& os, const AtaStorageCapability& p) +{ + os + // << p.name << ": " + << p.flag_value; + for (auto&& v : p.strvalues) { + os << "\n\t" << v; + } + return os; +} + + + +std::string AtaStorageAttribute::get_attr_type_name(AtaStorageAttribute::AttributeType type) +{ + static const std::unordered_map m { + {AttributeType::unknown, "[unknown]"}, + {AttributeType::prefail, "pre-failure"}, + {AttributeType::old_age, "old age"}, + }; + if (auto iter = m.find(type); iter != m.end()) { + return iter->second; + } + return "[internal_error]"; +} + + + +std::string AtaStorageAttribute::get_update_type_name(AtaStorageAttribute::UpdateType type) +{ + static const std::unordered_map m { + {UpdateType::unknown, "[unknown]"}, + {UpdateType::always, "continuously"}, + {UpdateType::offline, "on offline data collect."}, + }; + if (auto iter = m.find(type); iter != m.end()) { + return iter->second; + } + return "[internal_error]"; +} + + + +std::string AtaStorageAttribute::get_fail_time_name(AtaStorageAttribute::FailTime type) +{ + static const std::unordered_map m { + {FailTime::unknown, "[unknown]"}, + {FailTime::none, "never"}, + {FailTime::past, "in the past"}, + {FailTime::now, "now"}, + }; + if (auto iter = m.find(type); iter != m.end()) { + return iter->second; + } + return "[internal_error]"; +} + + + +std::string AtaStorageAttribute::format_raw_value() const +{ + // If it's fully a number, format it with commas + if (hz::number_to_string_nolocale(raw_value_int) == raw_value) { + std::stringstream ss; + try { + ss.imbue(std::locale("")); + } + catch (const std::runtime_error& e) { + // something is wrong with system locale, can't do anything here. + } + ss << std::fixed << raw_value_int; + return ss.str(); + } + return raw_value; +} + + + +std::ostream& operator<< (std::ostream& os, const AtaStorageAttribute& p) +{ +// os << p.name << ": " + if (p.value.has_value()) { + os << static_cast(p.value.value()); + } else { + os << "-"; + } + os << " (" << p.format_raw_value() << ")"; + return os; +} + + + +bool AtaStorageStatistic::is_normalized() const +{ + return flags.find('N') != std::string::npos; +} + + + +std::string AtaStorageStatistic::format_value() const +{ + // If it's fully a number, format it with commas + if (hz::number_to_string_nolocale(value_int) == value) { + std::stringstream ss; + try { + ss.imbue(std::locale("")); + } + catch (const std::runtime_error& e) { + // something is wrong with system locale, can't do anything here. + } + ss << std::fixed << value_int; + return ss.str(); + } + return value; +} + + + +std::ostream& operator<<(std::ostream& os, const AtaStorageStatistic& p) +{ + os << p.value; + return os; +} + + + +std::string AtaStorageErrorBlock::get_displayable_error_types(const std::vector& types) +{ + static const std::map m = { + {"ABRT", _("Command aborted")}, + {"AMNF", _("Address mark not found")}, + {"CCTO", _("Command completion timed out")}, + {"EOM", _("End of media")}, + {"ICRC", _("Interface CRC error")}, + {"IDNF", _("Identity not found")}, + {"ILI", _("(Packet command-set specific)")}, + {"MC", _("Media changed")}, + {"MCR", _("Media change request")}, + {"NM", _("No media")}, + {"obs", _("Obsolete")}, + {"TK0NF", _("Track 0 not found")}, + {"UNC", _("Uncorrectable error in data")}, + {"WP", _("Media is write protected")}, + }; + + std::vector sv; + for (const auto& type : types) { + if (m.find(type) != m.end()) { + sv.push_back(m.at(type)); + } else { + std::string name = _("Uknown type"); + if (!type.empty()) { + name = Glib::ustring::compose(_("Uknown type: %1"), type); + } + sv.push_back(name); + } + } + + return hz::string_join(sv, _(", ")); +} + + + +WarningLevel AtaStorageErrorBlock::get_warning_level_for_error_type(const std::string& type) +{ + static const std::map m = { + {"ABRT", WarningLevel::none}, + {"AMNF", WarningLevel::alert}, + {"CCTO", WarningLevel::warning}, + {"EOM", WarningLevel::warning}, + {"ICRC", WarningLevel::warning}, + {"IDNF", WarningLevel::alert}, + {"ILI", WarningLevel::notice}, + {"MC", WarningLevel::none}, + {"MCR", WarningLevel::none}, + {"NM", WarningLevel::none}, + {"obs", WarningLevel::none}, + {"TK0NF", WarningLevel::alert}, + {"UNC", WarningLevel::alert}, + {"WP", WarningLevel::none}, + }; + + if (m.find(type) != m.end()) { + return m.at(type); + } + return WarningLevel::none; // unknown error +} + + + +std::string AtaStorageErrorBlock::format_lifetime_hours() const +{ + std::stringstream ss; + try { + ss.imbue(std::locale("")); + } + catch (const std::runtime_error& e) { + // something is wrong with system locale, can't do anything here. + } + ss << std::fixed << lifetime_hours; + return ss.str(); +} + + + +std::ostream& operator<< (std::ostream& os, const AtaStorageErrorBlock& b) +{ + os << "Error number " << b.error_num << ": " + << hz::string_join(b.reported_types, ", ") + << " [" << AtaStorageErrorBlock::get_displayable_error_types(b.reported_types) << "]"; + return os; +} + + + +std::string AtaStorageSelftestEntry::get_status_displayable_name(AtaStorageSelftestEntry::Status s) +{ + static const std::unordered_map m { + {Status::unknown, "[unknown]"}, + {Status::completed_no_error, "Completed without error"}, + {Status::aborted_by_host, "Manually aborted"}, + {Status::interrupted, "Interrupted (host reset)"}, + {Status::fatal_or_unknown, "Fatal or unknown error"}, + {Status::compl_unknown_failure, "Completed with unknown failure"}, + {Status::compl_electrical_failure, "Completed with electrical failure"}, + {Status::compl_servo_failure, "Completed with servo/seek failure"}, + {Status::compl_read_failure, "Completed with read failure"}, + {Status::compl_handling_damage, "Completed: handling damage"}, + {Status::in_progress, "In progress"}, + {Status::reserved, "Unknown / reserved state"}, + }; + if (auto iter = m.find(s); iter != m.end()) { + return iter->second; + } + return "[internal_error]"; +} + + + +AtaStorageSelftestEntry::StatusSeverity AtaStorageSelftestEntry::get_status_severity(AtaStorageSelftestEntry::Status s) +{ + static const std::unordered_map m { + {Status::unknown, StatusSeverity::none}, + {Status::completed_no_error, StatusSeverity::none}, + {Status::aborted_by_host, StatusSeverity::warning}, + {Status::interrupted, StatusSeverity::warning}, + {Status::fatal_or_unknown, StatusSeverity::error}, + {Status::compl_unknown_failure, StatusSeverity::error}, + {Status::compl_electrical_failure, StatusSeverity::error}, + {Status::compl_servo_failure, StatusSeverity::error}, + {Status::compl_read_failure, StatusSeverity::error}, + {Status::compl_handling_damage, StatusSeverity::error}, + {Status::in_progress, StatusSeverity::none}, + {Status::reserved, StatusSeverity::none}, + }; + if (auto iter = m.find(s); iter != m.end()) { + return iter->second; + } + return StatusSeverity::none; +} + + + +std::string AtaStorageSelftestEntry::get_status_str() const +{ + return (status == Status::unknown ? status_str : get_status_displayable_name(status)); +} + + + +std::string AtaStorageSelftestEntry::format_lifetime_hours() const +{ + std::stringstream ss; + try { + ss.imbue(std::locale("")); + } + catch (const std::runtime_error& e) { + // something is wrong with system locale, can't do anything here. + } + ss << std::fixed << lifetime_hours; + return ss.str(); +} + + + +std::ostream& operator<< (std::ostream& os, const AtaStorageSelftestEntry& b) +{ + os << "Test entry " << b.test_num << ": " + << b.type << ", status: " << b.get_status_str() << ", remaining: " << int(b.remaining_percent); + return os; +} + + + +std::string AtaStorageProperty::get_section_name(AtaStorageProperty::Section s) +{ + static const std::unordered_map m { + {Section::unknown, "unknown"}, + {Section::info, "info"}, + {Section::data, "data"}, + {Section::internal, "internal"}, + }; + if (auto iter = m.find(s); iter != m.end()) { + return iter->second; + } + return "[internal_error]"; +} + + + +std::string AtaStorageProperty::get_subsection_name(AtaStorageProperty::SubSection s) +{ + static const std::unordered_map m { + {SubSection::unknown, "unknown"}, + {SubSection::health, "health"}, + {SubSection::capabilities, "capabilities"}, + {SubSection::attributes, "attributes"}, + {SubSection::devstat, "devstat"}, + {SubSection::error_log, "error_log"}, + {SubSection::selftest_log, "selftest_log"}, + {SubSection::selective_selftest_log, "selective_selftest_log"}, + {SubSection::temperature_log, "temperature_log"}, + {SubSection::erc_log, "erc_log"}, + {SubSection::phy_log, "phy_log"}, + {SubSection::directory_log, "directory_log"}, + }; + if (auto iter = m.find(s); iter != m.end()) { + return iter->second; + } + return "[internal_error]"; +} + + + +std::string AtaStorageProperty::get_value_type_name() const +{ + if (std::holds_alternative(value)) + return "empty"; + if (std::holds_alternative(value)) + return "string"; + if (std::holds_alternative(value)) + return "integer"; + if (std::holds_alternative(value)) + return "bool"; + if (std::holds_alternative(value)) + return "time_length"; + if (std::holds_alternative(value)) + return "capability"; + if (std::holds_alternative(value)) + return "attribute"; + if (std::holds_alternative(value)) + return "statistic"; + if (std::holds_alternative(value)) + return "error_block"; + if (std::holds_alternative(value)) + return "selftest_entry"; + return "[internal_error]"; +} + + + +bool AtaStorageProperty::empty() const +{ + return std::holds_alternative(value); +} + + + +void AtaStorageProperty::dump(std::ostream& os, std::size_t internal_offset) const +{ + std::string offset(internal_offset, ' '); + + os << offset << "[" << get_section_name(section) + << (section == Section::data ? (", " + get_subsection_name(subsection)) : "") << "]" + << " " << generic_name + // << (generic_name == reported_name ? "" : (" (" + reported_name + ")")) + << ": [" << get_value_type_name() << "] "; + + // if (!readable_value.empty()) + // os << readable_value; + + if (std::holds_alternative(value)) { + os << "[empty]"; + } else if (std::holds_alternative(value)) { + os << std::get(value); + } else if (std::holds_alternative(value)) { + os << std::get(value) << " [" << reported_value << "]"; + } else if (std::holds_alternative(value)) { + os << std::string(std::get(value) ? "Yes" : "No") << " [" << reported_value << "]"; + } else if (std::holds_alternative(value)) { + os << std::get(value).count() << " sec [" << reported_value << "]"; + } else if (std::holds_alternative(value)) { + os << std::get(value); + } else if (std::holds_alternative(value)) { + os << std::get(value); + } else if (std::holds_alternative(value)) { + os << std::get(value); + } else if (std::holds_alternative(value)) { + os << std::get(value); + } else if (std::holds_alternative(value)) { + os << std::get(value); + } +} + + + +std::string AtaStorageProperty::format_value(bool add_reported_too) const +{ + if (!readable_value.empty()) + return readable_value; + + if (std::holds_alternative(value)) + return "[unknown]"; + if (std::holds_alternative(value)) + return std::get(value); + if (std::holds_alternative(value)) + return hz::number_to_string_locale(std::get(value)) + (add_reported_too ? (" [" + reported_value + "]") : ""); + if (std::holds_alternative(value)) + return std::string(std::get(value) ? "Yes" : "No") + (add_reported_too ? (" [" + reported_value + "]") : ""); + if (std::holds_alternative(value)) + return hz::format_time_length(std::get(value)) + (add_reported_too ? (" [" + reported_value + "]") : ""); + if (std::holds_alternative(value)) + return hz::stream_cast(std::get(value)); + if (std::holds_alternative(value)) + return hz::stream_cast(std::get(value)); + if (std::holds_alternative(value)) + return hz::stream_cast(std::get(value)); + if (std::holds_alternative(value)) + return hz::stream_cast(std::get(value)); + if (std::holds_alternative(value)) + return hz::stream_cast(std::get(value)); + + return "[internal_error]"; +} + + + +std::string AtaStorageProperty::get_description(bool clean) const +{ + if (clean) + return this->description; + return (this->description.empty() ? "No description available" : this->description); +} + + + +void AtaStorageProperty::set_description(const std::string& descr) +{ + this->description = descr; +} + + + +void AtaStorageProperty::set_name(const std::string& rep_name, const std::string& gen_name, const std::string& read_name) +{ + this->reported_name = rep_name; + this->generic_name = (gen_name.empty() ? this->reported_name : gen_name); + this->displayable_name = (read_name.empty() ? this->reported_name : read_name); +} + + + +std::ostream& operator<<(std::ostream& os, const AtaStorageProperty& p) +{ + p.dump(os); + return os; +} + + + + + + + +/// @} diff --git a/src/applib/storage_property.h b/src/applib/ata_storage_property.h similarity index 60% rename from src/applib/storage_property.h rename to src/applib/ata_storage_property.h index b6eb61b..f0f3fbc 100644 --- a/src/applib/storage_property.h +++ b/src/applib/ata_storage_property.h @@ -9,8 +9,8 @@ Copyright: /// \weakgroup applib /// @{ -#ifndef STORAGE_PROPERTY_H -#define STORAGE_PROPERTY_H +#ifndef ATA_STORAGE_PROPERTY_H +#define ATA_STORAGE_PROPERTY_H #include #include @@ -27,7 +27,7 @@ Copyright: /// Holds one block of "capabilities" subsection /// (only for non-time-interval blocks). -class StorageCapability { +class AtaStorageCapability { public: std::string reported_flag_value; ///< original flag value as a string uint16_t flag_value = 0x0; ///< Flag value. This is one or sometimes two bytes (maybe more?) @@ -37,14 +37,14 @@ class StorageCapability { /// Output operator for debug purposes -std::ostream& operator<< (std::ostream& os, const StorageCapability& p); +std::ostream& operator<< (std::ostream& os, const AtaStorageCapability& p); /// Holds one line of "attributes" subsection -class StorageAttribute { +class AtaStorageAttribute { public: /// Disk type the attribute may match @@ -62,18 +62,7 @@ class StorageAttribute { }; /// Get readable attribute type name - [[nodiscard]] static std::string get_attr_type_name(AttributeType type) - { - static const std::unordered_map m { - {AttributeType::unknown, "[unknown]"}, - {AttributeType::prefail, "pre-failure"}, - {AttributeType::old_age, "old age"}, - }; - if (auto iter = m.find(type); iter != m.end()) { - return iter->second; - } - return "[internal_error]"; - } + [[nodiscard]] static std::string get_attr_type_name(AttributeType type); /// Attribute when-updated type @@ -84,18 +73,7 @@ class StorageAttribute { }; /// Get readable when-updated type name - [[nodiscard]] static std::string get_update_type_name(UpdateType type) - { - static const std::unordered_map m { - {UpdateType::unknown, "[unknown]"}, - {UpdateType::always, "continuously"}, - {UpdateType::offline, "on offline data collect."}, - }; - if (auto iter = m.find(type); iter != m.end()) { - return iter->second; - } - return "[internal_error]"; - } + [[nodiscard]] static std::string get_update_type_name(UpdateType type); /// Attribute when-failed type @@ -107,19 +85,7 @@ class StorageAttribute { }; /// Get a readable when-failed type name - [[nodiscard]] static std::string get_fail_time_name(FailTime type) - { - static const std::unordered_map m { - {FailTime::unknown, "[unknown]"}, - {FailTime::none, "never"}, - {FailTime::past, "in the past"}, - {FailTime::now, "now"}, - }; - if (auto iter = m.find(type); iter != m.end()) { - return iter->second; - } - return "[internal_error]"; - } + [[nodiscard]] static std::string get_fail_time_name(FailTime type); /// Format raw value with commas (if it's a number) @@ -141,20 +107,17 @@ class StorageAttribute { /// Output operator for debug purposes -std::ostream& operator<< (std::ostream& os, const StorageAttribute& p); +std::ostream& operator<< (std::ostream& os, const AtaStorageAttribute& p); /// Holds one line of "devstat" subsection -class StorageStatistic { +class AtaStorageStatistic { public: /// Whether the normalization flag is present - [[nodiscard]] bool is_normalized() const - { - return flags.find('N') != std::string::npos; - } + [[nodiscard]] bool is_normalized() const; /// Format value with commas (if it's a number) [[nodiscard]] std::string format_value() const; @@ -169,12 +132,12 @@ class StorageStatistic { /// Output operator for debug purposes -std::ostream& operator<< (std::ostream& os, const StorageStatistic& p); +std::ostream& operator<< (std::ostream& os, const AtaStorageStatistic& p); /// Holds one error block of "error log" subsection -class StorageErrorBlock { +class AtaStorageErrorBlock { public: /// Get readable error types from reported types @@ -195,14 +158,14 @@ class StorageErrorBlock { /// Output operator for debug purposes -std::ostream& operator<< (std::ostream& os, const StorageErrorBlock& b); +std::ostream& operator<< (std::ostream& os, const AtaStorageErrorBlock& b); /// Holds one entry of selftest_log subsection. /// Also, holds "Self-test execution status" capability's "internal" section version. -class StorageSelftestEntry { +class AtaStorageSelftestEntry { public: /// Self-test log entry status @@ -229,57 +192,14 @@ class StorageSelftestEntry { }; /// Get log entry status displayable name - [[nodiscard]] static std::string get_status_displayable_name(Status s) - { - static const std::unordered_map m { - {Status::unknown, "[unknown]"}, - {Status::completed_no_error, "Completed without error"}, - {Status::aborted_by_host, "Manually aborted"}, - {Status::interrupted, "Interrupted (host reset)"}, - {Status::fatal_or_unknown, "Fatal or unknown error"}, - {Status::compl_unknown_failure, "Completed with unknown failure"}, - {Status::compl_electrical_failure, "Completed with electrical failure"}, - {Status::compl_servo_failure, "Completed with servo/seek failure"}, - {Status::compl_read_failure, "Completed with read failure"}, - {Status::compl_handling_damage, "Completed: handling damage"}, - {Status::in_progress, "In progress"}, - {Status::reserved, "Unknown / reserved state"}, - }; - if (auto iter = m.find(s); iter != m.end()) { - return iter->second; - } - return "[internal_error]"; - } + [[nodiscard]] static std::string get_status_displayable_name(Status s); /// Get severity of error status - [[nodiscard]] static StatusSeverity get_status_severity(Status s) - { - static const std::unordered_map m { - {Status::unknown, StatusSeverity::none}, - {Status::completed_no_error, StatusSeverity::none}, - {Status::aborted_by_host, StatusSeverity::warning}, - {Status::interrupted, StatusSeverity::warning}, - {Status::fatal_or_unknown, StatusSeverity::error}, - {Status::compl_unknown_failure, StatusSeverity::error}, - {Status::compl_electrical_failure, StatusSeverity::error}, - {Status::compl_servo_failure, StatusSeverity::error}, - {Status::compl_read_failure, StatusSeverity::error}, - {Status::compl_handling_damage, StatusSeverity::error}, - {Status::in_progress, StatusSeverity::none}, - {Status::reserved, StatusSeverity::none}, - }; - if (auto iter = m.find(s); iter != m.end()) { - return iter->second; - } - return StatusSeverity::none; - } + [[nodiscard]] static StatusSeverity get_status_severity(Status s); /// Get error status as a string - [[nodiscard]] std::string get_status_str() const - { - return (status == Status::unknown ? status_str : get_status_displayable_name(status)); - } + [[nodiscard]] std::string get_status_str() const; /// Format lifetime hours with comma @@ -297,13 +217,13 @@ class StorageSelftestEntry { /// Output operator for debug purposes -std::ostream& operator<< (std::ostream& os, const StorageSelftestEntry& b); +std::ostream& operator<< (std::ostream& os, const AtaStorageSelftestEntry& b); /// A single parser-extracted property -class StorageProperty { +class AtaStorageProperty { public: /// Sections in output @@ -315,19 +235,7 @@ class StorageProperty { }; /// Get displayable section type name - [[nodiscard]] static std::string get_section_name(Section s) - { - static const std::unordered_map m { - {Section::unknown, "unknown"}, - {Section::info, "info"}, - {Section::data, "data"}, - {Section::internal, "internal"}, - }; - if (auto iter = m.find(s); iter != m.end()) { - return iter->second; - } - return "[internal_error]"; - } + [[nodiscard]] static std::string get_section_name(Section s); /// Subsections in smart data section @@ -347,61 +255,15 @@ class StorageProperty { }; /// Get displayable subsection type name - [[nodiscard]] static std::string get_subsection_name(SubSection s) - { - static const std::unordered_map m { - {SubSection::unknown, "unknown"}, - {SubSection::health, "health"}, - {SubSection::capabilities, "capabilities"}, - {SubSection::attributes, "attributes"}, - {SubSection::devstat, "devstat"}, - {SubSection::error_log, "error_log"}, - {SubSection::selftest_log, "selftest_log"}, - {SubSection::selective_selftest_log, "selective_selftest_log"}, - {SubSection::temperature_log, "temperature_log"}, - {SubSection::erc_log, "erc_log"}, - {SubSection::phy_log, "phy_log"}, - {SubSection::directory_log, "directory_log"}, - }; - if (auto iter = m.find(s); iter != m.end()) { - return iter->second; - } - return "[internal_error]"; - } + [[nodiscard]] static std::string get_subsection_name(SubSection s); /// Get displayable value type name - [[nodiscard]] std::string get_value_type_name() const - { - if (std::holds_alternative(value)) - return "empty"; - if (std::holds_alternative(value)) - return "string"; - if (std::holds_alternative(value)) - return "integer"; - if (std::holds_alternative(value)) - return "bool"; - if (std::holds_alternative(value)) - return "time_length"; - if (std::holds_alternative(value)) - return "capability"; - if (std::holds_alternative(value)) - return "attribute"; - if (std::holds_alternative(value)) - return "statistic"; - if (std::holds_alternative(value)) - return "error_block"; - if (std::holds_alternative(value)) - return "selftest_entry"; - return "[internal_error]"; - } + [[nodiscard]] std::string get_value_type_name() const; /// Check if this is an empty object with no value set. - [[nodiscard]] bool empty() const - { - return std::holds_alternative(value); - } + [[nodiscard]] bool empty() const; /// Dump the property to a stream for debugging purposes @@ -414,43 +276,24 @@ class StorageProperty { /// Get value of type T template - const T& get_value() const - { - return std::get(value); - } + const T& get_value() const; /// Check if value is of type T template - [[nodiscard]] bool is_value_type() const - { - return std::holds_alternative(value); - } + [[nodiscard]] bool is_value_type() const; /// Get property description (used in tooltips) - [[nodiscard]] std::string get_description(bool clean = false) const - { - if (clean) - return this->description; - return (this->description.empty() ? "No description available" : this->description); - } + [[nodiscard]] std::string get_description(bool clean = false) const; /// Set property description (used in tooltips) - void set_description(const std::string& descr) - { - this->description = descr; - } + void set_description(const std::string& descr); /// Set smartctl-reported name, generic (internal) name, readable name - void set_name(const std::string& rep_name, const std::string& gen_name = "", const std::string& read_name = "") - { - this->reported_name = rep_name; - this->generic_name = (gen_name.empty() ? this->reported_name : gen_name); - this->displayable_name = (read_name.empty() ? this->reported_name : read_name); - } + void set_name(const std::string& rep_name, const std::string& gen_name = "", const std::string& read_name = ""); std::string reported_name; ///< Property name as reported by smartctl. @@ -471,11 +314,11 @@ class StorageProperty { int64_t, ///< Value (if it's an integer) bool, ///< Value (if it's bool) std::chrono::seconds, ///< Value in seconds (if it's time interval) - StorageCapability, ///< Value (if it's a capability) - StorageAttribute, ///< Value (if it's an attribute) - StorageStatistic, ///< Value (if it's a statistic from devstat) - StorageErrorBlock, ///< Value (if it's a error block) - StorageSelftestEntry ///< Value (if it's a self-test entry) + AtaStorageCapability, ///< Value (if it's a capability) + AtaStorageAttribute, ///< Value (if it's an attribute) + AtaStorageStatistic, ///< Value (if it's a statistic from devstat) + AtaStorageErrorBlock, ///< Value (if it's a error block) + AtaStorageSelftestEntry ///< Value (if it's a self-test entry) > value; WarningLevel warning = WarningLevel::none; ///< Warning severity for this property @@ -489,14 +332,31 @@ class StorageProperty { /// Output operator for debug purposes -inline std::ostream& operator<< (std::ostream& os, const StorageProperty& p) +std::ostream& operator<< (std::ostream& os, const AtaStorageProperty& p); + + + + + +// ------------------------------------------- Implementation + + + +template +const T& AtaStorageProperty::get_value() const { - p.dump(os); - return os; + return std::get(value); } +template +bool AtaStorageProperty::is_value_type() const +{ + return std::holds_alternative(value); +} + + diff --git a/src/applib/storage_property_descr.cpp b/src/applib/ata_storage_property_descr.cpp similarity index 71% rename from src/applib/storage_property_descr.cpp rename to src/applib/ata_storage_property_descr.cpp index 523f8c0..454aa42 100644 --- a/src/applib/storage_property_descr.cpp +++ b/src/applib/ata_storage_property_descr.cpp @@ -18,7 +18,7 @@ Copyright: #include "hz/string_algo.h" // string_replace_copy #include "applib/app_pcrecpp.h" -#include "storage_property_descr.h" +#include "ata_storage_property_descr.h" @@ -45,14 +45,14 @@ namespace { AttributeDescription() = default; /// Constructor - AttributeDescription(int32_t id_, StorageAttribute::DiskType type, std::string reported_name_, + AttributeDescription(int32_t id_, AtaStorageAttribute::DiskType type, std::string reported_name_, std::string displayable_name_, std::string generic_name_, std::string description_) : id(id_), disk_type(type), reported_name(std::move(reported_name_)), displayable_name(std::move(displayable_name_)), generic_name(std::move(generic_name_)), description(std::move(description_)) { } int32_t id = -1; ///< e.g. 190 - StorageAttribute::DiskType disk_type = StorageAttribute::DiskType::Any; ///< HDD-only, SSD-only or universal attribute + AtaStorageAttribute::DiskType disk_type = AtaStorageAttribute::DiskType::Any; ///< HDD-only, SSD-only or universal attribute std::string reported_name; ///< e.g. Airflow_Temperature_Cel std::string displayable_name; ///< e.g. Airflow Temperature (C). This is a translatable string. std::string generic_name; ///< Generic name to be set on the property, e.g. "airflow_temperature". For lookups. @@ -99,52 +99,52 @@ namespace { add(4, "Start_Stop_Count", "Start / Stop Count", "", "Number of start/stop cycles of a spindle (Raw value). That is, number of drive spin-ups."); // Reallocated Sector Count (smartctl) - add(5, StorageAttribute::DiskType::Hdd, "Reallocated_Sector_Ct", "Reallocated Sector Count", "attr_reallocated_sector_count", + add(5, AtaStorageAttribute::DiskType::Hdd, "Reallocated_Sector_Ct", "Reallocated Sector Count", "attr_reallocated_sector_count", "Number of reallocated sectors (Raw value). Non-zero Raw value indicates a disk surface failure." "\n\n" + get_uncorrectable_text()); // SSD: Reallocated Sector Count (smartctl) - add(5, StorageAttribute::DiskType::Ssd, "Reallocated_Sector_Ct", "Reallocated Sector Count", "attr_reallocated_sector_count", + add(5, AtaStorageAttribute::DiskType::Ssd, "Reallocated_Sector_Ct", "Reallocated Sector Count", "attr_reallocated_sector_count", "Number of reallocated sectors (Raw value). High Raw value indicates an old age for an SSD."); // SandForce SSD: Retired_Block_Count (smartctl) - add(5, StorageAttribute::DiskType::Ssd, "Retired_Block_Count", "Retired Block Rate", "attr_ssd_life_left", + add(5, AtaStorageAttribute::DiskType::Ssd, "Retired_Block_Count", "Retired Block Rate", "attr_ssd_life_left", "Indicates estimated remaining life of the drive. Normalized value is (100-100*RBC/MRB) where RBC is the number of retired blocks " "and MRB is the minimum required blocks."); // Crucial/Micron SSD: Reallocate_NAND_Blk_Cnt (smartctl) - add(5, StorageAttribute::DiskType::Ssd, "Reallocate_NAND_Blk_Cnt", "Reallocated NAND Block Count", "", + add(5, AtaStorageAttribute::DiskType::Ssd, "Reallocate_NAND_Blk_Cnt", "Reallocated NAND Block Count", "", "Number of reallocated blocks (Raw value). High Raw value indicates an old age for an SSD."); // Micron SSD: Reallocate_NAND_Blk_Cnt (smartctl) - add(5, StorageAttribute::DiskType::Ssd, "Reallocated_Block_Count", "Reallocated Block Count", "", + add(5, AtaStorageAttribute::DiskType::Ssd, "Reallocated_Block_Count", "Reallocated Block Count", "", "Number of reallocated blocks (Raw value). High Raw value indicates an old age for an SSD."); // OCZ SSD (smartctl) - add(5, StorageAttribute::DiskType::Ssd, "Runtime_Bad_Block", "Runtime Bad Block Count", "", + add(5, AtaStorageAttribute::DiskType::Ssd, "Runtime_Bad_Block", "Runtime Bad Block Count", "", ""); // Innodisk SSD (smartctl) - add(5, StorageAttribute::DiskType::Ssd, "Later_Bad_Block", "Later Bad Block", "", + add(5, AtaStorageAttribute::DiskType::Ssd, "Later_Bad_Block", "Later Bad Block", "", ""); // Read Channel Margin (smartctl) - add(6, StorageAttribute::DiskType::Hdd, "Read_Channel_Margin", "Read Channel Margin", "", + add(6, AtaStorageAttribute::DiskType::Hdd, "Read_Channel_Margin", "Read Channel Margin", "", "Margin of a channel while reading data. The function of this attribute is not specified."); // Seek Error Rate (smartctl) - add(7, StorageAttribute::DiskType::Hdd, "Seek_Error_Rate", "Seek Error Rate", "", + add(7, AtaStorageAttribute::DiskType::Hdd, "Seek_Error_Rate", "Seek Error Rate", "", "Frequency of errors appearance while positioning. When a drive reads data, it positions heads in the needed place. " "If there is a failure in the mechanical positioning system, a seek error arises. More seek errors indicate worse condition " "of a disk surface and disk mechanical subsystem. The exact meaning of the Raw value is manufacturer-dependent."); // Seek Time Performance (smartctl) - add(8, StorageAttribute::DiskType::Hdd, "Seek_Time_Performance", "Seek Time Performance", "", + add(8, AtaStorageAttribute::DiskType::Hdd, "Seek_Time_Performance", "Seek Time Performance", "", "Average efficiency of seek operations of the magnetic heads. If this value is decreasing, it is a sign of problems in the hard disk drive mechanical subsystem."); // Power-On Hours (smartctl) (Maxtor may use minutes, Fujitsu may use seconds, some even temperature?) add(9, "Power_On_Hours", "Power-On Time", "", "Number of hours in power-on state. Raw value shows total count of hours (or minutes, or half-minutes, or seconds, depending on manufacturer) in power-on state."); // SandForce, Intel SSD: Power_On_Hours_and_Msec (smartctl) (description?) - add(9, StorageAttribute::DiskType::Ssd, "Power_On_Hours_and_Msec"); + add(9, AtaStorageAttribute::DiskType::Ssd, "Power_On_Hours_and_Msec"); // Smart Storage Systems SSD (smartctl) - add(9, StorageAttribute::DiskType::Ssd, "Proprietary_9", "Internal Attribute", "", + add(9, AtaStorageAttribute::DiskType::Ssd, "Proprietary_9", "Internal Attribute", "", "This attribute has been reserved by vendor as internal."); // Spin-up Retry Count (smartctl) - add(10, StorageAttribute::DiskType::Hdd, "Spin_Retry_Count", "Spin-Up Retry Count", "attr_spin_up_retry_count", + add(10, AtaStorageAttribute::DiskType::Hdd, "Spin_Retry_Count", "Spin-Up Retry Count", "attr_spin_up_retry_count", "Number of retries of spin start attempts (Raw value). An increase of this attribute value is a sign of problems in the hard disk mechanical subsystem."); // Calibration Retry Count (smartctl) - add(11, StorageAttribute::DiskType::Hdd, "Calibration_Retry_Count", "Calibration Retry Count", "", + add(11, AtaStorageAttribute::DiskType::Hdd, "Calibration_Retry_Count", "Calibration Retry Count", "", "Number of times recalibration was requested, under the condition that the first attempt was unsuccessful (Raw value). " "A decrease is a sign of problems in the hard disk mechanical subsystem."); // Power Cycle Count (smartctl) @@ -154,303 +154,303 @@ namespace { add(13, "Read_Soft_Error_Rate", "Soft Read Error Rate", "attr_soft_read_error_rate", "Uncorrected read errors reported to the operating system (Raw value). If the value is non-zero, you should back up your data."); // Sandforce SSD: Soft_Read_Error_Rate (smartctl) - add(13, StorageAttribute::DiskType::Ssd, "Soft_Read_Error_Rate"); + add(13, AtaStorageAttribute::DiskType::Ssd, "Soft_Read_Error_Rate"); // Maxtor: Average FHC (custom) (description?) - add(99, StorageAttribute::DiskType::Hdd, "", "Average FHC (Flying Height Control)", "", + add(99, AtaStorageAttribute::DiskType::Hdd, "", "Average FHC (Flying Height Control)", "", ""); // Sandforce SSD: Gigabytes_Erased (smartctl) (description?) - add(100, StorageAttribute::DiskType::Ssd, "Gigabytes_Erased", "GiB Erased", "", + add(100, AtaStorageAttribute::DiskType::Ssd, "Gigabytes_Erased", "GiB Erased", "", "Number of GiB erased."); // OCZ SSD (smartctl) - add(100, StorageAttribute::DiskType::Ssd, "Total_Blocks_Erased", "Total Blocks Erased", "", + add(100, AtaStorageAttribute::DiskType::Ssd, "Total_Blocks_Erased", "Total Blocks Erased", "", "Number of total blocks erased."); // STEC CF: (custom) - add(100, StorageAttribute::DiskType::Ssd, "", "Erase / Program Cycles", "", // unused + add(100, AtaStorageAttribute::DiskType::Ssd, "", "Erase / Program Cycles", "", // unused "Number of Erase / Program cycles of the entire drive."); // Maxtor: Maximum FHC (custom) (description?) - add(101, StorageAttribute::DiskType::Hdd, "", "Maximum FHC (Flying Height Control)", "", + add(101, AtaStorageAttribute::DiskType::Hdd, "", "Maximum FHC (Flying Height Control)", "", ""); // Unknown (source says Maxtor, but it's an SSD thing and Maxtor doesn't have them at this point). // add(101, "", "Translation Table Rebuild", "", // "Indicates power backup fault or internal error resulting in loss of system unit tables."); // STEC CF: Translation Table Rebuild (custom) - add(103, StorageAttribute::DiskType::Ssd, "", "Translation Table Rebuild", "", + add(103, AtaStorageAttribute::DiskType::Ssd, "", "Translation Table Rebuild", "", "Indicates power backup fault or internal error resulting in loss of system unit tables."); // Smart Storage Systems SSD (smartctl) (description?) - add(130, StorageAttribute::DiskType::Ssd, "Minimum_Spares_All_Zs", "Minimum Spares All Zs", "", + add(130, AtaStorageAttribute::DiskType::Ssd, "Minimum_Spares_All_Zs", "Minimum Spares All Zs", "", ""); // SiliconMotion SSDs (description?) (smartctl) - add(148, StorageAttribute::DiskType::Ssd, "Total_SLC_Erase_Ct", "Total SLC Erase Count", "", + add(148, AtaStorageAttribute::DiskType::Ssd, "Total_SLC_Erase_Ct", "Total SLC Erase Count", "", ""); // SiliconMotion SSDs (description?) (smartctl) - add(149, StorageAttribute::DiskType::Ssd, "Max_SLC_Erase_Ct", "Maximum SLC Erase Count", "", + add(149, AtaStorageAttribute::DiskType::Ssd, "Max_SLC_Erase_Ct", "Maximum SLC Erase Count", "", ""); // SiliconMotion SSDs (description?) (smartctl) - add(150, StorageAttribute::DiskType::Ssd, "Min_SLC_Erase_Ct", "Minimum SLC Erase Count", "", + add(150, AtaStorageAttribute::DiskType::Ssd, "Min_SLC_Erase_Ct", "Minimum SLC Erase Count", "", ""); // SiliconMotion SSDs (description?) (smartctl) - add(151, StorageAttribute::DiskType::Ssd, "Average_SLC_Erase_Ct", "Average SLC Erase Count", "", + add(151, AtaStorageAttribute::DiskType::Ssd, "Average_SLC_Erase_Ct", "Average SLC Erase Count", "", ""); // Apacer Flash (description?) (smartctl) - add(160, StorageAttribute::DiskType::Ssd, "Initial_Bad_Block_Count", "Initial Bad Block Count", "", + add(160, AtaStorageAttribute::DiskType::Ssd, "Initial_Bad_Block_Count", "Initial Bad Block Count", "", ""); // Samsung SSD, Intel SSD: Reported Uncorrectable (smartctl) - add(160, StorageAttribute::DiskType::Ssd, "Uncorrectable_Error_Cnt", "Uncorrectable Error Count", "", + add(160, AtaStorageAttribute::DiskType::Ssd, "Uncorrectable_Error_Cnt", "Uncorrectable Error Count", "", ""); // Apacer Flash (description?) (smartctl) - add(161, StorageAttribute::DiskType::Ssd, "Bad_Block_Count", "Bad Block Count", "", + add(161, AtaStorageAttribute::DiskType::Ssd, "Bad_Block_Count", "Bad Block Count", "", "Number of bad blocks. SSDs reallocate blocks as part of their normal operation, so low bad block counts are not critical for them."); // Innodisk (description?) (smartctl) - add(161, StorageAttribute::DiskType::Ssd, "Number_of_Pure_Spare", "Number of Pure Spare", "", + add(161, AtaStorageAttribute::DiskType::Ssd, "Number_of_Pure_Spare", "Number of Pure Spare", "", ""); // Innodisk CF (description?) (smartctl) - add(161, StorageAttribute::DiskType::Ssd, "Valid_Spare_Block_Cnt", "Valid Spare Block Count", "", + add(161, AtaStorageAttribute::DiskType::Ssd, "Valid_Spare_Block_Cnt", "Valid Spare Block Count", "", "Number of available spare blocks. Spare blocks are used when bad blocks develop."); // Apacer Flash (description?) (smartctl) - add(162, StorageAttribute::DiskType::Ssd, "Spare_Block_Count", "Spare Block Count", "", + add(162, AtaStorageAttribute::DiskType::Ssd, "Spare_Block_Count", "Spare Block Count", "", "Number of spare blocks which are used when bad blocks develop."); // Innodisk CF (smartctl) - add(162, StorageAttribute::DiskType::Ssd, "Child_Pair_Count", "Child Pair Count", "", + add(162, AtaStorageAttribute::DiskType::Ssd, "Child_Pair_Count", "Child Pair Count", "", ""); // Apacer Flash (description?) (smartctl) - add(163, StorageAttribute::DiskType::Ssd, "Max_Erase_Count", "Maximum Erase Count", "", + add(163, AtaStorageAttribute::DiskType::Ssd, "Max_Erase_Count", "Maximum Erase Count", "", "The maximum of individual erase counts of all the blocks."); // Innodisk SSD: (smartctl) - add(163, StorageAttribute::DiskType::Ssd, "Initial_Bad_Block_Count", "Initial Bad Block Count", "", + add(163, AtaStorageAttribute::DiskType::Ssd, "Initial_Bad_Block_Count", "Initial Bad Block Count", "", "Factory-determined number of initial bad blocks."); // Innodisk SSD: (smartctl) - add(163, StorageAttribute::DiskType::Ssd, "Total_Bad_Block_Count", "Total Bad Block Count", "", + add(163, AtaStorageAttribute::DiskType::Ssd, "Total_Bad_Block_Count", "Total Bad Block Count", "", "Number of bad blocks. SSDs reallocate blocks as part of their normal operation, so low bad block counts are not critical for them."); // Apacer Flash (description?) (smartctl) - add(164, StorageAttribute::DiskType::Ssd, "Average_Erase_Count", "Average Erase Count", "", + add(164, AtaStorageAttribute::DiskType::Ssd, "Average_Erase_Count", "Average Erase Count", "", ""); // Innodisk SSD (description?) (smartctl) - add(164, StorageAttribute::DiskType::Ssd, "Total_Erase_Count", "Total Erase Count", "", + add(164, AtaStorageAttribute::DiskType::Ssd, "Total_Erase_Count", "Total Erase Count", "", ""); // Apacer Flash (description?) (smartctl) - add(165, StorageAttribute::DiskType::Ssd, "Average_Erase_Count", "Average Erase Count", "", + add(165, AtaStorageAttribute::DiskType::Ssd, "Average_Erase_Count", "Average Erase Count", "", ""); // Innodisk SSD (description?) (smartctl) - add(165, StorageAttribute::DiskType::Ssd, "Max_Erase_Count", "Maximum Erase Count", "", + add(165, AtaStorageAttribute::DiskType::Ssd, "Max_Erase_Count", "Maximum Erase Count", "", ""); // Sandisk SSD (description?) (smartctl) - add(165, StorageAttribute::DiskType::Ssd, "Total_Write/Erase_Count", "Total Write / Erase Count", "", + add(165, AtaStorageAttribute::DiskType::Ssd, "Total_Write/Erase_Count", "Total Write / Erase Count", "", ""); // Apacer Flash (description?) (smartctl) - add(166, StorageAttribute::DiskType::Ssd, "Later_Bad_Block_Count", "Later Bad Block Count", "", + add(166, AtaStorageAttribute::DiskType::Ssd, "Later_Bad_Block_Count", "Later Bad Block Count", "", ""); // Innodisk SSD (description?) (smartctl) - add(166, StorageAttribute::DiskType::Ssd, "Min_Erase_Count", "Minimum Erase Count", "", + add(166, AtaStorageAttribute::DiskType::Ssd, "Min_Erase_Count", "Minimum Erase Count", "", ""); // Sandisk SSD (description?) (smartctl) - add(166, StorageAttribute::DiskType::Ssd, "Min_W/E_Cycle", "Minimum Write / Erase Cycles", "", + add(166, AtaStorageAttribute::DiskType::Ssd, "Min_W/E_Cycle", "Minimum Write / Erase Cycles", "", ""); // Apacer Flash, OCZ (description?) (smartctl) - add(167, StorageAttribute::DiskType::Ssd, "SSD_Protect_Mode", "SSD Protect Mode", "", + add(167, AtaStorageAttribute::DiskType::Ssd, "SSD_Protect_Mode", "SSD Protect Mode", "", ""); // Innodisk SSD (description?) (smartctl) - add(167, StorageAttribute::DiskType::Ssd, "Average_Erase_Count", "Average Erase Count", "", + add(167, AtaStorageAttribute::DiskType::Ssd, "Average_Erase_Count", "Average Erase Count", "", ""); // Sandisk SSD (description?) (smartctl) - add(167, StorageAttribute::DiskType::Ssd, "Min_Bad_Block/Die", "Minimum Bad Block / Die", "", + add(167, AtaStorageAttribute::DiskType::Ssd, "Min_Bad_Block/Die", "Minimum Bad Block / Die", "", ""); // Apacer Flash (description?) (smartctl) - add(168, StorageAttribute::DiskType::Ssd, "SATA_PHY_Err_Ct", "SATA Physical Error Count", "", + add(168, AtaStorageAttribute::DiskType::Ssd, "SATA_PHY_Err_Ct", "SATA Physical Error Count", "", ""); // Various SSDs: (smartctl) (description?) - add(168, StorageAttribute::DiskType::Ssd, "SATA_Phy_Error_Count", "SATA Physical Error Count", "", + add(168, AtaStorageAttribute::DiskType::Ssd, "SATA_Phy_Error_Count", "SATA Physical Error Count", "", ""); // Innodisk SSDs: (smartctl) (description?) - add(168, StorageAttribute::DiskType::Ssd, "Max_Erase_Count_of_Spec", "Maximum Erase Count per Specification", "", + add(168, AtaStorageAttribute::DiskType::Ssd, "Max_Erase_Count_of_Spec", "Maximum Erase Count per Specification", "", ""); // Sandisk SSD (description?) (smartctl) - add(168, StorageAttribute::DiskType::Ssd, "Maximum_Erase_Cycle", "Maximum Erase Cycles", "", + add(168, AtaStorageAttribute::DiskType::Ssd, "Maximum_Erase_Cycle", "Maximum Erase Cycles", "", ""); // Toshiba SSDs: (smartctl) (description?) - add(169, StorageAttribute::DiskType::Ssd, "Bad_Block_Count", "Bad Block Count", "", + add(169, AtaStorageAttribute::DiskType::Ssd, "Bad_Block_Count", "Bad Block Count", "", "Number of bad blocks. SSDs reallocate blocks as part of their normal operation, so low bad block counts are not critical for them."); // Sandisk SSD (description?) (smartctl) - add(169, StorageAttribute::DiskType::Ssd, "Total_Bad_Blocks", "Total Bad Blocks", "", + add(169, AtaStorageAttribute::DiskType::Ssd, "Total_Bad_Blocks", "Total Bad Blocks", "", "Number of bad blocks. SSDs reallocate blocks as part of their normal operation, so low bad block counts are not critical for them."); // Innodisk SSDs: (smartctl) (description?) - add(169, StorageAttribute::DiskType::Ssd, "Remaining_Lifetime_Perc", "Remaining Lifetime %", "attr_ssd_life_left", + add(169, AtaStorageAttribute::DiskType::Ssd, "Remaining_Lifetime_Perc", "Remaining Lifetime %", "attr_ssd_life_left", "Remaining drive life in % (usually by erase count)."); // Intel SSD, STEC CF: Reserved Block Count (smartctl) - add(170, StorageAttribute::DiskType::Ssd, "Reserve_Block_Count", "Reserved Block Count", "", + add(170, AtaStorageAttribute::DiskType::Ssd, "Reserve_Block_Count", "Reserved Block Count", "", "Number of reserved (spare) blocks for bad block handling."); // Micron SSD: Reserved Block Count (smartctl) - add(170, StorageAttribute::DiskType::Ssd, "Reserved_Block_Count", "Reserved Block Count", "", + add(170, AtaStorageAttribute::DiskType::Ssd, "Reserved_Block_Count", "Reserved Block Count", "", "Number of reserved (spare) blocks for bad block handling."); // Crucial / Marvell SSD: Grown Failing Block Count (smartctl) (description?) - add(170, StorageAttribute::DiskType::Ssd, "Grown_Failing_Block_Ct", "Grown Failing Block Count", "", + add(170, AtaStorageAttribute::DiskType::Ssd, "Grown_Failing_Block_Ct", "Grown Failing Block Count", "", ""); // Intel SSD: (smartctl) (description?) - add(170, StorageAttribute::DiskType::Ssd, "Available_Reservd_Space", "Available Reserved Space", "", + add(170, AtaStorageAttribute::DiskType::Ssd, "Available_Reservd_Space", "Available Reserved Space", "", ""); // Various SSDs: (smartctl) (description?) - add(170, StorageAttribute::DiskType::Ssd, "Bad_Block_Count", "Bad Block Count", "", + add(170, AtaStorageAttribute::DiskType::Ssd, "Bad_Block_Count", "Bad Block Count", "", "Number of bad blocks. SSDs reallocate blocks as part of their normal operation, so low bad block counts are not critical for them."); // Kingston SSDs: (smartctl) (description?) - add(170, StorageAttribute::DiskType::Ssd, "Bad_Blk_Ct_Erl/Lat", "Bad Block Early / Later", "", + add(170, AtaStorageAttribute::DiskType::Ssd, "Bad_Blk_Ct_Erl/Lat", "Bad Block Early / Later", "", ""); // Samsung SSDs: (smartctl) (description?) - add(170, StorageAttribute::DiskType::Ssd, "Unused_Rsvd_Blk_Ct_Chip", "Unused Reserved Block Count (Chip)", "", + add(170, AtaStorageAttribute::DiskType::Ssd, "Unused_Rsvd_Blk_Ct_Chip", "Unused Reserved Block Count (Chip)", "", ""); // Innodisk Flash (description?) (smartctl) - add(170, StorageAttribute::DiskType::Ssd, "Spare_Block_Count", "Spare Block Count", "", + add(170, AtaStorageAttribute::DiskType::Ssd, "Spare_Block_Count", "Spare Block Count", "", "Number of spare blocks which are used in case bad blocks develop."); // Intel SSD, Sandforce SSD, STEC CF, Crucial / Marvell SSD: Program Fail Count (smartctl) - add(171, StorageAttribute::DiskType::Ssd, "Program_Fail_Count", "Program Fail Count", "", + add(171, AtaStorageAttribute::DiskType::Ssd, "Program_Fail_Count", "Program Fail Count", "", "Number of flash program (write) failures. High values may indicate old drive age or other problems."); // Samsung SSDs: (smartctl) (description?) - add(171, StorageAttribute::DiskType::Ssd, "Program_Fail_Count_Chip", "Program Fail Count (Chip)", "", + add(171, AtaStorageAttribute::DiskType::Ssd, "Program_Fail_Count_Chip", "Program Fail Count (Chip)", "", ""); // OCZ SSD (smartctl) - add(171, StorageAttribute::DiskType::Ssd, "Avail_OP_Block_Count", "Available OP Block Count", "", + add(171, AtaStorageAttribute::DiskType::Ssd, "Avail_OP_Block_Count", "Available OP Block Count", "", ""); // Intel SSD, Sandforce SSD, STEC CF, Crucial / Marvell SSD: Erase Fail Count (smartctl) - add(172, StorageAttribute::DiskType::Ssd, "Erase_Fail_Count", "Erase Fail Count", "", + add(172, AtaStorageAttribute::DiskType::Ssd, "Erase_Fail_Count", "Erase Fail Count", "", "Number of flash erase command failures. High values may indicate old drive age or other problems."); // Various SSDs (smartctl) (description?) - add(173, StorageAttribute::DiskType::Ssd, "Erase_Count", "Erase Count", "", + add(173, AtaStorageAttribute::DiskType::Ssd, "Erase_Count", "Erase Count", "", ""); // Samsung SSDs (smartctl) (description?) - add(173, StorageAttribute::DiskType::Ssd, "Erase_Fail_Count_Chip", "Erase Fail Count (Chip)", "", + add(173, AtaStorageAttribute::DiskType::Ssd, "Erase_Fail_Count_Chip", "Erase Fail Count (Chip)", "", ""); // Kingston SSDs (smartctl) (description?) - add(173, StorageAttribute::DiskType::Ssd, "MaxAvgErase_Ct", "Maximum / Average Erase Count", "", + add(173, AtaStorageAttribute::DiskType::Ssd, "MaxAvgErase_Ct", "Maximum / Average Erase Count", "", ""); // Crucial/Micron SSDs (smartctl) (description?) - add(173, StorageAttribute::DiskType::Ssd, "Ave_Block-Erase_Count", "Average Block-Erase Count", "", + add(173, AtaStorageAttribute::DiskType::Ssd, "Ave_Block-Erase_Count", "Average Block-Erase Count", "", ""); // STEC CF, Crucial / Marvell SSD: Wear Leveling Count (smartctl) (description?) - add(173, StorageAttribute::DiskType::Ssd, "Wear_Leveling_Count", "Wear Leveling Count", "", + add(173, AtaStorageAttribute::DiskType::Ssd, "Wear_Leveling_Count", "Wear Leveling Count", "", "Indicates the difference between the most worn block and the least worn block."); // Same as above, old smartctl - add(173, StorageAttribute::DiskType::Ssd, "Wear_Levelling_Count", "Wear Leveling Count", "", + add(173, AtaStorageAttribute::DiskType::Ssd, "Wear_Levelling_Count", "Wear Leveling Count", "", "Indicates the difference between the most worn block and the least worn block."); // Sandisk SSDs (smartctl) (description?) - add(173, StorageAttribute::DiskType::Ssd, "Avg_Write/Erase_Count", "Average Write / Erase Count", "", + add(173, AtaStorageAttribute::DiskType::Ssd, "Avg_Write/Erase_Count", "Average Write / Erase Count", "", ""); // Intel SSD, Sandforce SSD, Crucial / Marvell SSD: Unexpected Power Loss (smartctl) - add(174, StorageAttribute::DiskType::Ssd, "Unexpect_Power_Loss_Ct", "Unexpected Power Loss Count", "", + add(174, AtaStorageAttribute::DiskType::Ssd, "Unexpect_Power_Loss_Ct", "Unexpected Power Loss Count", "", "Number of unexpected power loss events."); // OCZ SSD (smartctl) - add(174, StorageAttribute::DiskType::Ssd, "Pwr_Cycle_Ct_Unplanned", "Unexpected Power Loss Count", "", + add(174, AtaStorageAttribute::DiskType::Ssd, "Pwr_Cycle_Ct_Unplanned", "Unexpected Power Loss Count", "", "Number of unexpected power loss events."); // Apple SSD (smartctl) - add(174, StorageAttribute::DiskType::Ssd, "Host_Reads_MiB", "Host Read (MiB)", "", + add(174, AtaStorageAttribute::DiskType::Ssd, "Host_Reads_MiB", "Host Read (MiB)", "", "Total number of sectors read by the host system. The Raw value is increased by 1 for every MiB read by the host."); // Program_Fail_Count_Chip (smartctl) - add(175, StorageAttribute::DiskType::Ssd, "Program_Fail_Count_Chip", "Program Fail Count (Chip)", "", + add(175, AtaStorageAttribute::DiskType::Ssd, "Program_Fail_Count_Chip", "Program Fail Count (Chip)", "", "Number of flash program (write) failures. High values may indicate old drive age or other problems."); // Various SSDs: Bad_Cluster_Table_Count (smartctl) (description?) - add(175, StorageAttribute::DiskType::Ssd, "Bad_Cluster_Table_Count", "Bad Cluster Table Count", "", + add(175, AtaStorageAttribute::DiskType::Ssd, "Bad_Cluster_Table_Count", "Bad Cluster Table Count", "", ""); // Intel SSD (smartctl) (description?) - add(175, StorageAttribute::DiskType::Ssd, "Power_Loss_Cap_Test", "Power Loss Capacitor Test", "", + add(175, AtaStorageAttribute::DiskType::Ssd, "Power_Loss_Cap_Test", "Power Loss Capacitor Test", "", ""); // Intel SSD (smartctl) (description?) - add(175, StorageAttribute::DiskType::Ssd, "Host_Writes_MiB", "Host Written (MiB)", "", + add(175, AtaStorageAttribute::DiskType::Ssd, "Host_Writes_MiB", "Host Written (MiB)", "", "Total number of sectors written by the host system. The Raw value is increased by 1 for every MiB written by the host."); // Erase_Fail_Count_Chip (smartctl) - add(176, StorageAttribute::DiskType::Ssd, "Erase_Fail_Count_Chip", "Erase Fail Count (Chip)", "", + add(176, AtaStorageAttribute::DiskType::Ssd, "Erase_Fail_Count_Chip", "Erase Fail Count (Chip)", "", "Number of flash erase command failures. High values may indicate old drive age or other problems."); // Innodisk SSD (smartctl) (description?) - add(176, StorageAttribute::DiskType::Ssd, "Uncorr_RECORD_Count", "Uncorrected RECORD Count", "", + add(176, AtaStorageAttribute::DiskType::Ssd, "Uncorr_RECORD_Count", "Uncorrected RECORD Count", "", ""); // Innodisk SSD (smartctl) (description?) - add(176, StorageAttribute::DiskType::Ssd, "RANGE_RECORD_Count", "RANGE RECORD Count", "", + add(176, AtaStorageAttribute::DiskType::Ssd, "RANGE_RECORD_Count", "RANGE RECORD Count", "", ""); // Wear_Leveling_Count (smartctl) (same as Wear_Range_Delta?) - add(177, StorageAttribute::DiskType::Ssd, "Wear_Leveling_Count", "Wear Leveling Count", "", + add(177, AtaStorageAttribute::DiskType::Ssd, "Wear_Leveling_Count", "Wear Leveling Count", "", "Indicates the difference (in percent) between the most worn block and the least worn block."); // Sandforce SSD: Wear_Range_Delta (smartctl) - add(177, StorageAttribute::DiskType::Ssd, "Wear_Range_Delta", "Wear Range Delta", "", + add(177, AtaStorageAttribute::DiskType::Ssd, "Wear_Range_Delta", "Wear Range Delta", "", "Indicates the difference (in percent) between the most worn block and the least worn block."); // Used_Rsvd_Blk_Cnt_Chip (smartctl) - add(178, StorageAttribute::DiskType::Ssd, "Used_Rsvd_Blk_Cnt_Chip", "Used Reserved Block Count (Chip)", "", + add(178, AtaStorageAttribute::DiskType::Ssd, "Used_Rsvd_Blk_Cnt_Chip", "Used Reserved Block Count (Chip)", "", "Number of a chip's used reserved blocks. High values may indicate old drive age or other problems."); // Innodisk SSD (smartctl) - add(178, StorageAttribute::DiskType::Ssd, "Runtime_Invalid_Blk_Cnt", "Runtime Invalid Block Count", "", + add(178, AtaStorageAttribute::DiskType::Ssd, "Runtime_Invalid_Blk_Cnt", "Runtime Invalid Block Count", "", ""); // Used_Rsvd_Blk_Cnt_Tot (smartctl) (description?) - add(179, StorageAttribute::DiskType::Ssd, "Used_Rsvd_Blk_Cnt_Tot", "Used Reserved Block Count (Total)", "", + add(179, AtaStorageAttribute::DiskType::Ssd, "Used_Rsvd_Blk_Cnt_Tot", "Used Reserved Block Count (Total)", "", "Number of used reserved blocks. High values may indicate old drive age or other problems."); // Unused_Rsvd_Blk_Cnt_Tot (smartctl) - add(180, StorageAttribute::DiskType::Ssd, "Unused_Rsvd_Blk_Cnt_Tot", "Unused Reserved Block Count (Total)", "", + add(180, AtaStorageAttribute::DiskType::Ssd, "Unused_Rsvd_Blk_Cnt_Tot", "Unused Reserved Block Count (Total)", "", "Number of unused reserved blocks. High values may indicate old drive age or other problems."); // Crucial / Micron SSDs (smartctl) (description?) - add(180, StorageAttribute::DiskType::Ssd, "Unused_Reserve_NAND_Blk", "Unused Reserved NAND Blocks", "", + add(180, AtaStorageAttribute::DiskType::Ssd, "Unused_Reserve_NAND_Blk", "Unused Reserved NAND Blocks", "", ""); // Program_Fail_Cnt_Total (smartctl) add(181, "Program_Fail_Cnt_Total", "Program Fail Count", "", "Number of flash program (write) failures. High values may indicate old drive age or other problems."); // Sandforce SSD: Program_Fail_Count (smartctl) (Sandforce says it's identical to 171) - add(181, StorageAttribute::DiskType::Ssd, "Program_Fail_Count"); + add(181, AtaStorageAttribute::DiskType::Ssd, "Program_Fail_Count"); // Crucial / Marvell SSD (smartctl) (description?) - add(181, StorageAttribute::DiskType::Ssd, "Non4k_Aligned_Access", "Non-4k Aligned Access", "", + add(181, AtaStorageAttribute::DiskType::Ssd, "Non4k_Aligned_Access", "Non-4k Aligned Access", "", ""); // Erase_Fail_Count_Total (smartctl) (description?) - add(182, StorageAttribute::DiskType::Ssd, "Erase_Fail_Count_Total", "Erase Fail Count", "", + add(182, AtaStorageAttribute::DiskType::Ssd, "Erase_Fail_Count_Total", "Erase Fail Count", "", "Number of flash erase command failures. High values may indicate old drive age or other problems."); // Sandforce SSD: Erase_Fail_Count (smartctl) (Sandforce says it's identical to 172) - add(182, StorageAttribute::DiskType::Ssd, "Erase_Fail_Count"); + add(182, AtaStorageAttribute::DiskType::Ssd, "Erase_Fail_Count"); // Runtime_Bad_Block (smartctl) (description?) add(183, "Runtime_Bad_Block", "Runtime Bad Blocks", "", ""); // Samsung, WD, Crucial / Marvell SSD: SATA Downshift Error Count (smartctl) (description?) - add(183, StorageAttribute::DiskType::Any, "SATA_Iface_Downshift", "SATA Downshift Error Count", "", + add(183, AtaStorageAttribute::DiskType::Any, "SATA_Iface_Downshift", "SATA Downshift Error Count", "", ""); // Crucial / Marvell SSD: SATA Downshift Error Count (smartctl) (description?) - add(183, StorageAttribute::DiskType::Any, "SATA_Interfac_Downshift", "SATA Downshift Error Count", "", + add(183, AtaStorageAttribute::DiskType::Any, "SATA_Interfac_Downshift", "SATA Downshift Error Count", "", ""); // Intel SSD, Ubtek SSD (smartctl) (description?) - add(183, StorageAttribute::DiskType::Ssd, "SATA_Downshift_Count", "SATA Downshift Error Count", "", + add(183, AtaStorageAttribute::DiskType::Ssd, "SATA_Downshift_Count", "SATA Downshift Error Count", "", ""); // End to End Error (smartctl) (description?) add(184, "End-to-End_Error", "End to End Error", "", "Indicates discrepancy of data between the host and the drive cache."); // Sandforce SSD: IO_Error_Detect_Code_Ct (smartctl) - add(184, StorageAttribute::DiskType::Ssd, "IO_Error_Detect_Code_Ct", "Input/Output ECC Error Count", "", + add(184, AtaStorageAttribute::DiskType::Ssd, "IO_Error_Detect_Code_Ct", "Input/Output ECC Error Count", "", ""); // OCZ SSD (smartctl) - add(184, StorageAttribute::DiskType::Ssd, "Factory_Bad_Block_Count", "Factory Bad Block Count", "", + add(184, AtaStorageAttribute::DiskType::Ssd, "Factory_Bad_Block_Count", "Factory Bad Block Count", "", ""); // Indilinx Barefoot SSD: IO_Error_Detect_Code_Ct (smartctl) - add(184, StorageAttribute::DiskType::Ssd, "Initial_Bad_Block_Count", "Initial Bad Block Count", "", + add(184, AtaStorageAttribute::DiskType::Ssd, "Initial_Bad_Block_Count", "Initial Bad Block Count", "", "Factory-determined number of initial bad blocks."); // Crucial / Micron SSD (smartctl) - add(184, StorageAttribute::DiskType::Ssd, "Error_Correction_Count", "Error Correction Count", "", + add(184, AtaStorageAttribute::DiskType::Ssd, "Error_Correction_Count", "Error Correction Count", "", ""); // WD: Head Stability (custom) - add(185, StorageAttribute::DiskType::Hdd, "", "Head Stability", "", + add(185, AtaStorageAttribute::DiskType::Hdd, "", "Head Stability", "", ""); // WD: Induced Op-Vibration Detection (custom) - add(185, StorageAttribute::DiskType::Hdd, "", "Induced Op-Vibration Detection", "", // unused + add(185, AtaStorageAttribute::DiskType::Hdd, "", "Induced Op-Vibration Detection", "", // unused ""); // Reported Uncorrectable (smartctl) add(187, "Reported_Uncorrect", "Reported Uncorrectable", "", "Number of errors that could not be recovered using hardware ECC (Error-Correcting Code)."); // Innodisk SSD: Reported Uncorrectable (smartctl) - add(187, StorageAttribute::DiskType::Ssd, "Uncorrectable_Error_Cnt"); + add(187, AtaStorageAttribute::DiskType::Ssd, "Uncorrectable_Error_Cnt"); // OCZ SSD (smartctl) - add(187, StorageAttribute::DiskType::Ssd, "Total_Unc_NAND_Reads", "Total Uncorrectable NAND Reads", "", + add(187, AtaStorageAttribute::DiskType::Ssd, "Total_Unc_NAND_Reads", "Total Uncorrectable NAND Reads", "", ""); // Command Timeout (smartctl) add(188, "Command_Timeout", "Command Timeout", "", "Number of aborted operations due to drive timeout. High values may indicate problems with cabling or power supply."); // Micron SSD (smartctl) - add(188, StorageAttribute::DiskType::Ssd, "Command_Timeouts", "Command Timeout", "", + add(188, AtaStorageAttribute::DiskType::Ssd, "Command_Timeouts", "Command Timeout", "", "Number of aborted operations due to drive timeout. High values may indicate problems with cabling or power supply."); // High Fly Writes (smartctl) - add(189, StorageAttribute::DiskType::Hdd, "High_Fly_Writes", "High Fly Writes", "", + add(189, AtaStorageAttribute::DiskType::Hdd, "High_Fly_Writes", "High Fly Writes", "", "Some drives can detect when a recording head is flying outside its normal operating range. " "If an unsafe fly height condition is encountered, the write process is stopped, and the information " "is rewritten or reallocated to a safe region of the drive. This attribute indicates the count of " "these errors detected over the lifetime of the drive."); // Crucial / Marvell SSD (smartctl) - add(189, StorageAttribute::DiskType::Ssd, "Factory_Bad_Block_Ct", "Factory Bad Block Count", "", + add(189, AtaStorageAttribute::DiskType::Ssd, "Factory_Bad_Block_Ct", "Factory Bad Block Count", "", "Factory-determined number of initial bad blocks."); // Various SSD (smartctl) add(189, "Airflow_Temperature_Cel", "Airflow Temperature", "", @@ -468,38 +468,38 @@ namespace { add(190, "Temperature_Case", "Case Temperature (Celsius)", "", "Drive case temperature. The Raw value shows built-in heat sensor registrations (in Celsius)."); // G-sense error rate (smartctl) (same as 221?) - add(191, StorageAttribute::DiskType::Hdd, "G-Sense_Error_Rate", "G-Sense Error Rate", "", + add(191, AtaStorageAttribute::DiskType::Hdd, "G-Sense_Error_Rate", "G-Sense Error Rate", "", "Number of errors caused by externally-induced shock and vibration (Raw value). May indicate incorrect installation."); // Power-Off Retract Cycle (smartctl) - add(192, StorageAttribute::DiskType::Hdd, "Power-Off_Retract_Count", "Head Retract Cycle Count", "", + add(192, AtaStorageAttribute::DiskType::Hdd, "Power-Off_Retract_Count", "Head Retract Cycle Count", "", "Number of times the heads were loaded off the media (during power-offs or emergency conditions)."); // Intel SSD: Unsafe_Shutdown_Count (smartctl) - add(192, StorageAttribute::DiskType::Ssd, "Unsafe_Shutdown_Count", "Unsafe Shutdown Count", "", + add(192, AtaStorageAttribute::DiskType::Ssd, "Unsafe_Shutdown_Count", "Unsafe Shutdown Count", "", "Raw value indicates the number of unsafe (unclean) shutdown events over the drive lifetime. " "An unsafe shutdown occurs whenever the device is powered off without " "STANDBY IMMEDIATE being the last command."); // Various SSDs (smartctl) - add(192, StorageAttribute::DiskType::Ssd, "Unexpect_Power_Loss_Ct", "Unexpected Power Loss Count", "", + add(192, AtaStorageAttribute::DiskType::Ssd, "Unexpect_Power_Loss_Ct", "Unexpected Power Loss Count", "", "Number of unexpected power loss events."); // Fujitsu: Emergency Retract Cycle Count (smartctl) - add(192, StorageAttribute::DiskType::Hdd, "Emerg_Retract_Cycle_Ct", "Emergency Retract Cycle Count", "", + add(192, AtaStorageAttribute::DiskType::Hdd, "Emerg_Retract_Cycle_Ct", "Emergency Retract Cycle Count", "", "Number of times the heads were loaded off the media during emergency conditions."); // Load/Unload Cycle (smartctl) - add(193, StorageAttribute::DiskType::Hdd, "Load_Cycle_Count", "Load / Unload Cycle", "", + add(193, AtaStorageAttribute::DiskType::Hdd, "Load_Cycle_Count", "Load / Unload Cycle", "", "Number of load / unload cycles into Landing Zone position."); // Temperature Celsius (smartctl) (same as 231). This is the most common one. Some Samsungs: 10xTemp. add(194, "Temperature_Celsius", "Temperature (Celsius)", "attr_temperature_celsius", "Drive temperature. The Raw value shows built-in heat sensor registrations (in Celsius). " "Increases in average drive temperature often signal spindle motor problems (unless the increases are caused by environmental factors)."); // Samsung SSD: Temperature Celsius (smartctl) (not sure about the value) - add(194, StorageAttribute::DiskType::Ssd, "Airflow_Temperature", "Airflow Temperature (Celsius)", "attr_temperature_celsius", + add(194, AtaStorageAttribute::DiskType::Ssd, "Airflow_Temperature", "Airflow Temperature (Celsius)", "attr_temperature_celsius", "Drive temperature (Celsius)"); // Temperature Celsius x 10 (smartctl) add(194, "Temperature_Celsius_x10", "Temperature (Celsius) x 10", "attr_temperature_celsius_x10", "Drive temperature. The Raw value shows built-in heat sensor registrations (in Celsius * 10). " "Increases in average drive temperature often signal spindle motor problems (unless the increases are caused by environmental factors)."); // Smart Storage Systems SSD (smartctl) - add(194, StorageAttribute::DiskType::Ssd, "Proprietary_194", "Internal Attribute", "", + add(194, AtaStorageAttribute::DiskType::Ssd, "Proprietary_194", "Internal Attribute", "", "This attribute has been reserved by vendor as internal."); // Intel SSD (smartctl) add(194, "Temperature_Internal", "Internal Temperature (Celsius)", "attr_temperature_celsius", @@ -508,32 +508,32 @@ namespace { add(195, "Hardware_ECC_Recovered", "Hardware ECC Recovered", "", "Number of ECC on the fly errors (Raw value). Users are advised to ignore this attribute."); // Fujitsu: ECC_On_The_Fly_Count (smartctl) - add(195, StorageAttribute::DiskType::Hdd, "ECC_On_The_Fly_Count"); + add(195, AtaStorageAttribute::DiskType::Hdd, "ECC_On_The_Fly_Count"); // Sandforce SSD: ECC_Uncorr_Error_Count (smartctl) (description?) - add(195, StorageAttribute::DiskType::Ssd, "ECC_Uncorr_Error_Count", "Uncorrected ECC Error Count", "", + add(195, AtaStorageAttribute::DiskType::Ssd, "ECC_Uncorr_Error_Count", "Uncorrected ECC Error Count", "", "Number of uncorrectable errors (UECC)."); // Samsung SSD (smartctl) (description?) - add(195, StorageAttribute::DiskType::Ssd, "ECC_Rate", "Uncorrected ECC Error Rate", "", + add(195, AtaStorageAttribute::DiskType::Ssd, "ECC_Rate", "Uncorrected ECC Error Rate", "", ""); // OCZ SSD (smartctl) - add(195, StorageAttribute::DiskType::Ssd, "Total_Prog_Failures", "Total Program Failures", "", + add(195, AtaStorageAttribute::DiskType::Ssd, "Total_Prog_Failures", "Total Program Failures", "", ""); // Indilinx Barefoot SSD: Program_Failure_Blk_Ct (smartctl) (description?) - add(195, StorageAttribute::DiskType::Ssd, "Program_Failure_Blk_Ct", "Program Failure Block Count", "", + add(195, AtaStorageAttribute::DiskType::Ssd, "Program_Failure_Blk_Ct", "Program Failure Block Count", "", "Number of flash program (write) failures."); // Micron SSD (smartctl) - add(195, StorageAttribute::DiskType::Ssd, "Cumulativ_Corrected_ECC", "Cumulative Corrected ECC Error Count", "", + add(195, AtaStorageAttribute::DiskType::Ssd, "Cumulativ_Corrected_ECC", "Cumulative Corrected ECC Error Count", "", ""); // Reallocation Event Count (smartctl) - add(196, StorageAttribute::DiskType::Any, "Reallocated_Event_Count", "Reallocation Event Count", "attr_reallocation_event_count", + add(196, AtaStorageAttribute::DiskType::Any, "Reallocated_Event_Count", "Reallocation Event Count", "attr_reallocation_event_count", "Number of reallocation (remap) operations. Raw value should show the total number of attempts " "(both successful and unsuccessful) to reallocate sectors. An increase in Raw value indicates a disk surface failure." "\n\n" + get_uncorrectable_text()); // Indilinx Barefoot SSD: Erase_Failure_Blk_Ct (smartctl) (description?) - add(196, StorageAttribute::DiskType::Ssd, "Erase_Failure_Blk_Ct", "Erase Failure Block Count", "", + add(196, AtaStorageAttribute::DiskType::Ssd, "Erase_Failure_Blk_Ct", "Erase Failure Block Count", "", "Number of flash erase failures."); // OCZ SSD (smartctl) - add(196, StorageAttribute::DiskType::Ssd, "Total_Erase_Failures", "Total Erase Failures", "", + add(196, AtaStorageAttribute::DiskType::Ssd, "Total_Erase_Failures", "Total Erase Failures", "", ""); // Current Pending Sector Count (smartctl) add(197, "Current_Pending_Sector", "Current Pending Sector Count", "attr_current_pending_sector_count", @@ -542,7 +542,7 @@ namespace { "An increase in Raw value indicates a disk surface failure." "\n\n" + get_uncorrectable_text()); // Indilinx Barefoot SSD: Read_Failure_Blk_Ct (smartctl) (description?) - add(197, StorageAttribute::DiskType::Ssd, "Read_Failure_Blk_Ct", "Read Failure Block Count", "", + add(197, AtaStorageAttribute::DiskType::Ssd, "Read_Failure_Blk_Ct", "Read Failure Block Count", "", "Number of blocks that failed to be read."); // Samsung: Total_Pending_Sectors (smartctl). From smartctl man page: // unlike Current_Pending_Sector, this won't decrease on reallocation. @@ -551,7 +551,7 @@ namespace { "An increase in Raw value indicates a disk surface failure." "\n\n" + get_uncorrectable_text()); // OCZ SSD (smartctl) - add(197, StorageAttribute::DiskType::Ssd, "Total_Unc_Read_Failures", "Total Uncorrectable Read Failures", "", + add(197, AtaStorageAttribute::DiskType::Ssd, "Total_Unc_Read_Failures", "Total Uncorrectable Read Failures", "", ""); // Offline Uncorrectable (smartctl) add(198, "Offline_Uncorrectable", "Offline Uncorrectable", "attr_offline_uncorrectable", @@ -567,17 +567,17 @@ namespace { "An increase in Raw value indicates a disk surface failure." "\n\n" + get_uncorrectable_text()); // Sandforce SSD: Uncorrectable_Sector_Ct (smartctl) (same description?) - add(198, StorageAttribute::DiskType::Ssd, "Uncorrectable_Sector_Ct"); + add(198, AtaStorageAttribute::DiskType::Ssd, "Uncorrectable_Sector_Ct"); // Indilinx Barefoot SSD: Read_Sectors_Tot_Ct (smartctl) (description?) - add(198, StorageAttribute::DiskType::Ssd, "Read_Sectors_Tot_Ct", "Total Read Sectors", "", + add(198, AtaStorageAttribute::DiskType::Ssd, "Read_Sectors_Tot_Ct", "Total Read Sectors", "", "Total count of read sectors."); // OCZ SSD - add(198, StorageAttribute::DiskType::Ssd, "Host_Reads_GiB", "Host Read (GiB)", "", + add(198, AtaStorageAttribute::DiskType::Ssd, "Host_Reads_GiB", "Host Read (GiB)", "", "Total number of sectors read by the host system. The Raw value is increased by 1 for every GiB read by the host."); // Fujitsu: Offline_Scan_UNC_SectCt (smartctl) - add(198, StorageAttribute::DiskType::Hdd, "Offline_Scan_UNC_SectCt"); + add(198, AtaStorageAttribute::DiskType::Hdd, "Offline_Scan_UNC_SectCt"); // Fujitsu version of Offline Uncorrectable (smartctl) (old, not in current smartctl) - add(198, StorageAttribute::DiskType::Hdd, "Off-line_Scan_UNC_Sector_Ct"); + add(198, AtaStorageAttribute::DiskType::Hdd, "Off-line_Scan_UNC_Sector_Ct"); // UDMA CRC Error Count (smartctl) add(199, "UDMA_CRC_Error_Count", "UDMA CRC Error Count", "", "Number of errors in data transfer via the interface cable in UDMA mode, as determined by ICRC " @@ -592,464 +592,464 @@ namespace { add(199, "CRC_Error_Count", "CRC Error Count", "", "Number of errors in data transfer via the interface cable (Raw value)."); // Indilinx Barefoot SSD: Write_Sectors_Tot_Ct (smartctl) (description?) - add(199, StorageAttribute::DiskType::Ssd, "Write_Sectors_Tot_Ct", "Total Written Sectors", "", + add(199, AtaStorageAttribute::DiskType::Ssd, "Write_Sectors_Tot_Ct", "Total Written Sectors", "", "Total count of written sectors."); // OCZ SSD - add(198, StorageAttribute::DiskType::Ssd, "Host_Writes_GiB", "Host Written (GiB)", "", + add(198, AtaStorageAttribute::DiskType::Ssd, "Host_Writes_GiB", "Host Written (GiB)", "", "Total number of sectors written by the host system. The Raw value is increased by 1 for every GiB written by the host."); // WD: Multi-Zone Error Rate (smartctl). (maybe head flying height too (?)) - add(200, StorageAttribute::DiskType::Hdd, "Multi_Zone_Error_Rate", "Multi Zone Error Rate", "", + add(200, AtaStorageAttribute::DiskType::Hdd, "Multi_Zone_Error_Rate", "Multi Zone Error Rate", "", "Number of errors found when writing to sectors (Raw value). The higher the value, the worse the disk surface condition and/or mechanical subsystem is."); // Fujitsu: Write Error Rate (smartctl) - add(200, StorageAttribute::DiskType::Hdd, "Write_Error_Count", "Write Error Count", "", + add(200, AtaStorageAttribute::DiskType::Hdd, "Write_Error_Count", "Write Error Count", "", "Number of errors found when writing to sectors (Raw value). The higher the value, the worse the disk surface condition and/or mechanical subsystem is."); // Indilinx Barefoot SSD: Read_Commands_Tot_Ct (smartctl) (description?) - add(200, StorageAttribute::DiskType::Ssd, "Read_Commands_Tot_Ct", "Total Read Commands Issued", "", + add(200, AtaStorageAttribute::DiskType::Ssd, "Read_Commands_Tot_Ct", "Total Read Commands Issued", "", "Total count of read commands issued."); // Soft Read Error Rate (smartctl) (description?) - add(201, StorageAttribute::DiskType::Hdd, "Soft_Read_Error_Rate", "Soft Read Error Rate", "attr_soft_read_error_rate", + add(201, AtaStorageAttribute::DiskType::Hdd, "Soft_Read_Error_Rate", "Soft Read Error Rate", "attr_soft_read_error_rate", "Uncorrected read errors reported to the operating system (Raw value). If the value is non-zero, you should back up your data."); // Sandforce SSD: Unc_Soft_Read_Err_Rate (smartctl) - add(201, StorageAttribute::DiskType::Ssd, "Unc_Soft_Read_Err_Rate"); + add(201, AtaStorageAttribute::DiskType::Ssd, "Unc_Soft_Read_Err_Rate"); // Samsung SSD: (smartctl) (description?) - add(201, StorageAttribute::DiskType::Ssd, "Supercap_Status", "Supercapacitor Health", "", + add(201, AtaStorageAttribute::DiskType::Ssd, "Supercap_Status", "Supercapacitor Health", "", ""); // Maxtor: Off Track Errors (custom) -// add(201, StorageAttribute::DiskType::Hdd, "", "Off Track Errors", "", // unused +// add(201, AtaStorageAttribute::DiskType::Hdd, "", "Off Track Errors", "", // unused // ""); // Fujitsu: Detected TA Count (smartctl) (description?) - add(201, StorageAttribute::DiskType::Hdd, "Detected_TA_Count", "Torque Amplification Count", "", + add(201, AtaStorageAttribute::DiskType::Hdd, "Detected_TA_Count", "Torque Amplification Count", "", "Number of attempts to compensate for platter speed variations."); // Indilinx Barefoot SSD: Write_Commands_Tot_Ct (smartctl) (description?) - add(201, StorageAttribute::DiskType::Ssd, "Write_Commands_Tot_Ct", "Total Write Commands Issued", "", + add(201, AtaStorageAttribute::DiskType::Ssd, "Write_Commands_Tot_Ct", "Total Write Commands Issued", "", "Total count of write commands issued."); // WD: Data Address Mark Errors (smartctl) - add(202, StorageAttribute::DiskType::Hdd, "Data_Address_Mark_Errs", "Data Address Mark Errors", "", + add(202, AtaStorageAttribute::DiskType::Hdd, "Data_Address_Mark_Errs", "Data Address Mark Errors", "", "Frequency of the Data Address Mark errors."); // Fujitsu: TA Increase Count (same as 227?) - add(202, StorageAttribute::DiskType::Hdd, "TA_Increase_Count", "TA Increase Count", "", + add(202, AtaStorageAttribute::DiskType::Hdd, "TA_Increase_Count", "TA Increase Count", "", "Number of attempts to compensate for platter speed variations."); // Indilinx Barefoot SSD: Error_Bits_Flash_Tot_Ct (smartctl) (description?) - add(202, StorageAttribute::DiskType::Ssd, "Error_Bits_Flash_Tot_Ct", "Total Count of Error Bits", "", + add(202, AtaStorageAttribute::DiskType::Ssd, "Error_Bits_Flash_Tot_Ct", "Total Count of Error Bits", "", ""); // Crucial / Marvell SSD: Percent_Lifetime_Used (smartctl) (description?) - add(202, StorageAttribute::DiskType::Ssd, "Percent_Lifetime_Used", "Rated Life Used (%)", "attr_ssd_life_used", + add(202, AtaStorageAttribute::DiskType::Ssd, "Percent_Lifetime_Used", "Rated Life Used (%)", "attr_ssd_life_used", "Used drive life in %."); // Samsung SSD: (smartctl) (description?) - add(202, StorageAttribute::DiskType::Ssd, "Exception_Mode_Status", "Exception Mode Status", "", + add(202, AtaStorageAttribute::DiskType::Ssd, "Exception_Mode_Status", "Exception Mode Status", "", ""); // OCZ SSD (smartctl) (description?) - add(202, StorageAttribute::DiskType::Ssd, "Total_Read_Bits_Corr_Ct", "Total Read Bits Corrected", "", + add(202, AtaStorageAttribute::DiskType::Ssd, "Total_Read_Bits_Corr_Ct", "Total Read Bits Corrected", "", ""); // Micron SSD (smartctl) (description?) - add(202, StorageAttribute::DiskType::Ssd, "Percent_Lifetime_Remain", "Remaining Lifetime (%)", "attr_ssd_life_left", + add(202, AtaStorageAttribute::DiskType::Ssd, "Percent_Lifetime_Remain", "Remaining Lifetime (%)", "attr_ssd_life_left", "Remaining drive life in %."); // Run Out Cancel (smartctl). (description?) add(203, "Run_Out_Cancel", "Run Out Cancel", "", "Number of ECC errors."); // Maxtor: ECC Errors (smartctl) (description?) - add(203, StorageAttribute::DiskType::Hdd, "Corr_Read_Errors_Tot_Ct", "ECC Errors", "", + add(203, AtaStorageAttribute::DiskType::Hdd, "Corr_Read_Errors_Tot_Ct", "ECC Errors", "", "Number of ECC errors."); // Indilinx Barefoot SSD: Corr_Read_Errors_Tot_Ct (smartctl) (description?) - add(203, StorageAttribute::DiskType::Ssd, "Corr_Read_Errors_Tot_Ct", "Total Corrected Read Errors", "", + add(203, AtaStorageAttribute::DiskType::Ssd, "Corr_Read_Errors_Tot_Ct", "Total Corrected Read Errors", "", "Total cound of read sectors with correctable errors."); // Maxtor: Soft ECC Correction (smartctl) - add(204, StorageAttribute::DiskType::Hdd, "Soft_ECC_Correction", "Soft ECC Correction", "", + add(204, AtaStorageAttribute::DiskType::Hdd, "Soft_ECC_Correction", "Soft ECC Correction", "", "Number of errors corrected by software ECC (Error-Correcting Code)."); // Fujitsu: Shock_Count_Write_Opern (smartctl) (description?) - add(204, StorageAttribute::DiskType::Hdd, "Shock_Count_Write_Opern", "Shock Count During Write Operation", "", + add(204, AtaStorageAttribute::DiskType::Hdd, "Shock_Count_Write_Opern", "Shock Count During Write Operation", "", ""); // Sandforce SSD: Soft_ECC_Correct_Rate (smartctl) (description?) - add(204, StorageAttribute::DiskType::Ssd, "Soft_ECC_Correct_Rate", "Soft ECC Correction Rate", "", + add(204, AtaStorageAttribute::DiskType::Ssd, "Soft_ECC_Correct_Rate", "Soft ECC Correction Rate", "", ""); // Indilinx Barefoot SSD: Bad_Block_Full_Flag (smartctl) (description?) - add(204, StorageAttribute::DiskType::Ssd, "Bad_Block_Full_Flag", "Bad Block Area Is Full", "", + add(204, AtaStorageAttribute::DiskType::Ssd, "Bad_Block_Full_Flag", "Bad Block Area Is Full", "", "Indicates whether the bad block (reserved) area is full or not."); // Thermal Asperity Rate (TAR) (smartctl) add(205, "Thermal_Asperity_Rate", "Thermal Asperity Rate", "", "Number of problems caused by high temperature."); // Fujitsu: Shock_Rate_Write_Opern (smartctl) (description?) - add(205, StorageAttribute::DiskType::Hdd, "Shock_Rate_Write_Opern", "Shock Rate During Write Operation", "", + add(205, AtaStorageAttribute::DiskType::Hdd, "Shock_Rate_Write_Opern", "Shock Rate During Write Operation", "", ""); // Indilinx Barefoot SSD: Max_PE_Count_Spec (smartctl) (description?) - add(205, StorageAttribute::DiskType::Ssd, "Max_PE_Count_Spec", "Maximum Program-Erase Count Specification", "", + add(205, AtaStorageAttribute::DiskType::Ssd, "Max_PE_Count_Spec", "Maximum Program-Erase Count Specification", "", "Maximum Program / Erase cycle count as per specification."); // OCZ SSD (smartctl) - add(205, StorageAttribute::DiskType::Ssd, "Max_Rated_PE_Count", "Maximum Rated Program-Erase Count", "", + add(205, AtaStorageAttribute::DiskType::Ssd, "Max_Rated_PE_Count", "Maximum Rated Program-Erase Count", "", "Maximum Program / Erase cycle count as per specification."); // Flying Height (smartctl) - add(206, StorageAttribute::DiskType::Hdd, "Flying_Height", "Head Flying Height", "", + add(206, AtaStorageAttribute::DiskType::Hdd, "Flying_Height", "Head Flying Height", "", "The height of the disk heads above the disk surface. A downward trend will often predict a head crash, " "while high values may cause read / write errors."); // Indilinx Barefoot SSD, OCZ SSD: Min_Erase_Count (smartctl) (description?) - add(206, StorageAttribute::DiskType::Ssd, "Min_Erase_Count", "Minimum Erase Count", "", + add(206, AtaStorageAttribute::DiskType::Ssd, "Min_Erase_Count", "Minimum Erase Count", "", "The minimum of individual erase counts of all the blocks."); // Crucial / Marvell SSD: Write_Error_Rate (smartctl) (description?) - add(206, StorageAttribute::DiskType::Ssd, "Write_Error_Rate", "Write Error Rate", "", + add(206, AtaStorageAttribute::DiskType::Ssd, "Write_Error_Rate", "Write Error Rate", "", ""); // Spin High Current (smartctl) - add(207, StorageAttribute::DiskType::Hdd, "Spin_High_Current", "Spin High Current", "", + add(207, AtaStorageAttribute::DiskType::Hdd, "Spin_High_Current", "Spin High Current", "", "Amount of high current needed or used to spin up the drive."); // Indilinx Barefoot SSD, OCZ SSD: Max_Erase_Count (smartctl) (description?) - add(207, StorageAttribute::DiskType::Ssd, "Max_Erase_Count", "Maximum Erase Count", "", + add(207, AtaStorageAttribute::DiskType::Ssd, "Max_Erase_Count", "Maximum Erase Count", "", ""); // Spin Buzz (smartctl) - add(208, StorageAttribute::DiskType::Hdd, "Spin_Buzz", "Spin Buzz", "", + add(208, AtaStorageAttribute::DiskType::Hdd, "Spin_Buzz", "Spin Buzz", "", "Number of buzz routines (retries because of low current) to spin up the drive."); // Indilinx Barefoot SSD, OCZ SSD: Average_Erase_Count (smartctl) (description?) - add(208, StorageAttribute::DiskType::Ssd, "Average_Erase_Count", "Average Erase Count", "", + add(208, AtaStorageAttribute::DiskType::Ssd, "Average_Erase_Count", "Average Erase Count", "", "The average of individual erase counts of all the blocks."); // Offline Seek Performance (smartctl) (description?) - add(209, StorageAttribute::DiskType::Hdd, "Offline_Seek_Performnce", "Offline Seek Performance", "", + add(209, AtaStorageAttribute::DiskType::Hdd, "Offline_Seek_Performnce", "Offline Seek Performance", "", "Seek performance during Offline Data Collection operations."); // Indilinx Barefoot SSD, OCZ SSD: Remaining_Lifetime_Perc (smartctl) (description?) - add(209, StorageAttribute::DiskType::Ssd, "Remaining_Lifetime_Perc", "Remaining Lifetime (%)", "attr_ssd_life_left", + add(209, AtaStorageAttribute::DiskType::Ssd, "Remaining_Lifetime_Perc", "Remaining Lifetime (%)", "attr_ssd_life_left", "Remaining drive life in % (usually by erase count)."); // Vibration During Write (custom). wikipedia says 211, but it's wrong. (description?) - add(210, StorageAttribute::DiskType::Hdd, "", "Vibration During Write", "", + add(210, AtaStorageAttribute::DiskType::Hdd, "", "Vibration During Write", "", "Vibration encountered during write operations."); // OCZ SSD (smartctl) - add(210, StorageAttribute::DiskType::Ssd, "SATA_CRC_Error_Count", "SATA CRC Error Count", "", + add(210, AtaStorageAttribute::DiskType::Ssd, "SATA_CRC_Error_Count", "SATA CRC Error Count", "", ""); // Indilinx Barefoot SSD: Indilinx_Internal (smartctl) (description?) - add(210, StorageAttribute::DiskType::Ssd, "Indilinx_Internal", "Internal Attribute", "", + add(210, AtaStorageAttribute::DiskType::Ssd, "Indilinx_Internal", "Internal Attribute", "", "This attribute has been reserved by vendor as internal."); // Crucial / Micron SSD (smartctl) - add(210, StorageAttribute::DiskType::Ssd, "Success_RAIN_Recov_Cnt", "Success RAIN Recovered Count", "", + add(210, AtaStorageAttribute::DiskType::Ssd, "Success_RAIN_Recov_Cnt", "Success RAIN Recovered Count", "", ""); // Vibration During Read (description?) - add(211, StorageAttribute::DiskType::Hdd, "", "Vibration During Read", "", + add(211, AtaStorageAttribute::DiskType::Hdd, "", "Vibration During Read", "", "Vibration encountered during read operations."); // Indilinx Barefoot SSD (smartctl) (description?) - add(211, StorageAttribute::DiskType::Ssd, "SATA_Error_Ct_CRC", "SATA CRC Error Count", "", + add(211, AtaStorageAttribute::DiskType::Ssd, "SATA_Error_Ct_CRC", "SATA CRC Error Count", "", "Number of errors in data transfer via the SATA interface cable"); // OCZ SSD (smartctl) (description?) - add(211, StorageAttribute::DiskType::Ssd, "SATA_UNC_Count", "SATA Uncorrectable Error Count", "", + add(211, AtaStorageAttribute::DiskType::Ssd, "SATA_UNC_Count", "SATA Uncorrectable Error Count", "", "Number of errors in data transfer via the SATA interface cable"); // Shock During Write (custom) (description?) - add(212, StorageAttribute::DiskType::Hdd, "", "Shock During Write", "", + add(212, AtaStorageAttribute::DiskType::Hdd, "", "Shock During Write", "", "Shock encountered during write operations"); // Indilinx Barefoot SSD: SATA_Error_Ct_Handshake (smartctl) (description?) - add(212, StorageAttribute::DiskType::Ssd, "SATA_Error_Ct_Handshake", "SATA Handshake Error Count", "", + add(212, AtaStorageAttribute::DiskType::Ssd, "SATA_Error_Ct_Handshake", "SATA Handshake Error Count", "", "Number of errors occurring during SATA handshake."); // OCZ SSD (smartctl) (description?) - add(212, StorageAttribute::DiskType::Ssd, "Pages_Requiring_Rd_Rtry", "Pages Requiring Read Retry", "", + add(212, AtaStorageAttribute::DiskType::Ssd, "Pages_Requiring_Rd_Rtry", "Pages Requiring Read Retry", "", ""); // OCZ SSD (smartctl) (description?) - add(212, StorageAttribute::DiskType::Ssd, "NAND_Reads_with_Retry", "Number of NAND Reads with Retry", "", + add(212, AtaStorageAttribute::DiskType::Ssd, "NAND_Reads_with_Retry", "Number of NAND Reads with Retry", "", ""); // Sandisk SSDs: (smartctl) (description?) - add(212, StorageAttribute::DiskType::Ssd, "SATA_PHY_Error", "SATA Physical Error Count", "", + add(212, AtaStorageAttribute::DiskType::Ssd, "SATA_PHY_Error", "SATA Physical Error Count", "", ""); // Indilinx Barefoot SSD: Indilinx_Internal (smartctl) (description?) - add(213, StorageAttribute::DiskType::Ssd, "Indilinx_Internal", "Internal Attribute", "", + add(213, AtaStorageAttribute::DiskType::Ssd, "Indilinx_Internal", "Internal Attribute", "", "This attribute has been reserved by vendor as internal."); // OCZ SSD (smartctl) (description?) - add(213, StorageAttribute::DiskType::Ssd, "Simple_Rd_Rtry_Attempts", "Simple Read Retry Attempts", "", + add(213, AtaStorageAttribute::DiskType::Ssd, "Simple_Rd_Rtry_Attempts", "Simple Read Retry Attempts", "", ""); // OCZ SSD (smartctl) (description?) - add(213, StorageAttribute::DiskType::Ssd, "Snmple_Retry_Attempts", "Simple Retry Attempts", "", + add(213, AtaStorageAttribute::DiskType::Ssd, "Snmple_Retry_Attempts", "Simple Retry Attempts", "", ""); // OCZ SSD (smartctl) (description?) - add(213, StorageAttribute::DiskType::Ssd, "Simple_Retry_Attempts", "Simple Retry Attempts", "", + add(213, AtaStorageAttribute::DiskType::Ssd, "Simple_Retry_Attempts", "Simple Retry Attempts", "", ""); // OCZ SSD (smartctl) (description?) - add(213, StorageAttribute::DiskType::Ssd, "Adaptv_Rd_Rtry_Attempts", "Adaptive Read Retry Attempts", "", + add(213, AtaStorageAttribute::DiskType::Ssd, "Adaptv_Rd_Rtry_Attempts", "Adaptive Read Retry Attempts", "", ""); // OCZ SSD (smartctl) (description?) - add(214, StorageAttribute::DiskType::Ssd, "Adaptive_Retry_Attempts", "Adaptive Retry Attempts", "", + add(214, AtaStorageAttribute::DiskType::Ssd, "Adaptive_Retry_Attempts", "Adaptive Retry Attempts", "", ""); // Kingston SSD (smartctl) - add(218, StorageAttribute::DiskType::Ssd, "CRC_Error_Count", "CRC Error Count", "", + add(218, AtaStorageAttribute::DiskType::Ssd, "CRC_Error_Count", "CRC Error Count", "", ""); // Disk Shift (smartctl) // Note: There's also smartctl shortcut option "-v 220,temp" (possibly for Temperature Celsius), // but it's not used anywhere, so we ignore it. - add(220, StorageAttribute::DiskType::Hdd, "Disk_Shift", "Disk Shift", "", + add(220, AtaStorageAttribute::DiskType::Hdd, "Disk_Shift", "Disk Shift", "", "Shift of disks towards spindle. Shift of disks is possible as a result of a strong shock or a fall, high temperature, or some other reasons."); // G-sense error rate (smartctl) - add(221, StorageAttribute::DiskType::Hdd, "G-Sense_Error_Rate", "G-Sense Error Rate", "", + add(221, AtaStorageAttribute::DiskType::Hdd, "G-Sense_Error_Rate", "G-Sense Error Rate", "", "Number of errors resulting from externally-induced shock and vibration (Raw value). May indicate incorrect installation."); // OCZ SSD (smartctl) (description?) - add(213, StorageAttribute::DiskType::Ssd, "Int_Data_Path_Prot_Unc", "Internal Data Path Protection Uncorrectable", "", + add(213, AtaStorageAttribute::DiskType::Ssd, "Int_Data_Path_Prot_Unc", "Internal Data Path Protection Uncorrectable", "", ""); // Loaded Hours (smartctl) - add(222, StorageAttribute::DiskType::Hdd, "Loaded_Hours", "Loaded Hours", "", + add(222, AtaStorageAttribute::DiskType::Hdd, "Loaded_Hours", "Loaded Hours", "", "Number of hours spent operating under load (movement of magnetic head armature) (Raw value)"); // OCZ SSD (smartctl) (description?) - add(222, StorageAttribute::DiskType::Ssd, "RAID_Recovery_Count", "RAID Recovery Count", "", + add(222, AtaStorageAttribute::DiskType::Ssd, "RAID_Recovery_Count", "RAID Recovery Count", "", ""); // Load/Unload Retry Count (smartctl) (description?) - add(223, StorageAttribute::DiskType::Hdd, "Load_Retry_Count", "Load / Unload Retry Count", "", + add(223, AtaStorageAttribute::DiskType::Hdd, "Load_Retry_Count", "Load / Unload Retry Count", "", "Number of times the head armature entered / left the data zone."); // Load Friction (smartctl) - add(224, StorageAttribute::DiskType::Hdd, "Load_Friction", "Load Friction", "", + add(224, AtaStorageAttribute::DiskType::Hdd, "Load_Friction", "Load Friction", "", "Resistance caused by friction in mechanical parts while operating. An increase of Raw value may mean that there is " "a problem with the mechanical subsystem of the drive."); // OCZ SSD (smartctl) (description?) - add(224, StorageAttribute::DiskType::Ssd, "In_Warranty", "In Warranty", "", + add(224, AtaStorageAttribute::DiskType::Ssd, "In_Warranty", "In Warranty", "", ""); // Load/Unload Cycle Count (smartctl) (description?) - add(225, StorageAttribute::DiskType::Hdd, "Load_Cycle_Count", "Load / Unload Cycle Count", "", + add(225, AtaStorageAttribute::DiskType::Hdd, "Load_Cycle_Count", "Load / Unload Cycle Count", "", "Total number of load cycles."); // Intel SSD: Host_Writes_32MiB (smartctl) (description?) - add(225, StorageAttribute::DiskType::Ssd, "Host_Writes_32MiB", "Host Written (32 MiB)", "", + add(225, AtaStorageAttribute::DiskType::Ssd, "Host_Writes_32MiB", "Host Written (32 MiB)", "", "Total number of sectors written by the host system. The Raw value is increased by 1 for every 32 MiB written by the host."); // OCZ SSD (smartctl) (description?) - add(225, StorageAttribute::DiskType::Ssd, "DAS_Polarity", "DAS Polarity", "", + add(225, AtaStorageAttribute::DiskType::Ssd, "DAS_Polarity", "DAS Polarity", "", ""); // Innodisk SSDs: (smartctl) (description?) - add(225, StorageAttribute::DiskType::Ssd, "Data_Log_Write_Count", "Data Log Write Count", "", + add(225, AtaStorageAttribute::DiskType::Ssd, "Data_Log_Write_Count", "Data Log Write Count", "", ""); // Load-in Time (smartctl) - add(226, StorageAttribute::DiskType::Hdd, "Load-in_Time", "Load-in Time", "", + add(226, AtaStorageAttribute::DiskType::Hdd, "Load-in_Time", "Load-in Time", "", "Total time of loading on the magnetic heads actuator. Indicates total time in which the drive was under load " "(on the assumption that the magnetic heads were in operating mode and out of the parking area)."); // Intel SSD: Intel_Internal (smartctl) - add(226, StorageAttribute::DiskType::Ssd, "Intel_Internal", "Internal Attribute", "", + add(226, AtaStorageAttribute::DiskType::Ssd, "Intel_Internal", "Internal Attribute", "", "This attribute has been reserved by vendor as internal."); // Intel SSD: Workld_Media_Wear_Indic (smartctl) - add(226, StorageAttribute::DiskType::Ssd, "Workld_Media_Wear_Indic", "Timed Workload Media Wear", "", + add(226, AtaStorageAttribute::DiskType::Ssd, "Workld_Media_Wear_Indic", "Timed Workload Media Wear", "", "Timed workload media wear indicator (percent*1024)"); // OCZ SSD (smartctl) (description?) - add(226, StorageAttribute::DiskType::Ssd, "Partial_Pfail", "Partial Program Fail", "", + add(226, AtaStorageAttribute::DiskType::Ssd, "Partial_Pfail", "Partial Program Fail", "", ""); // Torque Amplification Count (aka TA) (smartctl) - add(227, StorageAttribute::DiskType::Hdd, "Torq-amp_Count", "Torque Amplification Count", "", + add(227, AtaStorageAttribute::DiskType::Hdd, "Torq-amp_Count", "Torque Amplification Count", "", "Number of attempts to compensate for platter speed variations."); // Intel SSD: Intel_Internal (smartctl) - add(227, StorageAttribute::DiskType::Ssd, "Intel_Internal", "Internal Attribute", "", + add(227, AtaStorageAttribute::DiskType::Ssd, "Intel_Internal", "Internal Attribute", "", "This attribute has been reserved by vendor as internal."); // Intel SSD: Workld_Host_Reads_Perc (smartctl) - add(227, StorageAttribute::DiskType::Ssd, "Workld_Host_Reads_Perc", "Timed Workload Host Reads %", "", + add(227, AtaStorageAttribute::DiskType::Ssd, "Workld_Host_Reads_Perc", "Timed Workload Host Reads %", "", ""); // Power-Off Retract Count (smartctl) add(228, "Power-off_Retract_Count", "Power-Off Retract Count", "", "Number of times the magnetic armature was retracted automatically as a result of power loss."); // Intel SSD: Intel_Internal (smartctl) - add(228, StorageAttribute::DiskType::Ssd, "Intel_Internal", "Internal Attribute", "", + add(228, AtaStorageAttribute::DiskType::Ssd, "Intel_Internal", "Internal Attribute", "", "This attribute has been reserved by vendor as internal."); // Intel SSD: Workload_Minutes (smartctl) - add(228, StorageAttribute::DiskType::Ssd, "Workload_Minutes", "Workload (Minutes)", "", + add(228, AtaStorageAttribute::DiskType::Ssd, "Workload_Minutes", "Workload (Minutes)", "", ""); // Transcend SSD: Halt_System_ID (smartctl) (description?) - add(229, StorageAttribute::DiskType::Ssd, "Halt_System_ID", "Halt System ID", "", + add(229, AtaStorageAttribute::DiskType::Ssd, "Halt_System_ID", "Halt System ID", "", "Halt system ID and flash ID"); // InnoDisk SSD (smartctl) - add(229, StorageAttribute::DiskType::Ssd, "Flash_ID", "Flash ID", "", + add(229, AtaStorageAttribute::DiskType::Ssd, "Flash_ID", "Flash ID", "", "Flash ID"); // IBM: GMR Head Amplitude (smartctl) - add(230, StorageAttribute::DiskType::Hdd, "Head_Amplitude", "GMR Head Amplitude", "", + add(230, AtaStorageAttribute::DiskType::Hdd, "Head_Amplitude", "GMR Head Amplitude", "", "Amplitude of heads trembling (GMR-head) in running mode."); // Sandforce SSD: Life_Curve_Status (smartctl) (description?) - add(230, StorageAttribute::DiskType::Ssd, "Life_Curve_Status", "Life Curve Status", "", + add(230, AtaStorageAttribute::DiskType::Ssd, "Life_Curve_Status", "Life Curve Status", "", "Current state of drive operation based upon the Life Curve."); // OCZ SSD (smartctl) (description?) - add(230, StorageAttribute::DiskType::Ssd, "SuperCap_Charge_Status", "Super-Capacitor Charge Status", "", + add(230, AtaStorageAttribute::DiskType::Ssd, "SuperCap_Charge_Status", "Super-Capacitor Charge Status", "", "0 means not charged, 1 - fully charged, 2 - unknown."); // OCZ SSD (smartctl) (description?) - add(230, StorageAttribute::DiskType::Ssd, "Write_Throttling", "Write Throttling", "", + add(230, AtaStorageAttribute::DiskType::Ssd, "Write_Throttling", "Write Throttling", "", ""); // Sandisk SSD (smartctl) (description?) - add(230, StorageAttribute::DiskType::Ssd, "Perc_Write/Erase_Count", "Write / Erase Count (%)", "", + add(230, AtaStorageAttribute::DiskType::Ssd, "Perc_Write/Erase_Count", "Write / Erase Count (%)", "", ""); // Temperature (Some drives) (smartctl) add(231, "Temperature_Celsius", "Temperature", "attr_temperature_celsius", "Drive temperature. The Raw value shows built-in heat sensor registrations (in Celsius). " "Increases in average drive temperature often signal spindle motor problems (unless the increases are caused by environmental factors)."); // Sandforce SSD: SSD_Life_Left - add(231, StorageAttribute::DiskType::Ssd, "SSD_Life_Left", "SSD Life Left", "attr_ssd_life_left", + add(231, AtaStorageAttribute::DiskType::Ssd, "SSD_Life_Left", "SSD Life Left", "attr_ssd_life_left", "A measure of drive's estimated life left. A Normalized value of 100 indicates a new drive. " "10 means there are reserved blocks left but Program / Erase cycles have been used. " "0 means insufficient reserved blocks, drive may be in read-only mode to allow recovery of the data."); // Intel SSD: Available_Reservd_Space (smartctl) (description?) - add(232, StorageAttribute::DiskType::Ssd, "Available_Reservd_Space", "Available reserved space", "", + add(232, AtaStorageAttribute::DiskType::Ssd, "Available_Reservd_Space", "Available reserved space", "", "Number of reserved blocks remaining. The Normalized value indicates percentage, with 100 meaning new and 10 meaning the drive being close to its end of life."); // Transcend SSD: Firmware_Version_information (smartctl) (description?) - add(232, StorageAttribute::DiskType::Ssd, "Firmware_Version_Info", "Firmware Version Information", "", + add(232, AtaStorageAttribute::DiskType::Ssd, "Firmware_Version_Info", "Firmware Version Information", "", "Firmware version information (year, month, day, channels, banks)."); // Same as Firmware_Version_Info, but in older smartctl versions. - add(232, StorageAttribute::DiskType::Ssd, "Firmware_Version_information", "Firmware Version Information", "", + add(232, AtaStorageAttribute::DiskType::Ssd, "Firmware_Version_information", "Firmware Version Information", "", "Firmware version information (year, month, day, channels, banks)."); // OCZ SSD (description?) (smartctl) - add(232, StorageAttribute::DiskType::Ssd, "Lifetime_Writes", "Lifetime_Writes", "", + add(232, AtaStorageAttribute::DiskType::Ssd, "Lifetime_Writes", "Lifetime_Writes", "", ""); // Kingston SSD (description?) (smartctl) - add(232, StorageAttribute::DiskType::Ssd, "Flash_Writes_GiB", "Flash Written (GiB)", "", + add(232, AtaStorageAttribute::DiskType::Ssd, "Flash_Writes_GiB", "Flash Written (GiB)", "", ""); // Innodisk SSD (description?) (smartctl) - add(232, StorageAttribute::DiskType::Ssd, "Spares_Remaining_Perc", "Spare Blocks Remaining (%)", "attr_ssd_life_left", + add(232, AtaStorageAttribute::DiskType::Ssd, "Spares_Remaining_Perc", "Spare Blocks Remaining (%)", "attr_ssd_life_left", "Percentage of spare blocks remaining. Spare blocks are used when bad blocks develop."); // Innodisk SSD (description?) (smartctl) - add(232, StorageAttribute::DiskType::Ssd, "Perc_Avail_Resrvd_Space", "Available Reserved Space (%)", "attr_ssd_life_left", + add(232, AtaStorageAttribute::DiskType::Ssd, "Perc_Avail_Resrvd_Space", "Available Reserved Space (%)", "attr_ssd_life_left", "Percentage of spare blocks remaining. Spare blocks are used when bad blocks develop."); // Intel SSD: Media_Wearout_Indicator (smartctl) (description?) - add(233, StorageAttribute::DiskType::Ssd, "Media_Wearout_Indicator", "Media Wear Out Indicator", "attr_ssd_life_left", + add(233, AtaStorageAttribute::DiskType::Ssd, "Media_Wearout_Indicator", "Media Wear Out Indicator", "attr_ssd_life_left", "Number of cycles the NAND media has experienced. The Normalized value decreases linearly from 100 to 1 as the average erase cycle " "count increases from 0 to the maximum rated cycles."); // OCZ SSD - add(233, StorageAttribute::DiskType::Ssd, "Remaining_Lifetime_Perc", "Remaining Lifetime %", "attr_ssd_life_left", + add(233, AtaStorageAttribute::DiskType::Ssd, "Remaining_Lifetime_Perc", "Remaining Lifetime %", "attr_ssd_life_left", "Remaining drive life in % (usually by erase count)."); // Sandforce SSD: SandForce_Internal (smartctl) (description?) - add(233, StorageAttribute::DiskType::Ssd, "SandForce_Internal", "Internal Attribute", "", + add(233, AtaStorageAttribute::DiskType::Ssd, "SandForce_Internal", "Internal Attribute", "", "This attribute has been reserved by vendor as internal."); // Transcend SSD: ECC_Fail_Record (smartctl) (description?) - add(233, StorageAttribute::DiskType::Ssd, "ECC_Fail_Record", "ECC Failure Record", "", + add(233, AtaStorageAttribute::DiskType::Ssd, "ECC_Fail_Record", "ECC Failure Record", "", "Indicates rate of ECC (error-correcting code) failures."); // Innodisk SSD (smartctl) (description?) - add(233, StorageAttribute::DiskType::Ssd, "Flash_Writes_32MiB", "Flash Written (32MiB)", "", + add(233, AtaStorageAttribute::DiskType::Ssd, "Flash_Writes_32MiB", "Flash Written (32MiB)", "", ""); // Innodisk SSD (smartctl) (description?) - add(233, StorageAttribute::DiskType::Ssd, "Total_NAND_Writes_GiB", "Total NAND Written (GiB)", "", + add(233, AtaStorageAttribute::DiskType::Ssd, "Total_NAND_Writes_GiB", "Total NAND Written (GiB)", "", ""); // Sandforce SSD: SandForce_Internal (smartctl) (description?) - add(234, StorageAttribute::DiskType::Ssd, "SandForce_Internal", "Internal Attribute", "", + add(234, AtaStorageAttribute::DiskType::Ssd, "SandForce_Internal", "Internal Attribute", "", "This attribute has been reserved by vendor as internal."); // Intel SSD (smartctl) - add(234, StorageAttribute::DiskType::Ssd, "Thermal_Throttle", "Thermal Throttle", "", + add(234, AtaStorageAttribute::DiskType::Ssd, "Thermal_Throttle", "Thermal Throttle", "", ""); // Transcend SSD: Erase_Count_Avg (smartctl) (description?) - add(234, StorageAttribute::DiskType::Ssd, "Erase_Count_Avg/Max", "Erase Count Average / Maximum", "", + add(234, AtaStorageAttribute::DiskType::Ssd, "Erase_Count_Avg/Max", "Erase Count Average / Maximum", "", ""); // Innodisk SSD (smartctl) (description?) - add(234, StorageAttribute::DiskType::Ssd, "Flash_Reads_32MiB", "Flash Read (32MiB)", "", + add(234, AtaStorageAttribute::DiskType::Ssd, "Flash_Reads_32MiB", "Flash Read (32MiB)", "", ""); // Sandisk SSD (smartctl) (description / name?) - add(234, StorageAttribute::DiskType::Ssd, "Perc_Write/Erase_Ct_BC", "Write / Erase Count BC (%)", "", + add(234, AtaStorageAttribute::DiskType::Ssd, "Perc_Write/Erase_Ct_BC", "Write / Erase Count BC (%)", "", ""); // Sandforce SSD: SuperCap_Health (smartctl) (description?) - add(235, StorageAttribute::DiskType::Ssd, "SuperCap_Health", "Supercapacitor Health", "", + add(235, AtaStorageAttribute::DiskType::Ssd, "SuperCap_Health", "Supercapacitor Health", "", ""); // Transcend SSD: Block_Count_Good/System (smartctl) (description?) - add(235, StorageAttribute::DiskType::Ssd, "Block_Count_Good/System", "Good / System Free Block Count", "", + add(235, AtaStorageAttribute::DiskType::Ssd, "Block_Count_Good/System", "Good / System Free Block Count", "", "Good block count and system free block count."); // InnoDisk SSD (smartctl). (description / name?) - add(235, StorageAttribute::DiskType::Ssd, "Later_Bad_Block", "Later Bad Block", "", + add(235, AtaStorageAttribute::DiskType::Ssd, "Later_Bad_Block", "Later Bad Block", "", ""); // InnoDisk SSD (smartctl). (description / name?) - add(235, StorageAttribute::DiskType::Ssd, "Later_Bad_Blk_Inf_R/W/E", "Later Bad Block Read / Write / Erase", "", + add(235, AtaStorageAttribute::DiskType::Ssd, "Later_Bad_Blk_Inf_R/W/E", "Later Bad Block Read / Write / Erase", "", ""); // Samsung SSD (smartctl). (description / name?) - add(235, StorageAttribute::DiskType::Ssd, "POR_Recovery_Count", "POR Recovery Count", "", + add(235, AtaStorageAttribute::DiskType::Ssd, "POR_Recovery_Count", "POR Recovery Count", "", ""); // InnoDisk SSD (smartctl). (description / name?) - add(236, StorageAttribute::DiskType::Ssd, "Unstable_Power_Count", "Unstable Power Count", "", + add(236, AtaStorageAttribute::DiskType::Ssd, "Unstable_Power_Count", "Unstable Power Count", "", ""); // Head Flying Hours (smartctl) - add(240, StorageAttribute::DiskType::Hdd, "Head_Flying_Hours", "Head Flying Hours", "", + add(240, AtaStorageAttribute::DiskType::Hdd, "Head_Flying_Hours", "Head Flying Hours", "", "Time spent on head is positioning."); // Fujitsu: Transfer_Error_Rate (smartctl) (description?) - add(240, StorageAttribute::DiskType::Hdd, "Transfer_Error_Rate", "Transfer Error Rate", "", + add(240, AtaStorageAttribute::DiskType::Hdd, "Transfer_Error_Rate", "Transfer Error Rate", "", ""); // InnoDisk SSD (smartctl). (description / name?) - add(240, StorageAttribute::DiskType::Ssd, "Write_Head", "Write Head", "", + add(240, AtaStorageAttribute::DiskType::Ssd, "Write_Head", "Write Head", "", ""); // Total_LBAs_Written (smartctl) (description?) add(241, "Total_LBAs_Written", "Total LBAs Written", "", "Logical blocks written during lifetime."); // Sandforce SSD: Lifetime_Writes_GiB (smartctl) (maybe in 64GiB increments?) - add(241, StorageAttribute::DiskType::Ssd, "Lifetime_Writes_GiB", "Total GiB Written", "", + add(241, AtaStorageAttribute::DiskType::Ssd, "Lifetime_Writes_GiB", "Total GiB Written", "", "Total GiB written during lifetime."); // Intel SSD: Host_Writes_32MiB (smartctl) (description?) - add(241, StorageAttribute::DiskType::Ssd, "Host_Writes_32MiB", "Host Written (32 MiB)", "", + add(241, AtaStorageAttribute::DiskType::Ssd, "Host_Writes_32MiB", "Host Written (32 MiB)", "", "Total number of sectors written by the host system. The Raw value is increased by 1 for every 32 MiB written by the host."); // OCZ SSD (smartctl) - add(241, StorageAttribute::DiskType::Ssd, "Host_Writes_GiB", "Host Written (GiB)", "", + add(241, AtaStorageAttribute::DiskType::Ssd, "Host_Writes_GiB", "Host Written (GiB)", "", "Total number of sectors written by the host system. The Raw value is increased by 1 for every GiB written by the host."); // Sandisk SSD (smartctl) - add(241, StorageAttribute::DiskType::Ssd, "Total_Writes_GiB", "Total Written (GiB)", "", + add(241, AtaStorageAttribute::DiskType::Ssd, "Total_Writes_GiB", "Total Written (GiB)", "", "Total GiB written."); // Toshiba SSD (smartctl) - add(241, StorageAttribute::DiskType::Ssd, "Host_Writes", "Host Written", "", + add(241, AtaStorageAttribute::DiskType::Ssd, "Host_Writes", "Host Written", "", "Total number of sectors written by the host system."); // Total_LBAs_Read (smartctl) (description?) add(242, "Total_LBAs_Read", "Total LBAs Read", "", "Logical blocks read during lifetime."); // Sandforce SSD: Lifetime_Writes_GiB (smartctl) (maybe in 64GiB increments?) - add(242, StorageAttribute::DiskType::Ssd, "Lifetime_Reads_GiB", "Total GiB Read", "", + add(242, AtaStorageAttribute::DiskType::Ssd, "Lifetime_Reads_GiB", "Total GiB Read", "", "Total GiB read during lifetime."); // Intel SSD: Host_Reads_32MiB (smartctl) (description?) - add(242, StorageAttribute::DiskType::Ssd, "Host_Reads_32MiB", "Host Read (32 MiB)", "", + add(242, AtaStorageAttribute::DiskType::Ssd, "Host_Reads_32MiB", "Host Read (32 MiB)", "", "Total number of sectors read by the host system. The Raw value is increased by 1 for every 32 MiB read by the host."); // OCZ SSD (smartctl) - add(242, StorageAttribute::DiskType::Ssd, "Host_Reads_GiB", "Host Read (GiB)", "", + add(242, AtaStorageAttribute::DiskType::Ssd, "Host_Reads_GiB", "Host Read (GiB)", "", "Total number of sectors read by the host system. The Raw value is increased by 1 for every GiB read by the host."); // Marvell SSD (smartctl) - add(242, StorageAttribute::DiskType::Ssd, "Host_Reads", "Host Read", "", + add(242, AtaStorageAttribute::DiskType::Ssd, "Host_Reads", "Host Read", "", ""); // Sandisk SSD (smartctl) - add(241, StorageAttribute::DiskType::Ssd, "Total_Reads_GiB", "Total Read (GiB)", "", + add(241, AtaStorageAttribute::DiskType::Ssd, "Total_Reads_GiB", "Total Read (GiB)", "", "Total GiB read."); // Intel SSD: (smartctl) (description?) - add(243, StorageAttribute::DiskType::Ssd, "NAND_Writes_32MiB", "NAND Written (32MiB)", "", + add(243, AtaStorageAttribute::DiskType::Ssd, "NAND_Writes_32MiB", "NAND Written (32MiB)", "", ""); // Samsung SSD (smartctl). (description / name?) - add(243, StorageAttribute::DiskType::Ssd, "SATA_Downshift_Ct", "SATA Downshift Count", "", + add(243, AtaStorageAttribute::DiskType::Ssd, "SATA_Downshift_Ct", "SATA Downshift Count", "", ""); // Kingston SSDs (description?) (smartctl) - add(244, StorageAttribute::DiskType::Ssd, "Average_Erase_Count", "Average Erase Count", "", + add(244, AtaStorageAttribute::DiskType::Ssd, "Average_Erase_Count", "Average Erase Count", "", "The average of individual erase counts of all the blocks"); // Samsung SSDs (description?) (smartctl) - add(244, StorageAttribute::DiskType::Ssd, "Thermal_Throttle_St", "Thermal Throttle Status", "", + add(244, AtaStorageAttribute::DiskType::Ssd, "Thermal_Throttle_St", "Thermal Throttle Status", "", ""); // Sandisk SSDs (description?) (smartctl) - add(244, StorageAttribute::DiskType::Ssd, "Thermal_Throttle", "Thermal Throttle Status", "", + add(244, AtaStorageAttribute::DiskType::Ssd, "Thermal_Throttle", "Thermal Throttle Status", "", ""); // Kingston SSDs (smartctl) - add(245, StorageAttribute::DiskType::Ssd, "Max_Erase_Count", "Maximum Erase Count", "", + add(245, AtaStorageAttribute::DiskType::Ssd, "Max_Erase_Count", "Maximum Erase Count", "", "The maximum of individual erase counts of all the blocks."); // Innodisk SSD (smartctl) (description?) - add(245, StorageAttribute::DiskType::Ssd, "Flash_Writes_32MiB", "Flash Written (32MiB)", "", + add(245, AtaStorageAttribute::DiskType::Ssd, "Flash_Writes_32MiB", "Flash Written (32MiB)", "", ""); // Samsung SSD (smartctl) (description?) - add(245, StorageAttribute::DiskType::Ssd, "Timed_Workld_Media_Wear", "Timed Workload Media Wear", "", + add(245, AtaStorageAttribute::DiskType::Ssd, "Timed_Workld_Media_Wear", "Timed Workload Media Wear", "", ""); // SiliconMotion SSD (smartctl) (description?) - add(245, StorageAttribute::DiskType::Ssd, "TLC_Writes_32MiB", "TLC Written (32MiB)", "", + add(245, AtaStorageAttribute::DiskType::Ssd, "TLC_Writes_32MiB", "TLC Written (32MiB)", "", "Total number of sectors written to TLC. The Raw value is increased by 1 for every 32 MiB written by the host."); // Crucial / Micron SSD (smartctl) - add(246, StorageAttribute::DiskType::Ssd, "Total_Host_Sector_Write", "Total Host Sectors Written", "", + add(246, AtaStorageAttribute::DiskType::Ssd, "Total_Host_Sector_Write", "Total Host Sectors Written", "", "Total number of sectors written by the host system."); // Kingston SSDs (description?) (smartctl) - add(246, StorageAttribute::DiskType::Ssd, "Total_Erase_Count", "Total Erase Count", "", + add(246, AtaStorageAttribute::DiskType::Ssd, "Total_Erase_Count", "Total Erase Count", "", ""); // Samsung SSD (smartctl) (description?) - add(246, StorageAttribute::DiskType::Ssd, "Timed_Workld_RdWr_Ratio", "Timed Workload Read/Write Ratio", "", + add(246, AtaStorageAttribute::DiskType::Ssd, "Timed_Workld_RdWr_Ratio", "Timed Workload Read/Write Ratio", "", ""); // SiliconMotion SSD (smartctl) (description?) - add(246, StorageAttribute::DiskType::Ssd, "SLC_Writes_32MiB", "SLC Written (32MiB)", "", + add(246, AtaStorageAttribute::DiskType::Ssd, "SLC_Writes_32MiB", "SLC Written (32MiB)", "", "Total number of sectors written to SLC. The Raw value is increased by 1 for every 32 MiB written by the host."); // Crucial / Micron SSD (smartctl) - add(247, StorageAttribute::DiskType::Ssd, "Host_Program_Page_Count", "Host Program Page Count", "", + add(247, AtaStorageAttribute::DiskType::Ssd, "Host_Program_Page_Count", "Host Program Page Count", "", ""); // Samsung SSD (smartctl) - add(247, StorageAttribute::DiskType::Ssd, "Timed_Workld_Timer", "Timed Workload Timer", "", + add(247, AtaStorageAttribute::DiskType::Ssd, "Timed_Workld_Timer", "Timed Workload Timer", "", ""); // SiliconMotion SSD (smartctl) (description?) - add(247, StorageAttribute::DiskType::Ssd, "Raid_Recoverty_Ct", "RAID Recovery Count", "", + add(247, AtaStorageAttribute::DiskType::Ssd, "Raid_Recoverty_Ct", "RAID Recovery Count", "", ""); - add(248, StorageAttribute::DiskType::Ssd, "Bckgnd_Program_Page_Cnt", "Background Program Page Count", "", + add(248, AtaStorageAttribute::DiskType::Ssd, "Bckgnd_Program_Page_Cnt", "Background Program Page Count", "", ""); // Intel SSD: NAND_Writes_1GiB (smartctl) (description?) - add(249, StorageAttribute::DiskType::Ssd, "NAND_Writes_1GiB", "NAND Written (1GiB)", "", + add(249, AtaStorageAttribute::DiskType::Ssd, "NAND_Writes_1GiB", "NAND Written (1GiB)", "", ""); // OCZ SSD: Total_NAND_Prog_Ct_GiB (smartctl) (description?) - add(249, StorageAttribute::DiskType::Ssd, "Total_NAND_Prog_Ct_GiB", "Total NAND Written (1GiB)", "", + add(249, AtaStorageAttribute::DiskType::Ssd, "Total_NAND_Prog_Ct_GiB", "Total NAND Written (1GiB)", "", ""); // Read Error Retry Rate (smartctl) (description?) add(250, "Read_Error_Retry_Rate", "Read Error Retry Rate", "", "Number of errors found while reading."); // Samsung SSD: (smartctl) (description?) - add(183, StorageAttribute::DiskType::Any, "SATA_Iface_Downshift", "SATA Downshift Error Count", "", + add(183, AtaStorageAttribute::DiskType::Any, "SATA_Iface_Downshift", "SATA Downshift Error Count", "", ""); // OCZ SSD (smartctl) (description?) - add(251, StorageAttribute::DiskType::Ssd, "Total_NAND_Read_Ct_GiB", "Total NAND Read (1GiB)", "", + add(251, AtaStorageAttribute::DiskType::Ssd, "Total_NAND_Read_Ct_GiB", "Total NAND Read (1GiB)", "", ""); // Samsung SSD: (smartctl) (description?) - add(251, StorageAttribute::DiskType::Any, "NAND_Writes", "NAND Write Count", "", + add(251, AtaStorageAttribute::DiskType::Any, "NAND_Writes", "NAND Write Count", "", ""); // Free Fall Protection (smartctl) (seagate laptop drives) - add(254, StorageAttribute::DiskType::Hdd, "Free_Fall_Sensor", "Free Fall Protection", "", + add(254, AtaStorageAttribute::DiskType::Hdd, "Free_Fall_Sensor", "Free Fall Protection", "", "Number of free fall events detected by accelerometer sensor."); } @@ -1065,7 +1065,7 @@ namespace { void add(int32_t id, std::string reported_name, std::string displayable_name, std::string generic_name, std::string description) { - add(AttributeDescription(id, StorageAttribute::DiskType::Any, + add(AttributeDescription(id, AtaStorageAttribute::DiskType::Any, std::move(reported_name), std::move(displayable_name), std::move(generic_name), std::move(description))); } @@ -1078,12 +1078,12 @@ namespace { // DBG_ASSERT(iter != id_db.end() && !iter->second.empty()); // if (iter != id_db.end() || iter->second.empty()) { // AttributeDescription attr = iter->second.front(); -// add(AttributeDescription(id, StorageAttribute::DiskType::Any, reported_name, attr.displayable_name, attr.generic_name, attr.description)); +// add(AttributeDescription(id, AtaStorageAttribute::DiskType::Any, reported_name, attr.displayable_name, attr.generic_name, attr.description)); // } // } /// Add an attribute description to the attribute database - void add(int32_t id, StorageAttribute::DiskType type, std::string reported_name, std::string displayable_name, + void add(int32_t id, AtaStorageAttribute::DiskType type, std::string reported_name, std::string displayable_name, std::string generic_name, std::string description) { add(AttributeDescription(id, type, std::move(reported_name), std::move(displayable_name), std::move(generic_name), std::move(description))); @@ -1092,7 +1092,7 @@ namespace { /// Add a previously added description to the attribute database under a /// different smartctl name (fill the other members from the previous attribute). - void add(int32_t id, StorageAttribute::DiskType type, std::string reported_name) + void add(int32_t id, AtaStorageAttribute::DiskType type, std::string reported_name) { auto iter = id_db.find(id); DBG_ASSERT(iter != id_db.end() && !iter->second.empty()); @@ -1105,7 +1105,7 @@ namespace { /// Find the description by smartctl name or id, merging them if they're partial. - [[nodiscard]] AttributeDescription find(const std::string& reported_name, int32_t id, StorageAttribute::DiskType type) const + [[nodiscard]] AttributeDescription find(const std::string& reported_name, int32_t id, AtaStorageAttribute::DiskType type) const { // search by ID first auto id_iter = id_db.find(id); @@ -1119,7 +1119,7 @@ namespace { std::vector type_matched; for (const auto& attr_iter : id_iter->second) { - if (attr_iter.disk_type == type || attr_iter.disk_type == StorageAttribute::DiskType::Any || type == StorageAttribute::DiskType::Any) { + if (attr_iter.disk_type == type || attr_iter.disk_type == AtaStorageAttribute::DiskType::Any || type == AtaStorageAttribute::DiskType::Any) { type_matched.push_back(attr_iter); } } @@ -1395,7 +1395,7 @@ namespace { /// Check if a property matches a name (generic or reported) - inline bool name_match(StorageProperty& p, const std::string& name) + inline bool name_match(AtaStorageProperty& p, const std::string& name) { if (p.generic_name.empty()) { return hz::string_to_lower_copy(p.reported_name) == hz::string_to_lower_copy(name); @@ -1406,7 +1406,7 @@ namespace { /// Check if a property matches a name (generic or reported) and if it does, /// set a description on it. - inline bool auto_set(StorageProperty& p, const std::string& name, const char* descr) + inline bool auto_set(AtaStorageProperty& p, const std::string& name, const char* descr) { if (name_match(p, name)) { p.set_description(descr); @@ -1418,18 +1418,18 @@ namespace { /// Check if a property is an attribute and matches a generic name - inline bool attr_match(StorageProperty& p, const std::string& generic_name) + inline bool attr_match(AtaStorageProperty& p, const std::string& generic_name) { - return (p.is_value_type() && p.generic_name == generic_name); + return (p.is_value_type() && p.generic_name == generic_name); } /// Find a property's attribute in the attribute database and fill the property /// with all the readable information we can gather. - inline void auto_set_attr(StorageProperty& p, StorageAttribute::DiskType disk_type) + inline void auto_set_attr(AtaStorageProperty& p, AtaStorageAttribute::DiskType disk_type) { - AttributeDescription attr = get_attribute_db().find(p.reported_name, p.get_value().id, disk_type); + AttributeDescription attr = get_attribute_db().find(p.reported_name, p.get_value().id, disk_type); std::string humanized_reported_name; std::string ssd_hdd_str; @@ -1524,7 +1524,7 @@ namespace { /// Find a property's statistic in the statistics database and fill the property /// with all the readable information we can gather. - inline bool auto_set_statistic(StorageProperty& p) + inline bool auto_set_statistic(AtaStorageProperty& p) { StatisticDescription sd = get_devstat_db().find(p.reported_name); @@ -1538,7 +1538,7 @@ namespace { std::string descr = std::string("") + displayable_name + "\n"; descr += sd.description; - if (p.get_value().is_normalized()) { + if (p.get_value().is_normalized()) { descr += "\n\nNote: The value is normalized."; } @@ -1559,7 +1559,7 @@ namespace { -bool storage_property_autoset_description(StorageProperty& p, StorageAttribute::DiskType disk_type) +bool ata_storage_property_autoset_description(AtaStorageProperty& p, AtaStorageAttribute::DiskType disk_type) { bool found = false; @@ -1570,7 +1570,7 @@ bool storage_property_autoset_description(StorageProperty& p, StorageAttribute:: found = true; // Section Info - } else if (p.section == StorageProperty::Section::info) { + } else if (p.section == AtaStorageProperty::Section::info) { found = auto_set(p, "model_family", "Model family (from smartctl database)") || auto_set(p, "device_model", "Device model") || auto_set(p, "serial_number", "Serial number, unique to each physical drive") @@ -1592,15 +1592,15 @@ bool storage_property_autoset_description(StorageProperty& p, StorageAttribute:: found = true; } - } else if (p.section == StorageProperty::Section::data) { + } else if (p.section == AtaStorageProperty::Section::data) { switch (p.subsection) { - case StorageProperty::SubSection::health: + case AtaStorageProperty::SubSection::health: found = auto_set(p, "overall_health", "Overall health self-assessment test result. Note: If the drive passes this test, it doesn't mean it's OK. " "However, if the drive doesn't pass it, then it's either already dead, or it's predicting its own failure within the next 24 hours. In this case do a backup immediately!"); break; - case StorageProperty::SubSection::capabilities: + case AtaStorageProperty::SubSection::capabilities: found = auto_set(p, "offline_status_group", "Offline Data Collection (a.k.a. Offline test) is usually automatically performed when the device is idle or every fixed amount of time. " "This should show if Automatic Offline Data Collection is enabled.") || auto_set(p, "iodc_total_time_length", "Offline Data Collection (a.k.a. Offline test) is usually automatically performed when the device is idle or every fixed amount of time. " @@ -1616,7 +1616,7 @@ bool storage_property_autoset_description(StorageProperty& p, StorageAttribute:: || auto_set(p, "sct_cap_group", "Drive properties related to temperature information."); break; - case StorageProperty::SubSection::attributes: + case AtaStorageProperty::SubSection::attributes: found = auto_set(p, "data_structure_version", p.displayable_name.c_str()); if (!found) { auto_set_attr(p, disk_type); @@ -1624,41 +1624,41 @@ bool storage_property_autoset_description(StorageProperty& p, StorageAttribute:: } break; - case StorageProperty::SubSection::devstat: + case AtaStorageProperty::SubSection::devstat: found = auto_set_statistic(p); break; - case StorageProperty::SubSection::error_log: + case AtaStorageProperty::SubSection::error_log: found = auto_set(p, "error_log_version", p.displayable_name.c_str()) || auto_set(p, "error_log_error_count", "Number of errors in error log. Note: Some manufacturers may list completely harmless errors in this log " "(e.g., command invalid, not implemented, etc...)."); // || auto_set(p, "error_log_unsupported", "This device does not support error logging."); // the property text already says that - if (p.is_value_type()) { - for (size_t i = 0; i < p.get_value().reported_types.size(); ++i) { - p.set_description(StorageErrorBlock::get_displayable_error_types(p.get_value().reported_types)); + if (p.is_value_type()) { + for (size_t i = 0; i < p.get_value().reported_types.size(); ++i) { + p.set_description(AtaStorageErrorBlock::get_displayable_error_types(p.get_value().reported_types)); found = true; } } break; - case StorageProperty::SubSection::selftest_log: + case AtaStorageProperty::SubSection::selftest_log: found = auto_set(p, "selftest_log_version", p.displayable_name.c_str()) || auto_set(p, "selftest_num_entries", "Number of tests in selftest log. Note: The number of entries may be limited to the newest manual tests."); // || auto_set(p, "selftest_log_unsupported", "This device does not support self-test logging."); // the property text already says that break; - case StorageProperty::SubSection::selective_selftest_log: + case AtaStorageProperty::SubSection::selective_selftest_log: // nothing here break; - case StorageProperty::SubSection::temperature_log: + case AtaStorageProperty::SubSection::temperature_log: found = auto_set(p, "sct_unsupported", "SCT support is needed for SCT temperature logging."); break; - case StorageProperty::SubSection::erc_log: - case StorageProperty::SubSection::phy_log: - case StorageProperty::SubSection::directory_log: - case StorageProperty::SubSection::unknown: + case AtaStorageProperty::SubSection::erc_log: + case AtaStorageProperty::SubSection::phy_log: + case AtaStorageProperty::SubSection::directory_log: + case AtaStorageProperty::SubSection::unknown: // nothing break; } @@ -1670,7 +1670,7 @@ bool storage_property_autoset_description(StorageProperty& p, StorageAttribute:: -WarningLevel storage_property_autoset_warning(StorageProperty& p) +WarningLevel ata_storage_property_autoset_warning(AtaStorageProperty& p) { WarningLevel w = WarningLevel::none; std::string reason; @@ -1682,7 +1682,7 @@ WarningLevel storage_property_autoset_warning(StorageProperty& p) // Section Info - } else if (p.section == StorageProperty::Section::info) { + } else if (p.section == AtaStorageProperty::Section::info) { if (name_match(p, "smart_supported") && !p.get_value()) { w = WarningLevel::notice; reason = "SMART is not supported. You won't be able to read any SMART information from this drive."; @@ -1697,25 +1697,25 @@ WarningLevel storage_property_autoset_warning(StorageProperty& p) reason = "Your drive may be affected by the warning, please see the details."; } - } else if (p.section == StorageProperty::Section::data) { + } else if (p.section == AtaStorageProperty::Section::data) { switch(p.subsection) { - case StorageProperty::SubSection::health: + case AtaStorageProperty::SubSection::health: if (name_match(p, "overall_health") && p.get_value() != "PASSED") { w = WarningLevel::alert; reason = "The drive is reporting that it will FAIL very soon. Please back up as soon as possible!"; } break; - case StorageProperty::SubSection::capabilities: + case AtaStorageProperty::SubSection::capabilities: // nothing break; - case StorageProperty::SubSection::attributes: + case AtaStorageProperty::SubSection::attributes: { - if (p.is_value_type()) { + if (p.is_value_type()) { - const auto& attr = p.get_value(); + const auto& attr = p.get_value(); // Set notices for known pre-fail attributes. These are notices only, since the warnings // and alerts are shown only in case of attribute failure. @@ -1786,9 +1786,9 @@ WarningLevel storage_property_autoset_warning(StorageProperty& p) // Now override this with reported SMART attribute failure warnings / errors - if (attr.when_failed == StorageAttribute::FailTime::now) { // NOW + if (attr.when_failed == AtaStorageAttribute::FailTime::now) { // NOW - if (attr.attr_type == StorageAttribute::AttributeType::old_age) { // old-age + if (attr.attr_type == AtaStorageAttribute::AttributeType::old_age) { // old-age w = WarningLevel::warning; reason = "The drive has a failing old-age attribute. Usually this indicates a wear-out. You should consider replacing the drive."; } else { // pre-fail @@ -1796,9 +1796,9 @@ WarningLevel storage_property_autoset_warning(StorageProperty& p) reason = "The drive has a failing pre-fail attribute. Usually this indicates a that the drive will FAIL soon. Please back up immediately!"; } - } else if (attr.when_failed == StorageAttribute::FailTime::past) { // PAST + } else if (attr.when_failed == AtaStorageAttribute::FailTime::past) { // PAST - if (attr.attr_type == StorageAttribute::AttributeType::old_age) { // old-age + if (attr.attr_type == AtaStorageAttribute::AttributeType::old_age) { // old-age // nothing. we don't warn about e.g. temperature increase in the past } else { // pre-fail w = WarningLevel::warning; // there was a problem, it got corrected (hopefully) @@ -1810,10 +1810,10 @@ WarningLevel storage_property_autoset_warning(StorageProperty& p) break; } - case StorageProperty::SubSection::devstat: + case AtaStorageProperty::SubSection::devstat: { - if (p.is_value_type()) { - const auto& statistic = p.get_value(); + if (p.is_value_type()) { + const auto& statistic = p.get_value(); if (name_match(p, "Pending Error Count") && statistic.value_int > 0) { w = WarningLevel::notice; @@ -1886,7 +1886,7 @@ WarningLevel storage_property_autoset_warning(StorageProperty& p) break; } - case StorageProperty::SubSection::error_log: + case AtaStorageProperty::SubSection::error_log: { // Note: The error list table doesn't display any descriptions, so if any // error-entry related descriptions are added here, don't forget to enable @@ -1903,12 +1903,12 @@ WarningLevel storage_property_autoset_warning(StorageProperty& p) } // Rate individual error log entries. - if (p.is_value_type()) { - const auto& eb = p.get_value(); + if (p.is_value_type()) { + const auto& eb = p.get_value(); if (!eb.reported_types.empty()) { WarningLevel error_block_warning = WarningLevel::none; for (const auto& reported_type : eb.reported_types) { - WarningLevel individual_warning = StorageErrorBlock::get_warning_level_for_error_type(reported_type); + WarningLevel individual_warning = AtaStorageErrorBlock::get_warning_level_for_error_type(reported_type); if (individual_warning > error_block_warning) { error_block_warning = WarningLevel(individual_warning); } @@ -1923,7 +1923,7 @@ WarningLevel storage_property_autoset_warning(StorageProperty& p) break; } - case StorageProperty::SubSection::selftest_log: + case AtaStorageProperty::SubSection::selftest_log: { // Note: The error list table doesn't display any descriptions, so if any // error-entry related descriptions are added here, don't forget to enable @@ -1939,11 +1939,11 @@ WarningLevel storage_property_autoset_warning(StorageProperty& p) break; } - case StorageProperty::SubSection::selective_selftest_log: + case AtaStorageProperty::SubSection::selective_selftest_log: // nothing here break; - case StorageProperty::SubSection::temperature_log: + case AtaStorageProperty::SubSection::temperature_log: // Don't highlight SCT Unsupported as warning, it's harmless. // if (name_match(p, "sct_unsupported") && p.value_bool) { // w = WarningLevel::notice; @@ -1957,10 +1957,10 @@ WarningLevel storage_property_autoset_warning(StorageProperty& p) } break; - case StorageProperty::SubSection::erc_log: - case StorageProperty::SubSection::phy_log: - case StorageProperty::SubSection::directory_log: - case StorageProperty::SubSection::unknown: + case AtaStorageProperty::SubSection::erc_log: + case AtaStorageProperty::SubSection::phy_log: + case AtaStorageProperty::SubSection::directory_log: + case AtaStorageProperty::SubSection::unknown: // nothing here break; } diff --git a/src/applib/storage_property_descr.h b/src/applib/ata_storage_property_descr.h similarity index 64% rename from src/applib/storage_property_descr.h rename to src/applib/ata_storage_property_descr.h index f22ea65..9889681 100644 --- a/src/applib/storage_property_descr.h +++ b/src/applib/ata_storage_property_descr.h @@ -9,19 +9,19 @@ Copyright: /// \weakgroup applib /// @{ -#ifndef STORAGE_PROPERTY_DESCR_H -#define STORAGE_PROPERTY_DESCR_H +#ifndef ATA_STORAGE_PROPERTY_DESCR_H +#define ATA_STORAGE_PROPERTY_DESCR_H -#include "storage_property.h" +#include "ata_storage_property.h" /// Fill the property with all the information we can gather (description, etc...). -bool storage_property_autoset_description(StorageProperty& p, StorageAttribute::DiskType disk_type); +bool ata_storage_property_autoset_description(AtaStorageProperty& p, AtaStorageAttribute::DiskType disk_type); /// Do some basic checks on the property and set warnings if needed. -WarningLevel storage_property_autoset_warning(StorageProperty& p); +WarningLevel ata_storage_property_autoset_warning(AtaStorageProperty& p); diff --git a/src/applib/examples/example_smartctl_parser.cpp b/src/applib/examples/example_smartctl_parser.cpp index 1d007a6..6a8553a 100644 --- a/src/applib/examples/example_smartctl_parser.cpp +++ b/src/applib/examples/example_smartctl_parser.cpp @@ -20,8 +20,8 @@ Copyright: #include "libdebug/libdebug.h" #include "hz/fs.h" -#include "applib/storage_property.h" -#include "applib/smartctl_parser.h" +#include "applib/ata_storage_property.h" +#include "applib/smartctl_text_parser.h" @@ -42,13 +42,13 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - SmartctlParser sp; - if (!sp.parse_full(contents, StorageAttribute::DiskType::Any)) { + SmartctlTextParser sp; + if (!sp.parse_full(contents, AtaStorageAttribute::DiskType::Any)) { debug_out_error("app", "Cannot parse file contents: " << sp.get_error_msg() << "\n"); return EXIT_FAILURE; } - const std::vector& props = sp.get_properties(); + const std::vector& props = sp.get_properties(); for(const auto& prop : props) { debug_out_dump("app", prop << "\n"); } diff --git a/src/applib/selftest.cpp b/src/applib/selftest.cpp index 67312bb..06eb18a 100644 --- a/src/applib/selftest.cpp +++ b/src/applib/selftest.cpp @@ -15,8 +15,8 @@ Copyright: #include #include "app_pcrecpp.h" -#include "storage_property.h" -#include "smartctl_parser.h" +#include "ata_storage_property.h" +#include "smartctl_text_parser.h" #include "selftest.h" @@ -75,8 +75,8 @@ std::chrono::seconds SelfTest::get_min_duration_seconds() const case TestType::conveyance: prop_name = "conveyance_total_time_length"; break; } - StorageProperty p = drive_->lookup_property(prop_name, - StorageProperty::Section::data, StorageProperty::SubSection::capabilities); + AtaStorageProperty p = drive_->lookup_property(prop_name, + AtaStorageProperty::Section::data, AtaStorageProperty::SubSection::capabilities); // p stores it as uint64_t return (total_duration_ = (p.empty() ? 0s : p.get_value())); @@ -104,7 +104,7 @@ bool SelfTest::is_supported() const case TestType::conveyance: prop_name = "conveyance_support"; break; } - StorageProperty p = drive_->lookup_property(prop_name, StorageProperty::Section::internal); + AtaStorageProperty p = drive_->lookup_property(prop_name, AtaStorageProperty::Section::internal); return (!p.empty() && p.get_value()); } @@ -155,7 +155,7 @@ std::string SelfTest::start(const std::shared_ptr& smartctl_ex) // Set up everything so that the caller won't have to. - status_ = StorageSelftestEntry::Status::in_progress; + status_ = AtaStorageSelftestEntry::Status::in_progress; remaining_percent_ = 100; // set to 90 to avoid the 100->90 timer reset. this way we won't be looking at @@ -186,7 +186,7 @@ std::string SelfTest::force_stop(const std::shared_ptr& smartct // any command (e.g. "--abort") will abort it. If it has "Suspend Offline...", // there's no way to abort such test. if (type_ == TestType::immediate_offline) { - StorageProperty p = drive_->lookup_property("iodc_command_suspends", StorageProperty::Section::internal); + AtaStorageProperty p = drive_->lookup_property("iodc_command_suspends", AtaStorageProperty::Section::internal); if (!p.empty() && p.get_value()) { // if empty, give a chance to abort anyway. return _("Aborting this test is unsupported by the drive."); } @@ -210,8 +210,8 @@ std::string SelfTest::force_stop(const std::shared_ptr& smartct // the thing is, update() may fail to actually update the statuses, so // do it manually. - if (status_ == StorageSelftestEntry::Status::in_progress) { // update() couldn't do its job - status_ = StorageSelftestEntry::Status::aborted_by_host; + if (status_ == AtaStorageSelftestEntry::Status::in_progress) { // update() couldn't do its job + status_ = AtaStorageSelftestEntry::Status::aborted_by_host; remaining_percent_ = -1; last_seen_percent_ = -1; poll_in_seconds_ = std::chrono::seconds(-1); @@ -242,8 +242,8 @@ std::string SelfTest::update(const std::shared_ptr& smartctl_ex if (!error_msg.empty()) // checks for empty output too return error_msg; - StorageAttribute::DiskType disk_type = drive_->get_is_hdd() ? StorageAttribute::DiskType::Hdd : StorageAttribute::DiskType::Ssd; - SmartctlParser ps; + AtaStorageAttribute::DiskType disk_type = drive_->get_is_hdd() ? AtaStorageAttribute::DiskType::Hdd : AtaStorageAttribute::DiskType::Ssd; + SmartctlTextParser ps; if (!ps.parse_full(output, disk_type)) { // try to parse it return ps.get_error_msg(); } @@ -251,11 +251,11 @@ std::string SelfTest::update(const std::shared_ptr& smartctl_ex // Note: Since the self-test log is sometimes late // and in undetermined order (sorting by hours is too rough), // we use the "self-test status" capability. - StorageProperty p; + AtaStorageProperty p; for (const auto& e : ps.get_properties()) { -// if (e.section != StorageProperty::Section::data || e.subsection != StorageProperty::SubSection::selftest_log - if (e.section != StorageProperty::Section::internal - || !e.is_value_type() || e.get_value().test_num != 0 +// if (e.section != AtaStorageProperty::Section::data || e.subsection != AtaStorageProperty::SubSection::selftest_log + if (e.section != AtaStorageProperty::Section::internal + || !e.is_value_type() || e.get_value().test_num != 0 || e.generic_name != "last_selftest_status") continue; p = e; @@ -264,15 +264,15 @@ std::string SelfTest::update(const std::shared_ptr& smartctl_ex if (p.empty()) return _("The drive doesn't report the test status."); - status_ = p.get_value().status; - bool active = (status_ == StorageSelftestEntry::Status::in_progress); + status_ = p.get_value().status; + bool active = (status_ == AtaStorageSelftestEntry::Status::in_progress); // Note that the test needs 90% to complete, not 100. It starts at 90% // and reaches 00% on completion. That's 9 pieces. if (active) { - remaining_percent_ = p.get_value().remaining_percent; + remaining_percent_ = p.get_value().remaining_percent; if (remaining_percent_ != last_seen_percent_) { last_seen_percent_ = remaining_percent_; timer_.start(); // restart the timer diff --git a/src/applib/selftest.h b/src/applib/selftest.h index b718272..f0024cf 100644 --- a/src/applib/selftest.h +++ b/src/applib/selftest.h @@ -49,7 +49,7 @@ class SelfTest { /// Check if the test is currently active bool is_active() const { - return (status_ == StorageSelftestEntry::Status::in_progress); + return (status_ == AtaStorageSelftestEntry::Status::in_progress); } @@ -74,7 +74,7 @@ class SelfTest { /// Get test status - StorageSelftestEntry::Status get_status() const + AtaStorageSelftestEntry::Status get_status() const { return status_; } @@ -117,7 +117,7 @@ class SelfTest { TestType type_ = TestType::short_test; ///< Test type // status variables: - StorageSelftestEntry::Status status_ = StorageSelftestEntry::Status::unknown; ///< Current status of the test as reported by the drive + AtaStorageSelftestEntry::Status status_ = AtaStorageSelftestEntry::Status::unknown; ///< Current status of the test as reported by the drive int8_t remaining_percent_ = -1; ///< Remaining %. 0 means unknown, -1 means N/A. This is set to 100 on start. int8_t last_seen_percent_ = -1; ///< Last reported %, to detect changes in percentage (needed for timer update). mutable std::chrono::seconds total_duration_ = std::chrono::seconds(-1); ///< Total duration needed for the test, as reported by the drive. Constant. This variable acts as a cache. diff --git a/src/applib/smartctl_executor.h b/src/applib/smartctl_executor.h index 6c81d93..7ccc305 100644 --- a/src/applib/smartctl_executor.h +++ b/src/applib/smartctl_executor.h @@ -82,7 +82,7 @@ class SmartctlExecutorGeneric : public ExecutorSync { // check every bit for (unsigned int i = 0; i <= 7; i++) { - if (status & (1 << i)) { + if ( (status & (1 << i)) != 0 ) { if (!str.empty()) str += "\n"; // new-line-separate each entry str += table[i]; diff --git a/src/applib/smartctl_parser.cpp b/src/applib/smartctl_text_parser.cpp similarity index 89% rename from src/applib/smartctl_parser.cpp rename to src/applib/smartctl_text_parser.cpp index b8cbedd..e81ee9a 100644 --- a/src/applib/smartctl_parser.cpp +++ b/src/applib/smartctl_text_parser.cpp @@ -20,9 +20,9 @@ Copyright: #include "hz/debug.h" // debug_* #include "app_pcrecpp.h" -#include "smartctl_parser.h" -#include "storage_property_descr.h" -#include "storage_property_colors.h" +#include "smartctl_text_parser.h" +#include "ata_storage_property_descr.h" +#include "warning_colors.h" @@ -31,25 +31,25 @@ namespace { /// Get storage property by checksum error name (which corresponds to /// an output section). - inline StorageProperty app_get_checksum_error_property(const std::string& name) + inline AtaStorageProperty app_get_checksum_error_property(const std::string& name) { - StorageProperty p; - p.section = StorageProperty::Section::data; + AtaStorageProperty p; + p.section = AtaStorageProperty::Section::data; if (name == "Attribute Data") { - p.subsection = StorageProperty::SubSection::attributes; + p.subsection = AtaStorageProperty::SubSection::attributes; p.set_name(name, "attribute_data_checksum_error"); } else if (name == "Attribute Thresholds") { - p.subsection = StorageProperty::SubSection::attributes; + p.subsection = AtaStorageProperty::SubSection::attributes; p.set_name(name, "attribute_thresholds_checksum_error"); } else if (name == "ATA Error Log") { - p.subsection = StorageProperty::SubSection::error_log; + p.subsection = AtaStorageProperty::SubSection::error_log; p.set_name(name, "ata_error_log_checksum_error"); } else if (name == "Self-Test Log") { - p.subsection = StorageProperty::SubSection::selftest_log; + p.subsection = AtaStorageProperty::SubSection::selftest_log; p.set_name(name, "selftest_log_checksum_error"); } @@ -67,7 +67,7 @@ namespace { // Parse full "smartctl -x" output -bool SmartctlParser::parse_full(const std::string& full, StorageAttribute::DiskType disk_type) +bool SmartctlTextParser::parse_full(const std::string& full, AtaStorageAttribute::DiskType disk_type) { this->clear(); // clear previous data @@ -214,19 +214,19 @@ bool SmartctlParser::parse_full(const std::string& full, StorageAttribute::DiskT } { - StorageProperty p; + AtaStorageProperty p; p.set_name("Smartctl version", "smartctl_version", "Smartctl Version"); p.reported_value = version; p.value = p.reported_value; // string-type value - p.section = StorageProperty::Section::info; // add to info section + p.section = AtaStorageProperty::Section::info; // add to info section add_property(p); } { - StorageProperty p; + AtaStorageProperty p; p.set_name("Smartctl version", "smartctl_version_full", "Smartctl Version"); p.reported_value = version_full; p.value = p.reported_value; // string-type value - p.section = StorageProperty::Section::info; // add to info section + p.section = AtaStorageProperty::Section::info; // add to info section add_property(p); } @@ -276,7 +276,7 @@ bool SmartctlParser::parse_full(const std::string& full, StorageAttribute::DiskT // Supply output of "smartctl --version" here. // returns false on failure. Non-unix newlines in s are ok. -bool SmartctlParser::parse_version(const std::string& s, std::string& version, std::string& version_full) +bool SmartctlTextParser::parse_version(const std::string& s, std::string& version, std::string& version_full) { // e.g. // "smartctl version 5.37" @@ -296,7 +296,7 @@ bool SmartctlParser::parse_version(const std::string& s, std::string& version, s // check that the version of smartctl output can be parsed with this parser. -bool SmartctlParser::check_parsed_version(const std::string& version_str, [[maybe_unused]] const std::string& version_full_str) +bool SmartctlTextParser::check_parsed_version(const std::string& version_str, [[maybe_unused]] const std::string& version_full_str) { // tested with 5.1-xx versions (1 - 18), and 5.[20 - 38]. // note: 5.1-11 (maybe others too) with scsi disk gives non-parsable output (why?). @@ -318,7 +318,7 @@ bool SmartctlParser::check_parsed_version(const std::string& version_str, [[mayb // convert e.g. "1,000,204,886,016 bytes" to 1.00 TB [931.51 GiB, 1000204886016 bytes]. // Note: this property is present since 5.33. -std::string SmartctlParser::parse_byte_size(const std::string& str, int64_t& bytes, bool extended) +std::string SmartctlTextParser::parse_byte_size(const std::string& str, int64_t& bytes, bool extended) { // E.g. "500,107,862,016" bytes or "80'060'424'192 bytes" or "80 026 361 856 bytes". // French locale inserts 0xA0 as a separator (non-breaking space, _not_ a valid utf8 char). @@ -371,7 +371,7 @@ std::string SmartctlParser::parse_byte_size(const std::string& str, int64_t& byt // Parse the section part (with "=== .... ===" header) - info or data sections. -bool SmartctlParser::parse_section(const std::string& header, const std::string& body) +bool SmartctlTextParser::parse_section(const std::string& header, const std::string& body) { if (app_pcre_match("/START OF INFORMATION SECTION/mi", header)) { return parse_section_info(body); @@ -413,11 +413,11 @@ bool SmartctlParser::parse_section(const std::string& header, const std::string& // ------------------------------------------------ INFO SECTION -bool SmartctlParser::parse_section_info(const std::string& body) +bool SmartctlTextParser::parse_section_info(const std::string& body) { this->set_data_section_info(body); - StorageProperty::Section section = StorageProperty::Section::info; + AtaStorageProperty::Section section = AtaStorageProperty::Section::info; // split by lines. // e.g. Device Model: ST3500630AS @@ -438,7 +438,7 @@ bool SmartctlParser::parse_section_info(const std::string& body) warning_msg += "\n" + line; } else { expecting_warning_lines = false; - StorageProperty p; + AtaStorageProperty p; p.section = section; p.set_name("Warning", "info_warning", "Warning"); p.reported_value = warning_msg; @@ -500,7 +500,7 @@ http://knowledge.seagate.com/articles/en_US/FAQ/213891en hz::string_trim(name); hz::string_trim(value); - StorageProperty p; + AtaStorageProperty p; p.section = section; p.set_name(name); p.reported_value = value; @@ -522,10 +522,10 @@ http://knowledge.seagate.com/articles/en_US/FAQ/213891en // Parse a component (one line) of the info section -bool SmartctlParser::parse_section_info_property(StorageProperty& p) +bool SmartctlTextParser::parse_section_info_property(AtaStorageProperty& p) { // ---- Info - if (p.section != StorageProperty::Section::info) { + if (p.section != AtaStorageProperty::Section::info) { set_error_msg("Internal parser error."); // set this so we have something to display debug_out_error("app", DBG_FUNC_MSG << "Called with non-info section!\n"); return false; @@ -713,7 +713,7 @@ bool SmartctlParser::parse_section_info_property(StorageProperty& p) // Parse the Data section (without "===" header) -bool SmartctlParser::parse_section_data(const std::string& body) +bool SmartctlTextParser::parse_section_data(const std::string& body) { this->set_data_section_data(body); @@ -864,7 +864,7 @@ bool SmartctlParser::parse_section_data(const std::string& body) // -------------------- Health -bool SmartctlParser::parse_section_data_subsection_health(const std::string& sub) +bool SmartctlTextParser::parse_section_data_subsection_health(const std::string& sub) { // Health section data (--info and --get=all): /* @@ -878,9 +878,9 @@ Form Factor: 2.5 inches Device is: In smartctl database [for details use: -P show] */ - StorageProperty pt; // template for easy copying - pt.section = StorageProperty::Section::data; - pt.subsection = StorageProperty::SubSection::health; + AtaStorageProperty pt; // template for easy copying + pt.section = AtaStorageProperty::Section::data; + pt.subsection = AtaStorageProperty::SubSection::health; std::string name, value; if (app_pcre_match("/^([^:\\n]+):[ \\t]*(.*)$/mi", sub, &name, &value)) { @@ -907,7 +907,7 @@ Device is: In smartctl database [for details use: -P show] // -------------------- Capabilities -bool SmartctlParser::parse_section_data_subsection_capabilities(const std::string& sub_initial) +bool SmartctlTextParser::parse_section_data_subsection_capabilities(const std::string& sub_initial) { // Capabilities section data: /* @@ -944,9 +944,9 @@ SCT capabilities: (0x003d) SCT Status supported. SCT Data Table supported. */ - StorageProperty pt; // template for easy copying - pt.section = StorageProperty::Section::data; - pt.subsection = StorageProperty::SubSection::capabilities; + AtaStorageProperty pt; // template for easy copying + pt.section = AtaStorageProperty::Section::data; + pt.subsection = AtaStorageProperty::SubSection::capabilities; std::string sub = sub_initial; @@ -1033,7 +1033,7 @@ SCT capabilities: (0x003d) SCT Status supported. numvalue *= 60; // convert to seconds // add as a time property - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name(name); // well, not really as reported, but still... p.reported_value.append(numvalue_orig).append(" | ").append(strvalue_orig); @@ -1046,15 +1046,15 @@ SCT capabilities: (0x003d) SCT Status supported. cap_found = true; - // StorageCapability properties (capabilities are flag lists) + // AtaStorageCapability properties (capabilities are flag lists) } else { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name(name); // well, not really as reported, but still... p.reported_value.append(numvalue_orig).append(" | ").append(strvalue_orig); - StorageCapability cap; + AtaStorageCapability cap; cap.reported_flag_value = numvalue_orig; cap.flag_value = static_cast(numvalue); // full flag value cap.reported_strvalue = strvalue_orig; @@ -1087,7 +1087,7 @@ SCT capabilities: (0x003d) SCT Status supported. // Check the capabilities for internal properties we can use. -bool SmartctlParser::parse_section_data_internal_capabilities(StorageProperty& cap_prop) +bool SmartctlTextParser::parse_section_data_internal_capabilities(AtaStorageProperty& cap_prop) { // Some special capabilities we're interested in. @@ -1130,14 +1130,14 @@ bool SmartctlParser::parse_section_data_internal_capabilities(StorageProperty& c pcrecpp::RE re_selftest_long_time = app_pcre_re("/^(Extended self-test routine recommended polling time)/mi"); pcrecpp::RE re_conv_selftest_time = app_pcre_re("/^(Conveyance self-test routine recommended polling time)/mi"); - if (cap_prop.section != StorageProperty::Section::data || cap_prop.subsection != StorageProperty::SubSection::capabilities) { + if (cap_prop.section != AtaStorageProperty::Section::data || cap_prop.subsection != AtaStorageProperty::SubSection::capabilities) { debug_out_error("app", DBG_FUNC_MSG << "Non-capability property passed.\n"); return false; } // Name the capability groups for easy matching when setting descriptions - if (cap_prop.is_value_type()) { + if (cap_prop.is_value_type()) { if (re_offline_status_group.PartialMatch(cap_prop.reported_name)) { cap_prop.generic_name = "offline_status_group"; @@ -1163,16 +1163,16 @@ bool SmartctlParser::parse_section_data_internal_capabilities(StorageProperty& c if (re_selftest_status.PartialMatch(cap_prop.reported_name)) { // The last self-test status. break up into pieces. - StorageProperty p; - p.section = StorageProperty::Section::internal; + AtaStorageProperty p; + p.section = AtaStorageProperty::Section::internal; p.set_name("last_selftest_status"); - StorageSelftestEntry sse; + AtaStorageSelftestEntry sse; sse.test_num = 0; sse.remaining_percent = -1; // unknown or n/a // check for lines in capability vector - for (const auto& sv : cap_prop.get_value().strvalues) { + for (const auto& sv : cap_prop.get_value().strvalues) { std::string value; if (app_pcre_match("/^([0-9]+)% of test remaining/mi", sv, &value)) { @@ -1182,56 +1182,56 @@ bool SmartctlParser::parse_section_data_internal_capabilities(StorageProperty& c } else if (app_pcre_match("/^(The previous self-test routine completed without error or no .*)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::completed_no_error; + sse.status = AtaStorageSelftestEntry::Status::completed_no_error; } else if (app_pcre_match("/^(The self-test routine was aborted by the host)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::aborted_by_host; + sse.status = AtaStorageSelftestEntry::Status::aborted_by_host; } else if (app_pcre_match("/^(The self-test routine was interrupted by the host with a hard.*)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::interrupted; + sse.status = AtaStorageSelftestEntry::Status::interrupted; } else if (app_pcre_match("/^(A fatal error or unknown test error occurred while the device was executing its .*)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::fatal_or_unknown; + sse.status = AtaStorageSelftestEntry::Status::fatal_or_unknown; } else if (app_pcre_match("/^(The previous self-test completed having a test element that failed and the test element that failed is not known)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::compl_unknown_failure; + sse.status = AtaStorageSelftestEntry::Status::compl_unknown_failure; } else if (app_pcre_match("/^(The previous self-test completed having the electrical element of the test failed)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::compl_electrical_failure; + sse.status = AtaStorageSelftestEntry::Status::compl_electrical_failure; } else if (app_pcre_match("/^(The previous self-test completed having the servo .*)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::compl_servo_failure; + sse.status = AtaStorageSelftestEntry::Status::compl_servo_failure; } else if (app_pcre_match("/^(The previous self-test completed having the read element of the test failed)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::compl_read_failure; + sse.status = AtaStorageSelftestEntry::Status::compl_read_failure; } else if (app_pcre_match("/^(The previous self-test completed having a test element that failed and the device is suspected of having handling damage)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::compl_handling_damage; + sse.status = AtaStorageSelftestEntry::Status::compl_handling_damage; // samsung bug (?), as per smartctl sources. } else if (app_pcre_match("/^(The previous self-test routine completed with unknown result or self-test .*)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::compl_unknown_failure; // we'll use this again (correct?) + sse.status = AtaStorageSelftestEntry::Status::compl_unknown_failure; // we'll use this again (correct?) } else if (app_pcre_match("/^(Self-test routine in progress)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::in_progress; + sse.status = AtaStorageSelftestEntry::Status::in_progress; } else if (app_pcre_match("/^(Reserved)/mi", sv, &value)) { sse.status_str = value; - sse.status = StorageSelftestEntry::Status::reserved; + sse.status = AtaStorageSelftestEntry::Status::reserved; } } - p.value = sse; // StorageSelftestEntry-type value + p.value = sse; // AtaStorageSelftestEntry-type value add_property(p); @@ -1262,15 +1262,15 @@ bool SmartctlParser::parse_section_data_internal_capabilities(StorageProperty& c // Extract subcapabilities from capability vectors and assign to "internal" section. - if (cap_prop.is_value_type()) { + if (cap_prop.is_value_type()) { // check for lines in capability vector - for (const auto& sv : cap_prop.get_value().strvalues) { + for (const auto& sv : cap_prop.get_value().strvalues) { // debug_out_dump("app", "Looking for internal capability in: \"" << sv << "\"\n"); - StorageProperty p; - p.section = StorageProperty::Section::internal; + AtaStorageProperty p; + p.section = AtaStorageProperty::Section::internal; // Note: We don't set reported_value on internal properties. std::string name, value; @@ -1344,11 +1344,11 @@ bool SmartctlParser::parse_section_data_internal_capabilities(StorageProperty& c // -------------------- Attributes -bool SmartctlParser::parse_section_data_subsection_attributes(const std::string& sub) +bool SmartctlTextParser::parse_section_data_subsection_attributes(const std::string& sub) { - StorageProperty pt; // template for easy copying - pt.section = StorageProperty::Section::data; - pt.subsection = StorageProperty::SubSection::attributes; + AtaStorageProperty pt; // template for easy copying + pt.section = AtaStorageProperty::Section::data; + pt.subsection = AtaStorageProperty::SubSection::attributes; // split to lines std::vector lines; @@ -1446,7 +1446,7 @@ ID# ATTRIBUTE_NAME FLAGS VALUE WORST THRESH FAIL RAW_VALUE int64_t value_num = 0; hz::string_is_numeric_nolocale(value, value_num, false); - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name(name, "data_structure_version"); p.reported_value = value; p.value = value_num; // integer-type value @@ -1493,7 +1493,7 @@ ID# ATTRIBUTE_NAME FLAGS VALUE WORST THRESH FAIL RAW_VALUE } - StorageAttribute attr; + AtaStorageAttribute attr; hz::string_is_numeric_nolocale(hz::string_trim_copy(id), attr.id, true, 10); attr.flag = hz::string_trim_copy(flag); uint8_t norm_value = 0, worst_value = 0, threshold_value = 0; @@ -1509,43 +1509,43 @@ ID# ATTRIBUTE_NAME FLAGS VALUE WORST THRESH FAIL RAW_VALUE } if (attr_format_style == FormatStyleBrief) { - attr.attr_type = app_pcre_match("/P/", attr.flag) ? StorageAttribute::AttributeType::prefail : StorageAttribute::AttributeType::old_age; + attr.attr_type = app_pcre_match("/P/", attr.flag) ? AtaStorageAttribute::AttributeType::prefail : AtaStorageAttribute::AttributeType::old_age; } else { if (attr_type == "Pre-fail") { - attr.attr_type = StorageAttribute::AttributeType::prefail; + attr.attr_type = AtaStorageAttribute::AttributeType::prefail; } else if (attr_type == "Old_age") { - attr.attr_type = StorageAttribute::AttributeType::old_age; + attr.attr_type = AtaStorageAttribute::AttributeType::old_age; } else { - attr.attr_type = StorageAttribute::AttributeType::unknown; + attr.attr_type = AtaStorageAttribute::AttributeType::unknown; } } if (attr_format_style == FormatStyleBrief) { - attr.update_type = app_pcre_match("/O/", attr.flag) ? StorageAttribute::UpdateType::always : StorageAttribute::UpdateType::offline; + attr.update_type = app_pcre_match("/O/", attr.flag) ? AtaStorageAttribute::UpdateType::always : AtaStorageAttribute::UpdateType::offline; } else { if (update_type == "Always") { - attr.update_type = StorageAttribute::UpdateType::always; + attr.update_type = AtaStorageAttribute::UpdateType::always; } else if (update_type == "Offline") { - attr.update_type = StorageAttribute::UpdateType::offline; + attr.update_type = AtaStorageAttribute::UpdateType::offline; } else { - attr.update_type = StorageAttribute::UpdateType::unknown; + attr.update_type = AtaStorageAttribute::UpdateType::unknown; } } - attr.when_failed = StorageAttribute::FailTime::unknown; + attr.when_failed = AtaStorageAttribute::FailTime::unknown; hz::string_trim(when_failed); if (when_failed == "-") { - attr.when_failed = StorageAttribute::FailTime::none; + attr.when_failed = AtaStorageAttribute::FailTime::none; } else if (when_failed == "In_the_past" || when_failed == "Past") { // the second one if from brief format - attr.when_failed = StorageAttribute::FailTime::past; + attr.when_failed = AtaStorageAttribute::FailTime::past; } else if (when_failed == "FAILING_NOW" || when_failed == "NOW") { // the second one if from brief format - attr.when_failed = StorageAttribute::FailTime::now; + attr.when_failed = AtaStorageAttribute::FailTime::now; } attr.raw_value = hz::string_trim_copy(raw_value); hz::string_is_numeric_nolocale(hz::string_trim_copy(raw_value), attr.raw_value_int, false); // same as raw_value, but parsed as int. - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name(hz::string_trim_copy(name)); p.reported_value = line; // use the whole line here p.value = attr; // attribute-type value; @@ -1564,11 +1564,11 @@ ID# ATTRIBUTE_NAME FLAGS VALUE WORST THRESH FAIL RAW_VALUE -bool SmartctlParser::parse_section_data_subsection_directory_log(const std::string& sub) +bool SmartctlTextParser::parse_section_data_subsection_directory_log(const std::string& sub) { - StorageProperty pt; // template for easy copying - pt.section = StorageProperty::Section::data; - pt.subsection = StorageProperty::SubSection::directory_log; + AtaStorageProperty pt; // template for easy copying + pt.section = AtaStorageProperty::Section::data; + pt.subsection = AtaStorageProperty::SubSection::directory_log; // Directory log contains: /* @@ -1589,7 +1589,7 @@ Address Access R/W Size Description // the whole subsection { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("General Purpose Log Directory", "directory_log"); p.reported_value = sub; p.value = p.reported_value; // string-type value @@ -1600,7 +1600,7 @@ Address Access R/W Size Description // supported / unsupported { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("General Purpose Log Directory supported", "directory_log_supported"); // p.reported_value; // nothing @@ -1616,11 +1616,11 @@ Address Access R/W Size Description -bool SmartctlParser::parse_section_data_subsection_error_log(const std::string& sub) +bool SmartctlTextParser::parse_section_data_subsection_error_log(const std::string& sub) { - StorageProperty pt; // template for easy copying - pt.section = StorageProperty::Section::data; - pt.subsection = StorageProperty::SubSection::error_log; + AtaStorageProperty pt; // template for easy copying + pt.section = AtaStorageProperty::Section::data; + pt.subsection = AtaStorageProperty::SubSection::error_log; // Note: The format of this section was changed somewhere between 5.0-x and 5.30. // The old format is doesn't really give any useful info, and whatever's left is somewhat @@ -1676,7 +1676,7 @@ Error 1 [0] occurred at disk power-on lifetime: 1 hours (0 days + 1 hours) hz::string_trim(name); hz::string_trim(value); - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name(name, "error_log_version"); p.reported_value = value; @@ -1694,7 +1694,7 @@ Error 1 [0] occurred at disk power-on lifetime: 1 hours (0 days + 1 hours) pcrecpp::RE re = app_pcre_re("/^(Warning: device does not support Error Logging)|(SMART Error Log not supported)$/mi"); if (re.PartialMatch(sub)) { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("error_log_unsupported"); p.displayable_name = "Warning"; p.readable_value = "Device does not support error logging"; @@ -1712,7 +1712,7 @@ Error 1 [0] occurred at disk power-on lifetime: 1 hours (0 days + 1 hours) if (re1.PartialMatch(sub, &value) || re2.PartialMatch(sub)) { hz::string_trim(value); - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("ATA Error Count", "error_log_error_count"); p.reported_value = value; @@ -1756,11 +1756,11 @@ Error 1 [0] occurred at disk power-on lifetime: 1 hours (0 days + 1 hours) re_state.PartialMatch(block, &state); re_type.PartialMatch(block, &etypes_str, &emore); - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name(hz::string_trim_copy(name)); // "Error 6" p.reported_value = block; - StorageErrorBlock eb; + AtaStorageErrorBlock eb; hz::string_is_numeric_nolocale(value_num, eb.error_num, false); hz::string_is_numeric_nolocale(value_time, eb.lifetime_hours, false); @@ -1785,7 +1785,7 @@ Error 1 [0] occurred at disk power-on lifetime: 1 hours (0 days + 1 hours) // the whole subsection { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("SMART Error Log", "error_log"); p.reported_value = sub; p.value = p.reported_value; // string-type value @@ -1805,11 +1805,11 @@ Error 1 [0] occurred at disk power-on lifetime: 1 hours (0 days + 1 hours) // -------------------- Selftest Log -bool SmartctlParser::parse_section_data_subsection_selftest_log(const std::string& sub) +bool SmartctlTextParser::parse_section_data_subsection_selftest_log(const std::string& sub) { - StorageProperty pt; // template for easy copying - pt.section = StorageProperty::Section::data; - pt.subsection = StorageProperty::SubSection::selftest_log; + AtaStorageProperty pt; // template for easy copying + pt.section = AtaStorageProperty::Section::data; + pt.subsection = AtaStorageProperty::SubSection::selftest_log; // Self-test log contains: // * structure revision number @@ -1832,7 +1832,7 @@ Num Test_Description Status Remaining LifeTime(hours) LBA // The whole subsection { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("SMART Self-Test Log", "selftest_log"); p.reported_value = sub; p.value = p.reported_value; // string-type value @@ -1847,7 +1847,7 @@ Num Test_Description Status Remaining LifeTime(hours) LBA pcrecpp::RE re = app_pcre_re("/^(Warning: device does not support Self Test Logging)|(SMART Self-test Log not supported)$/mi"); if (re.PartialMatch(sub)) { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("selftest_log_unsupported"); p.displayable_name = "Warning"; p.readable_value = "Device does not support self-test logging"; @@ -1870,7 +1870,7 @@ Num Test_Description Status Remaining LifeTime(hours) LBA if (re1.PartialMatch(sub, &name, &value) || re1_ex.PartialMatch(sub, &name, &value) || re2.PartialMatch(sub, &name, &value)) { hz::string_trim(value); - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name(hz::string_trim_copy(name), "selftest_log_version"); p.reported_value = value; @@ -1900,11 +1900,11 @@ Num Test_Description Status Remaining LifeTime(hours) LBA while (re.FindAndConsume(&input, &line, &num, &type, &status_str, &remaining, &hours, &lba)) { hz::string_trim(num); - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("Self-test entry " + num); p.reported_value = hz::string_trim_copy(line); - StorageSelftestEntry sse; + AtaStorageSelftestEntry sse; hz::string_is_numeric_nolocale(num, sse.test_num, false); hz::string_is_numeric_nolocale(hz::string_trim_copy(remaining), sse.remaining_percent, false); @@ -1917,37 +1917,37 @@ Num Test_Description Status Remaining LifeTime(hours) LBA sse.lba_of_first_error = "-"; hz::string_trim(status_str); - StorageSelftestEntry::Status status = StorageSelftestEntry::Status::unknown; + AtaStorageSelftestEntry::Status status = AtaStorageSelftestEntry::Status::unknown; // don't match end - some of them are not complete here if (app_pcre_match("/^Completed without error/mi", status_str)) { - status = StorageSelftestEntry::Status::completed_no_error; + status = AtaStorageSelftestEntry::Status::completed_no_error; } else if (app_pcre_match("/^Aborted by host/mi", status_str)) { - status = StorageSelftestEntry::Status::aborted_by_host; + status = AtaStorageSelftestEntry::Status::aborted_by_host; } else if (app_pcre_match("/^Interrupted \\(host reset\\)/mi", status_str)) { - status = StorageSelftestEntry::Status::interrupted; + status = AtaStorageSelftestEntry::Status::interrupted; } else if (app_pcre_match("/^Fatal or unknown error/mi", status_str)) { - status = StorageSelftestEntry::Status::fatal_or_unknown; + status = AtaStorageSelftestEntry::Status::fatal_or_unknown; } else if (app_pcre_match("/^Completed: unknown failure/mi", status_str)) { - status = StorageSelftestEntry::Status::compl_unknown_failure; + status = AtaStorageSelftestEntry::Status::compl_unknown_failure; } else if (app_pcre_match("/^Completed: electrical failure/mi", status_str)) { - status = StorageSelftestEntry::Status::compl_electrical_failure; + status = AtaStorageSelftestEntry::Status::compl_electrical_failure; } else if (app_pcre_match("/^Completed: servo\\/seek failure/mi", status_str)) { - status = StorageSelftestEntry::Status::compl_servo_failure; + status = AtaStorageSelftestEntry::Status::compl_servo_failure; } else if (app_pcre_match("/^Completed: read failure/mi", status_str)) { - status = StorageSelftestEntry::Status::compl_read_failure; + status = AtaStorageSelftestEntry::Status::compl_read_failure; } else if (app_pcre_match("/^Completed: handling damage/mi", status_str)) { - status = StorageSelftestEntry::Status::compl_handling_damage; + status = AtaStorageSelftestEntry::Status::compl_handling_damage; } else if (app_pcre_match("/^Self-test routine in progress/mi", status_str)) { - status = StorageSelftestEntry::Status::in_progress; + status = AtaStorageSelftestEntry::Status::in_progress; } else if (app_pcre_match("/^Unknown\\/reserved test status/mi", status_str)) { - status = StorageSelftestEntry::Status::reserved; + status = AtaStorageSelftestEntry::Status::reserved; } sse.status_str = status_str; sse.status = status; - p.value = sse; // StorageSelftestEntry value + p.value = sse; // AtaStorageSelftestEntry value add_property(p); data_found = true; @@ -1960,7 +1960,7 @@ Num Test_Description Status Remaining LifeTime(hours) LBA // number of tests. // Note: "No self-tests have been logged" is sometimes absent, so don't rely on it. { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("Number of entries in self-test log", "selftest_num_entries"); // p.reported_value; // nothing p.value = test_count; // integer @@ -1981,11 +1981,11 @@ Num Test_Description Status Remaining LifeTime(hours) LBA // -------------------- Selective Selftest Log -bool SmartctlParser::parse_section_data_subsection_selective_selftest_log(const std::string& sub) +bool SmartctlTextParser::parse_section_data_subsection_selective_selftest_log(const std::string& sub) { - StorageProperty pt; // template for easy copying - pt.section = StorageProperty::Section::data; - pt.subsection = StorageProperty::SubSection::selective_selftest_log; + AtaStorageProperty pt; // template for easy copying + pt.section = AtaStorageProperty::Section::data; + pt.subsection = AtaStorageProperty::SubSection::selective_selftest_log; // Selective self-test log contains: /* @@ -2005,7 +2005,7 @@ If Selective self-test is pending on power-up, resume after 0 minute delay. // the whole subsection { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("SMART Selective self-test log", "SubSection::selective_selftest_log"); p.reported_value = sub; p.value = p.reported_value; // string-type value @@ -2016,7 +2016,7 @@ If Selective self-test is pending on power-up, resume after 0 minute delay. // supported / unsupported { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("Selective self-tests supported", "selective_selftest_supported"); // p.reported_value; // nothing @@ -2034,11 +2034,11 @@ If Selective self-test is pending on power-up, resume after 0 minute delay. -bool SmartctlParser::parse_section_data_subsection_scttemp_log(const std::string& sub) +bool SmartctlTextParser::parse_section_data_subsection_scttemp_log(const std::string& sub) { - StorageProperty pt; // template for easy copying - pt.section = StorageProperty::Section::data; - pt.subsection = StorageProperty::SubSection::temperature_log; + AtaStorageProperty pt; // template for easy copying + pt.section = AtaStorageProperty::Section::data; + pt.subsection = AtaStorageProperty::SubSection::temperature_log; // scttemp log contains: /* @@ -2075,7 +2075,7 @@ Index Estimated Time Temperature Celsius // the whole subsection { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("SCT temperature log", "scttemp_log"); p.reported_value = sub; p.value = p.reported_value; // string-type value @@ -2086,7 +2086,7 @@ Index Estimated Time Temperature Celsius // supported / unsupported { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("SCT commands unsupported", "sct_unsupported"); // p.reported_value; // nothing @@ -2103,9 +2103,9 @@ Index Estimated Time Temperature Celsius { std::string name, value; if (app_pcre_match("/^(Current Temperature):[ \\t]+(.*) Celsius$/mi", sub, &name, &value)) { - StorageProperty p; - p.section = StorageProperty::Section::data; - p.subsection = StorageProperty::SubSection::temperature_log; + AtaStorageProperty p; + p.section = AtaStorageProperty::Section::data; + p.subsection = AtaStorageProperty::SubSection::temperature_log; p.set_name("Current Temperature", "sct_temperature_celsius"); p.reported_value = value; p.value = hz::string_to_number_nolocale(value); // integer @@ -2120,11 +2120,11 @@ Index Estimated Time Temperature Celsius -bool SmartctlParser::parse_section_data_subsection_scterc_log(const std::string& sub) +bool SmartctlTextParser::parse_section_data_subsection_scterc_log(const std::string& sub) { - StorageProperty pt; // template for easy copying - pt.section = StorageProperty::Section::data; - pt.subsection = StorageProperty::SubSection::erc_log; + AtaStorageProperty pt; // template for easy copying + pt.section = AtaStorageProperty::Section::data; + pt.subsection = AtaStorageProperty::SubSection::erc_log; // scterc log contains: /* @@ -2136,7 +2136,7 @@ SCT Error Recovery Control: // the whole subsection { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("SCT ERC log", "scterc_log"); p.reported_value = sub; p.value = p.reported_value; // string-type value @@ -2147,7 +2147,7 @@ SCT Error Recovery Control: // supported / unsupported { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("SCT ERC supported", "sct_erc_supported"); // p.reported_value; // nothing @@ -2165,11 +2165,11 @@ SCT Error Recovery Control: -bool SmartctlParser::parse_section_data_subsection_devstat(const std::string& sub) +bool SmartctlTextParser::parse_section_data_subsection_devstat(const std::string& sub) { - StorageProperty pt; // template for easy copying - pt.section = StorageProperty::Section::data; - pt.subsection = StorageProperty::SubSection::devstat; + AtaStorageProperty pt; // template for easy copying + pt.section = AtaStorageProperty::Section::data; + pt.subsection = AtaStorageProperty::SubSection::devstat; // devstat log contains: /* @@ -2216,7 +2216,7 @@ Page Offset Size Value Description // supported / unsupported bool supported = true; { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("Device statistics supported", "devstat_supported"); // p.reported_value; // nothing @@ -2306,7 +2306,7 @@ Page Offset Size Value Description } - StorageStatistic st; + AtaStorageStatistic st; st.is_header = (hz::string_trim_copy(value) == "="); st.flags = st.is_header ? std::string() : hz::string_trim_copy(flags); st.value = st.is_header ? std::string() : hz::string_trim_copy(value); @@ -2318,7 +2318,7 @@ Page Offset Size Value Description description = hz::string_trim_copy(hz::string_trim_copy(description, "=")); } - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name(hz::string_trim_copy(description)); p.reported_value = line; // use the whole line here p.value = st; // statistic-type value @@ -2335,11 +2335,11 @@ Page Offset Size Value Description -bool SmartctlParser::parse_section_data_subsection_sataphy(const std::string& sub) +bool SmartctlTextParser::parse_section_data_subsection_sataphy(const std::string& sub) { - StorageProperty pt; // template for easy copying - pt.section = StorageProperty::Section::data; - pt.subsection = StorageProperty::SubSection::phy_log; + AtaStorageProperty pt; // template for easy copying + pt.section = AtaStorageProperty::Section::data; + pt.subsection = AtaStorageProperty::SubSection::phy_log; // sataphy log contains: /* @@ -2359,7 +2359,7 @@ ID Size Value Description // the whole subsection { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("SATA Phy log", "sataphy_log"); p.reported_value = sub; p.value = p.reported_value; // string-type value @@ -2370,7 +2370,7 @@ ID Size Value Description // supported / unsupported { - StorageProperty p(pt); + AtaStorageProperty p(pt); p.set_name("SATA Phy log supported", "sataphy_supported"); // p.reported_value; // nothing @@ -2389,21 +2389,21 @@ ID Size Value Description -std::string SmartctlParser::get_data_full() const +std::string SmartctlTextParser::get_data_full() const { return data_full_; } -std::string SmartctlParser::get_error_msg() const +std::string SmartctlTextParser::get_error_msg() const { return Glib::ustring::compose(_("Cannot parse smartctl output: %1"), error_msg_); } -const std::vector& SmartctlParser::get_properties() const +const std::vector& SmartctlTextParser::get_properties() const { return properties_; } @@ -2412,10 +2412,10 @@ const std::vector& SmartctlParser::get_properties() const // adds a property into property list, looks up and sets its description. // Yes, there's no place for this in the Parser, but whatever... -void SmartctlParser::add_property(StorageProperty p) +void SmartctlTextParser::add_property(AtaStorageProperty p) { - storage_property_autoset_description(p, disk_type_); - storage_property_autoset_warning(p); + ata_storage_property_autoset_description(p, disk_type_); + ata_storage_property_autoset_warning(p); storage_property_autoset_warning_descr(p); // append warning to description properties_.push_back(p); @@ -2423,28 +2423,28 @@ void SmartctlParser::add_property(StorageProperty p) -void SmartctlParser::set_data_full(const std::string& s) +void SmartctlTextParser::set_data_full(const std::string& s) { data_full_ = s; } -void SmartctlParser::set_data_section_info(const std::string& s) +void SmartctlTextParser::set_data_section_info(const std::string& s) { data_section_info_ = s; } -void SmartctlParser::set_data_section_data(const std::string& s) +void SmartctlTextParser::set_data_section_data(const std::string& s) { data_section_data_ = s; } -void SmartctlParser::set_error_msg(const std::string& s) +void SmartctlTextParser::set_error_msg(const std::string& s) { error_msg_ = s; } diff --git a/src/applib/smartctl_parser.h b/src/applib/smartctl_text_parser.h similarity index 86% rename from src/applib/smartctl_parser.h rename to src/applib/smartctl_text_parser.h index 234807f..76a117a 100644 --- a/src/applib/smartctl_parser.h +++ b/src/applib/smartctl_text_parser.h @@ -9,24 +9,24 @@ Copyright: /// \weakgroup applib /// @{ -#ifndef SMARTCTL_PARSER_H -#define SMARTCTL_PARSER_H +#ifndef SMARTCTL_TEXT_PARSER_H +#define SMARTCTL_TEXT_PARSER_H #include #include -#include "storage_property.h" +#include "ata_storage_property.h" /// Smartctl parser. /// Note: ALL parse_* functions (except parse_full() and parse_version()) /// expect data in unix-newline format! -class SmartctlParser { +class SmartctlTextParser { public: /// Parse full "smartctl -x" output - bool parse_full(const std::string& full, StorageAttribute::DiskType disk_type); + bool parse_full(const std::string& full, AtaStorageAttribute::DiskType disk_type); /// Supply any output of smartctl here, the smartctl version will be retrieved. @@ -53,7 +53,7 @@ class SmartctlParser { bool parse_section_info(const std::string& body); /// Parse a component (one line) of the info section - bool parse_section_info_property(StorageProperty& p); + bool parse_section_info_property(AtaStorageProperty& p); /// Parse the Data section (without "===" header) @@ -73,7 +73,7 @@ class SmartctlParser { bool parse_section_data_subsection_sataphy(const std::string& sub); /// Check the capabilities for internal properties we can use. - bool parse_section_data_internal_capabilities(StorageProperty& cap_prop); + bool parse_section_data_internal_capabilities(AtaStorageProperty& cap_prop); /// Clear parsed data @@ -109,7 +109,7 @@ class SmartctlParser { /// Get parse result properties - [[nodiscard]] const std::vector& get_properties() const; + [[nodiscard]] const std::vector& get_properties() const; @@ -117,7 +117,7 @@ class SmartctlParser { /// Add a property into property list, look up and set its description - void add_property(StorageProperty p); + void add_property(AtaStorageProperty p); /// Set "full" data ("smartctl -x" output) @@ -137,7 +137,7 @@ class SmartctlParser { - std::vector properties_; ///< Parsed data properties + std::vector properties_; ///< Parsed data properties std::string data_full_; ///< full data, filled by parse_full() std::string data_section_info_; ///< "info" section data, filled by parse_section_info() @@ -145,7 +145,7 @@ class SmartctlParser { std::string error_msg_; ///< This will be filled with some displayable message on error - StorageAttribute::DiskType disk_type_ = StorageAttribute::DiskType::Any; ///< Disk type (HDD, SSD) + AtaStorageAttribute::DiskType disk_type_ = AtaStorageAttribute::DiskType::Any; ///< Disk type (HDD, SSD) }; diff --git a/src/applib/storage_device.cpp b/src/applib/storage_device.cpp index 87ff3cf..cd73f45 100644 --- a/src/applib/storage_device.cpp +++ b/src/applib/storage_device.cpp @@ -19,7 +19,7 @@ Copyright: #include "app_pcrecpp.h" #include "storage_device.h" -#include "smartctl_parser.h" +#include "smartctl_text_parser.h" #include "storage_settings.h" #include "smartctl_executor.h" @@ -145,7 +145,7 @@ std::string StorageDevice::parse_basic_data(bool do_set_properties, bool emit_si } std::string version, version_full; - if (!SmartctlParser::parse_version(this->info_output_, version, version_full)) // is this smartctl data at all? + if (!SmartctlTextParser::parse_version(this->info_output_, version, version_full)) // is this smartctl data at all? return _("Cannot get smartctl version information."); // Detect type. note: we can't distinguish between sata and scsi (on linux, for -d ata switch). @@ -171,10 +171,10 @@ std::string StorageDevice::parse_basic_data(bool do_set_properties, bool emit_si smart_enabled_ = false; } else { - // Note: We don't use SmartctlParser here, because this information + // Note: We don't use SmartctlTextParser here, because this information // may be in some other format. If this information is valid, only then it's - // passed to SmartctlParser. - // Compared to SmartctlParser, this one is much looser. + // passed to SmartctlTextParser. + // Compared to SmartctlTextParser, this one is much looser. // Don't put complete messages here - they change across smartctl versions. if (app_pcre_match("/^SMART support is:[ \\t]*Unavailable/mi", info_output_) // cdroms output this @@ -225,7 +225,7 @@ std::string StorageDevice::parse_basic_data(bool do_set_properties, bool emit_si std::string size; if (app_pcre_match("/^User Capacity:[ \\t]*(.*)$/mi", info_output_, &size)) { int64_t bytes = 0; - size_ = SmartctlParser::parse_byte_size(size, bytes, false); + size_ = SmartctlTextParser::parse_byte_size(size, bytes, false); } @@ -233,11 +233,11 @@ std::string StorageDevice::parse_basic_data(bool do_set_properties, bool emit_si // Note that this may try to parse data the second time (it may already have // been parsed by parse_data() which failed at it). if (do_set_properties) { - StorageAttribute::DiskType disk_type = StorageAttribute::DiskType::Any; + AtaStorageAttribute::DiskType disk_type = AtaStorageAttribute::DiskType::Any; if (hdd_.has_value()) { - disk_type = hdd_.value() ? StorageAttribute::DiskType::Hdd : StorageAttribute::DiskType::Ssd; + disk_type = hdd_.value() ? AtaStorageAttribute::DiskType::Hdd : AtaStorageAttribute::DiskType::Ssd; } - SmartctlParser ps; + SmartctlTextParser ps; if (ps.parse_full(this->info_output_, disk_type)) { // try to parse it this->set_properties(ps.get_properties()); // copy to our drive, overwriting old data } @@ -247,7 +247,7 @@ std::string StorageDevice::parse_basic_data(bool do_set_properties, bool emit_si set_parse_status(model_name_.has_value() ? ParseStatus::info : ParseStatus::none); if (emit_signal) - signal_changed.emit(this); // notify listeners + signal_changed().emit(this); // notify listeners return std::string(); } @@ -297,18 +297,18 @@ std::string StorageDevice::parse_data() { this->clear_fetched(false); // clear everything fetched before, except outputs - StorageAttribute::DiskType disk_type = StorageAttribute::DiskType::Any; + AtaStorageAttribute::DiskType disk_type = AtaStorageAttribute::DiskType::Any; if (hdd_.has_value()) { - disk_type = hdd_.value() ? StorageAttribute::DiskType::Hdd : StorageAttribute::DiskType::Ssd; + disk_type = hdd_.value() ? AtaStorageAttribute::DiskType::Hdd : AtaStorageAttribute::DiskType::Ssd; } - SmartctlParser ps; + SmartctlTextParser ps; if (ps.parse_full(this->full_output_, disk_type)) { // try to parse it (parse only, set the properties after basic parsing). // refresh basic info too this->info_output_ = ps.get_data_full(); // put data including version information // note: this will clear the non-basic properties! - // this will parse some info that is already parsed by SmartctlParser::parse_full(), + // this will parse some info that is already parsed by SmartctlTextParser::parse_full(), // but this one sets the StorageDevice class members, not properties. this->parse_basic_data(false, false); // don't emit signal, we're not complete yet. @@ -318,7 +318,7 @@ std::string StorageDevice::parse_data() // set the full properties this->set_properties(ps.get_properties()); // copy to our drive, overwriting old data - signal_changed.emit(this); // notify listeners + signal_changed().emit(this); // notify listeners return std::string(); } @@ -330,7 +330,7 @@ std::string StorageDevice::parse_data() // proper parsing failed. try to at least extract info section this->info_output_ = this->full_output_; // complete output here. sometimes it's only the info section - if (!this->parse_basic_data(true).empty()) { // will add some properties too. this will emit signal_changed. + if (!this->parse_basic_data(true).empty()) { // will add some properties too. this will emit signal_changed(). return ps.get_error_msg(); // return full parser's error messages - they are more detailed. } @@ -470,7 +470,7 @@ StorageDevice::Status StorageDevice::get_aodc_status() const int found = 0; for (const auto& p : properties_) { - if (p.section == StorageProperty::Section::internal) { + if (p.section == AtaStorageProperty::Section::internal) { if (p.generic_name == "aodc_enabled") { // if this is not present at all, we set the unknown status. status = (p.get_value() ? Status::enabled : Status::disabled); //++found; @@ -506,13 +506,13 @@ std::string StorageDevice::get_device_size_str() const -StorageProperty StorageDevice::get_health_property() const +AtaStorageProperty StorageDevice::get_health_property() const { if (health_property_.has_value()) // cached return value return health_property_.value(); - StorageProperty p = this->lookup_property("overall_health", - StorageProperty::Section::data, StorageProperty::SubSection::health); + AtaStorageProperty p = this->lookup_property("overall_health", + AtaStorageProperty::Section::data, AtaStorageProperty::SubSection::health); if (!p.empty()) health_property_ = p; // store to cache @@ -650,25 +650,25 @@ std::string StorageDevice::get_virtual_filename() const -const std::vector& StorageDevice::get_properties() const +const std::vector& StorageDevice::get_properties() const { return properties_; } -StorageProperty StorageDevice::lookup_property(const std::string& generic_name, StorageProperty::Section section, StorageProperty::SubSection subsection) const +AtaStorageProperty StorageDevice::lookup_property(const std::string& generic_name, AtaStorageProperty::Section section, AtaStorageProperty::SubSection subsection) const { for (const auto& p : properties_) { - if (section != StorageProperty::Section::unknown && p.section != section) + if (section != AtaStorageProperty::Section::unknown && p.section != section) continue; - if (subsection != StorageProperty::SubSection::unknown && p.subsection != subsection) + if (subsection != AtaStorageProperty::SubSection::unknown && p.subsection != subsection) continue; if (p.generic_name == generic_name) return p; } - return StorageProperty(); // check with .empty() + return AtaStorageProperty(); // check with .empty() } @@ -748,7 +748,7 @@ void StorageDevice::set_test_is_active(bool b) bool changed = (test_is_active_ != b); test_is_active_ = b; if (changed) { - signal_changed.emit(this); // so that everybody stops any test-aborting operations. + signal_changed().emit(this); // so that everybody stops any test-aborting operations. } } @@ -843,6 +843,13 @@ std::string StorageDevice::execute_device_smartctl(const std::string& command_op +sigc::signal& StorageDevice::signal_changed() +{ + return signal_changed_; +} + + + void StorageDevice::set_parse_status(ParseStatus value) { parse_status_ = value; @@ -850,7 +857,7 @@ void StorageDevice::set_parse_status(ParseStatus value) -void StorageDevice::set_properties(std::vector props) +void StorageDevice::set_properties(std::vector props) { properties_ = std::move(props); } diff --git a/src/applib/storage_device.h b/src/applib/storage_device.h index be20b2e..0feee2b 100644 --- a/src/applib/storage_device.h +++ b/src/applib/storage_device.h @@ -19,8 +19,8 @@ Copyright: #include #include "hz/fs_ns.h" -#include "storage_property.h" -#include "smartctl_parser.h" // prop_list_t +#include "ata_storage_property.h" +#include "smartctl_text_parser.h" // prop_list_t #include "smartctl_executor.h" @@ -121,7 +121,7 @@ class StorageDevice { std::string get_device_size_str() const; /// Get the overall health property - StorageProperty get_health_property() const; + AtaStorageProperty get_health_property() const; /// Get device name (e.g. /dev/sda) @@ -176,13 +176,13 @@ class StorageDevice { /// Get all detected properties - const std::vector& get_properties() const; + const std::vector& get_properties() const; /// Find a property - StorageProperty lookup_property(const std::string& generic_name, - StorageProperty::Section section = StorageProperty::Section::unknown, // if unknown, search in all. - StorageProperty::SubSection subsection = StorageProperty::SubSection::unknown) const; + AtaStorageProperty lookup_property(const std::string& generic_name, + AtaStorageProperty::Section section = AtaStorageProperty::Section::unknown, // if unknown, search in all. + AtaStorageProperty::SubSection subsection = AtaStorageProperty::SubSection::unknown) const; /// Get model name. @@ -244,7 +244,7 @@ class StorageDevice { /// Emitted whenever new information is available - sigc::signal signal_changed; + sigc::signal& signal_changed(); protected: @@ -253,7 +253,7 @@ class StorageDevice { void set_parse_status(ParseStatus value); /// Set parsed properties - void set_properties(std::vector props); + void set_properties(std::vector props); private: @@ -287,9 +287,12 @@ class StorageDevice { std::optional serial_number_; ///< Serial number std::optional size_; ///< Formatted size std::optional hdd_; ///< Whether it's a rotational drive (HDD) or something else (SSD, flash, etc...) - mutable std::optional health_property_; ///< Cached health property. + mutable std::optional health_property_; ///< Cached health property. - std::vector properties_; ///< Smart properties. Detected through full output. + std::vector properties_; ///< Smart properties. Detected through full output. + + /// Emitted whenever new information is available + sigc::signal signal_changed_; }; diff --git a/src/applib/storage_property.cpp b/src/applib/storage_property.cpp deleted file mode 100644 index 9b94d98..0000000 --- a/src/applib/storage_property.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/****************************************************************************** -License: GNU General Public License v3.0 only -Copyright: - (C) 2008 - 2021 Alexander Shaduri -******************************************************************************/ -/// \file -/// \author Alexander Shaduri -/// \ingroup applib -/// \weakgroup applib -/// @{ - -#include "local_glibmm.h" -#include -#include // not iosfwd - it doesn't work -#include -#include -#include - -#include "hz/string_num.h" // number_to_string -#include "hz/stream_cast.h" // stream_cast<> -#include "hz/format_unit.h" // format_time_length -#include "hz/string_algo.h" // string_join -#include "hz/string_num.h" // number_to_string - -#include "storage_property.h" - - - -std::ostream& operator<< (std::ostream& os, const StorageCapability& p) -{ - os - // << p.name << ": " - << p.flag_value; - for (auto&& v : p.strvalues) { - os << "\n\t" << v; - } - return os; -} - - - -std::string StorageAttribute::format_raw_value() const -{ - // If it's fully a number, format it with commas - if (hz::number_to_string_nolocale(raw_value_int) == raw_value) { - std::stringstream ss; - try { - ss.imbue(std::locale("")); - } - catch (const std::runtime_error& e) { - // something is wrong with system locale, can't do anything here. - } - ss << std::fixed << raw_value_int; - return ss.str(); - } - return raw_value; -} - - - -std::ostream& operator<< (std::ostream& os, const StorageAttribute& p) -{ -// os << p.name << ": " - if (p.value.has_value()) { - os << static_cast(p.value.value()); - } else { - os << "-"; - } - os << " (" << p.format_raw_value() << ")"; - return os; -} - - - -std::string StorageStatistic::format_value() const -{ - // If it's fully a number, format it with commas - if (hz::number_to_string_nolocale(value_int) == value) { - std::stringstream ss; - try { - ss.imbue(std::locale("")); - } - catch (const std::runtime_error& e) { - // something is wrong with system locale, can't do anything here. - } - ss << std::fixed << value_int; - return ss.str(); - } - return value; -} - - - -std::ostream& operator<<(std::ostream& os, const StorageStatistic& p) -{ - os << p.value; - return os; -} - - - -std::string StorageErrorBlock::get_displayable_error_types(const std::vector& types) -{ - static const std::map m = { - {"ABRT", _("Command aborted")}, - {"AMNF", _("Address mark not found")}, - {"CCTO", _("Command completion timed out")}, - {"EOM", _("End of media")}, - {"ICRC", _("Interface CRC error")}, - {"IDNF", _("Identity not found")}, - {"ILI", _("(Packet command-set specific)")}, - {"MC", _("Media changed")}, - {"MCR", _("Media change request")}, - {"NM", _("No media")}, - {"obs", _("Obsolete")}, - {"TK0NF", _("Track 0 not found")}, - {"UNC", _("Uncorrectable error in data")}, - {"WP", _("Media is write protected")}, - }; - - std::vector sv; - for (const auto& type : types) { - if (m.find(type) != m.end()) { - sv.push_back(m.at(type)); - } else { - std::string name = _("Uknown type"); - if (!type.empty()) { - name = Glib::ustring::compose(_("Uknown type: %1"), type); - } - sv.push_back(name); - } - } - - return hz::string_join(sv, _(", ")); -} - - - -WarningLevel StorageErrorBlock::get_warning_level_for_error_type(const std::string& type) -{ - static const std::map m = { - {"ABRT", WarningLevel::none}, - {"AMNF", WarningLevel::alert}, - {"CCTO", WarningLevel::warning}, - {"EOM", WarningLevel::warning}, - {"ICRC", WarningLevel::warning}, - {"IDNF", WarningLevel::alert}, - {"ILI", WarningLevel::notice}, - {"MC", WarningLevel::none}, - {"MCR", WarningLevel::none}, - {"NM", WarningLevel::none}, - {"obs", WarningLevel::none}, - {"TK0NF", WarningLevel::alert}, - {"UNC", WarningLevel::alert}, - {"WP", WarningLevel::none}, - }; - - if (m.find(type) != m.end()) { - return m.at(type); - } - return WarningLevel::none; // unknown error -} - - - -std::string StorageErrorBlock::format_lifetime_hours() const -{ - std::stringstream ss; - try { - ss.imbue(std::locale("")); - } - catch (const std::runtime_error& e) { - // something is wrong with system locale, can't do anything here. - } - ss << std::fixed << lifetime_hours; - return ss.str(); -} - - - -std::ostream& operator<< (std::ostream& os, const StorageErrorBlock& b) -{ - os << "Error number " << b.error_num << ": " - << hz::string_join(b.reported_types, ", ") - << " [" << StorageErrorBlock::get_displayable_error_types(b.reported_types) << "]"; - return os; -} - - - -std::string StorageSelftestEntry::format_lifetime_hours() const -{ - std::stringstream ss; - try { - ss.imbue(std::locale("")); - } - catch (const std::runtime_error& e) { - // something is wrong with system locale, can't do anything here. - } - ss << std::fixed << lifetime_hours; - return ss.str(); -} - - - -std::ostream& operator<< (std::ostream& os, const StorageSelftestEntry& b) -{ - os << "Test entry " << b.test_num << ": " - << b.type << ", status: " << b.get_status_str() << ", remaining: " << int(b.remaining_percent); - return os; -} - - - - -void StorageProperty::dump(std::ostream& os, std::size_t internal_offset) const -{ - std::string offset(internal_offset, ' '); - - os << offset << "[" << get_section_name(section) - << (section == Section::data ? (", " + get_subsection_name(subsection)) : "") << "]" - << " " << generic_name - // << (generic_name == reported_name ? "" : (" (" + reported_name + ")")) - << ": [" << get_value_type_name() << "] "; - - // if (!readable_value.empty()) - // os << readable_value; - - if (std::holds_alternative(value)) { - os << "[empty]"; - } else if (std::holds_alternative(value)) { - os << std::get(value); - } else if (std::holds_alternative(value)) { - os << std::get(value) << " [" << reported_value << "]"; - } else if (std::holds_alternative(value)) { - os << std::string(std::get(value) ? "Yes" : "No") << " [" << reported_value << "]"; - } else if (std::holds_alternative(value)) { - os << std::get(value).count() << " sec [" << reported_value << "]"; - } else if (std::holds_alternative(value)) { - os << std::get(value); - } else if (std::holds_alternative(value)) { - os << std::get(value); - } else if (std::holds_alternative(value)) { - os << std::get(value); - } else if (std::holds_alternative(value)) { - os << std::get(value); - } else if (std::holds_alternative(value)) { - os << std::get(value); - } -} - - - -std::string StorageProperty::format_value(bool add_reported_too) const -{ - if (!readable_value.empty()) - return readable_value; - - if (std::holds_alternative(value)) - return "[unknown]"; - if (std::holds_alternative(value)) - return std::get(value); - if (std::holds_alternative(value)) - return hz::number_to_string_locale(std::get(value)) + (add_reported_too ? (" [" + reported_value + "]") : ""); - if (std::holds_alternative(value)) - return std::string(std::get(value) ? "Yes" : "No") + (add_reported_too ? (" [" + reported_value + "]") : ""); - if (std::holds_alternative(value)) - return hz::format_time_length(std::get(value)) + (add_reported_too ? (" [" + reported_value + "]") : ""); - if (std::holds_alternative(value)) - return hz::stream_cast(std::get(value)); - if (std::holds_alternative(value)) - return hz::stream_cast(std::get(value)); - if (std::holds_alternative(value)) - return hz::stream_cast(std::get(value)); - if (std::holds_alternative(value)) - return hz::stream_cast(std::get(value)); - if (std::holds_alternative(value)) - return hz::stream_cast(std::get(value)); - - return "[internal_error]"; -} - - - - - - - -/// @} diff --git a/src/applib/storage_property_colors.h b/src/applib/warning_colors.h similarity index 71% rename from src/applib/storage_property_colors.h rename to src/applib/warning_colors.h index 53e12c9..2acd6f9 100644 --- a/src/applib/storage_property_colors.h +++ b/src/applib/warning_colors.h @@ -9,12 +9,12 @@ Copyright: /// \weakgroup applib /// @{ -#ifndef STORAGE_PROPERTY_COLORS_H -#define STORAGE_PROPERTY_COLORS_H +#ifndef WARNING_COLORS_H +#define WARNING_COLORS_H #include "local_glibmm.h" -#include "storage_property.h" +#include "ata_storage_property.h" @@ -62,7 +62,7 @@ inline bool app_property_get_label_highlight_color(WarningLevel warning, std::st /// Format warning text, but without description -inline std::string storage_property_get_warning_reason(const StorageProperty& p) +inline std::string storage_property_get_warning_reason(const AtaStorageProperty& p) { std::string fg, start = "", stop = ""; if (app_property_get_label_highlight_color(p.warning, fg)) { @@ -70,17 +70,19 @@ inline std::string storage_property_get_warning_reason(const StorageProperty& p) stop = "" + stop; } - if (p.warning == WarningLevel::notice) { - /// Translators: %1 and %2 are HTML tags, %3 is a message. - return Glib::ustring::compose(_("%1Notice:%2 %3"), start, stop, p.warning_reason); - - } else if (p.warning == WarningLevel::warning) { - /// Translators: %1 and %2 are HTML tags, %3 is a message. - return Glib::ustring::compose(_("%1Warning:%2 %3"), start, stop, p.warning_reason); - - } else if (p.warning == WarningLevel::alert) { - /// Translators: %1 and %2 are HTML tags, %3 is a message. - return Glib::ustring::compose(_("%1ALERT:%2 %3"), start, stop, p.warning_reason); + switch (p.warning) { + case WarningLevel::none: + // nothing + break; + case WarningLevel::notice: + /// Translators: %1 and %2 are HTML tags, %3 is a message. + return Glib::ustring::compose(_("%1Notice:%2 %3"), start, stop, p.warning_reason); + case WarningLevel::warning: + /// Translators: %1 and %2 are HTML tags, %3 is a message. + return Glib::ustring::compose(_("%1Warning:%2 %3"), start, stop, p.warning_reason); + case WarningLevel::alert: + /// Translators: %1 and %2 are HTML tags, %3 is a message. + return Glib::ustring::compose(_("%1ALERT:%2 %3"), start, stop, p.warning_reason); } return std::string(); @@ -90,7 +92,7 @@ inline std::string storage_property_get_warning_reason(const StorageProperty& p) /// Append warning text to description and set it on the property -inline void storage_property_autoset_warning_descr(StorageProperty& p) +inline void storage_property_autoset_warning_descr(AtaStorageProperty& p) { std::string reason = storage_property_get_warning_reason(p); p.set_description(p.get_description() + (reason.empty() ? "" : "\n\n" + reason)); diff --git a/src/gsc_about_dialog.cpp b/src/gsc_about_dialog.cpp index 802325c..82c859b 100644 --- a/src/gsc_about_dialog.cpp +++ b/src/gsc_about_dialog.cpp @@ -15,7 +15,6 @@ Copyright: #include "hz/string_algo.h" // hz::string_* #include "hz/launch_url.h" #include "hz/data_file.h" -#include "applib/app_gtkmm_features.h" #include "gsc_about_dialog.h" diff --git a/src/gsc_add_device_window.cpp b/src/gsc_add_device_window.cpp index 0a74421..9d4d9c5 100644 --- a/src/gsc_add_device_window.cpp +++ b/src/gsc_add_device_window.cpp @@ -15,7 +15,7 @@ Copyright: #include "hz/fs_ns.h" #include "hz/string_sprintf.h" -#include "applib/app_gtkmm_utils.h" +#include "applib/app_gtkmm_tools.h" #include "gsc_add_device_window.h" #include "gsc_main_window.h" diff --git a/src/gsc_executor_log_window.cpp b/src/gsc_executor_log_window.cpp index e0bfb94..cc054ce 100644 --- a/src/gsc_executor_log_window.cpp +++ b/src/gsc_executor_log_window.cpp @@ -16,8 +16,7 @@ Copyright: #include // std::size_t #include -#include "applib/app_gtkmm_utils.h" // app_gtkmm_create_tree_view_column -#include "applib/app_gtkmm_features.h" +#include "applib/app_gtkmm_tools.h" // app_gtkmm_create_tree_view_column #include "hz/fs.h" #include "rconfig/rconfig.h" diff --git a/src/gsc_info_window.cpp b/src/gsc_info_window.cpp index b785dff..97d6864 100644 --- a/src/gsc_info_window.cpp +++ b/src/gsc_info_window.cpp @@ -23,8 +23,8 @@ Copyright: #include "hz/format_unit.h" // format_time_length #include "rconfig/rconfig.h" // rconfig::* -#include "applib/app_gtkmm_utils.h" // app_gtkmm_* -#include "applib/storage_property_colors.h" +#include "applib/app_gtkmm_tools.h" // app_gtkmm_* +#include "applib/warning_colors.h" #include "applib/gui_utils.h" // gui_show_error_dialog #include "applib/smartctl_executor_gui.h" @@ -39,15 +39,15 @@ using namespace std::literals; -/// A label for StorageProperty +/// A label for AtaStorageProperty struct PropertyLabel { /// Constructor - PropertyLabel(std::string label_, const StorageProperty* prop, bool markup_ = false) : + PropertyLabel(std::string label_, const AtaStorageProperty* prop, bool markup_ = false) : label(std::move(label_)), property(prop), markup(markup_) { } std::string label; ///< Label text - const StorageProperty* property = nullptr; ///< Storage property + const AtaStorageProperty* property = nullptr; ///< Storage property bool markup = false; ///< Whether the label text uses markup }; @@ -114,9 +114,9 @@ namespace { /// Cell renderer functions for list cells inline void app_list_cell_renderer_func(Gtk::CellRenderer* cr, const Gtk::TreeModel::iterator& iter, - Gtk::TreeModelColumn storage_column) + Gtk::TreeModelColumn storage_column) { - const StorageProperty* p = (*iter)[storage_column]; + const AtaStorageProperty* p = (*iter)[storage_column]; if (auto* crt = dynamic_cast(cr)) { std::string fg, bg; if (app_property_get_row_highlight_colors(p->warning, fg, bg)) { @@ -130,7 +130,7 @@ namespace { crt->property_cell_background().reset_value(); crt->property_foreground().reset_value(); } - if (p->is_value_type() && p->get_value().is_header) { + if (p->is_value_type() && p->get_value().is_header) { crt->property_weight() = Pango::WEIGHT_BOLD; } else { crt->property_weight().reset_value(); @@ -358,7 +358,7 @@ void GscInfoWindow::set_drive(StorageDevicePtr d) if (drive) // if an old drive is present, disconnect our callback from it. drive_changed_connection.disconnect(); drive = std::move(d); - drive_changed_connection = drive->signal_changed.connect(sigc::mem_fun(this, + drive_changed_connection = drive->signal_changed().connect(sigc::mem_fun(this, &GscInfoWindow::on_drive_changed)); } @@ -867,13 +867,13 @@ void GscInfoWindow::on_test_type_combo_changed() -void GscInfoWindow::fill_ui_general(const std::vector& props) +void GscInfoWindow::fill_ui_general(const std::vector& props) { // filter out some properties - std::vector id_props, version_props, health_props; + std::vector id_props, version_props, health_props; for (auto&& p : props) { - if (p.section == StorageProperty::Section::info) { + if (p.section == AtaStorageProperty::Section::info) { if (p.generic_name == "smartctl_version_full") { version_props.push_back(p); } else if (p.generic_name == "smartctl_version") { @@ -881,7 +881,7 @@ void GscInfoWindow::fill_ui_general(const std::vector& props) } else { id_props.push_back(p); } - } else if (p.section == StorageProperty::Section::data && p.subsection == StorageProperty::SubSection::health) { + } else if (p.section == AtaStorageProperty::Section::data && p.subsection == AtaStorageProperty::SubSection::health) { health_props.push_back(p); } } @@ -958,7 +958,7 @@ void GscInfoWindow::fill_ui_general(const std::vector& props) -void GscInfoWindow::fill_ui_attributes(const std::vector& props) +void GscInfoWindow::fill_ui_attributes(const std::vector& props) { auto* treeview = lookup_widget("attributes_treeview"); @@ -1035,7 +1035,7 @@ void GscInfoWindow::fill_ui_attributes(const std::vector& props treeview->set_tooltip_column(col_tooltip.index()); - Gtk::TreeModelColumn col_storage; + Gtk::TreeModelColumn col_storage; model_columns.add(col_storage); @@ -1055,11 +1055,11 @@ void GscInfoWindow::fill_ui_attributes(const std::vector& props std::vector label_strings; // outside-of-tree properties for (const auto& p : props) { - if (p.section != StorageProperty::Section::data || p.subsection != StorageProperty::SubSection::attributes) + if (p.section != AtaStorageProperty::Section::data || p.subsection != AtaStorageProperty::SubSection::attributes) continue; // add non-attribute-type properties to label above - if (!p.is_value_type()) { + if (!p.is_value_type()) { label_strings.emplace_back(p.displayable_name + ": " + p.format_value(), &p); if (int(p.warning) > int(max_tab_warning)) @@ -1067,14 +1067,14 @@ void GscInfoWindow::fill_ui_attributes(const std::vector& props continue; } - const auto& attr = p.get_value(); + const auto& attr = p.get_value(); - std::string attr_type = StorageAttribute::get_attr_type_name(attr.attr_type); - if (attr.attr_type == StorageAttribute::AttributeType::prefail) + std::string attr_type = AtaStorageAttribute::get_attr_type_name(attr.attr_type); + if (attr.attr_type == AtaStorageAttribute::AttributeType::prefail) attr_type.append("").append(attr_type).append(""); - std::string fail_time = StorageAttribute::get_fail_time_name(attr.when_failed); - if (attr.when_failed != StorageAttribute::FailTime::none) + std::string fail_time = AtaStorageAttribute::get_fail_time_name(attr.when_failed); + if (attr.when_failed != AtaStorageAttribute::FailTime::none) fail_time.append("").append(fail_time).append(""); Gtk::TreeRow row = *(list_store->append()); @@ -1087,7 +1087,7 @@ void GscInfoWindow::fill_ui_attributes(const std::vector& props row[col_threshold] = (attr.threshold.has_value() ? hz::number_to_string_locale(attr.threshold.value()) : "-"); row[col_raw] = attr.format_raw_value(); row[col_type] = attr_type; -// row[col_updated] = StorageAttribute::get_update_type_name(attr.update_type); +// row[col_updated] = AtaStorageAttribute::get_update_type_name(attr.update_type); row[col_failed] = fail_time; row[col_tooltip] = p.get_description(); row[col_storage] = &p; @@ -1106,7 +1106,7 @@ void GscInfoWindow::fill_ui_attributes(const std::vector& props -void GscInfoWindow::fill_ui_statistics(const std::vector& props) +void GscInfoWindow::fill_ui_statistics(const std::vector& props) { auto* treeview = lookup_widget("statistics_treeview"); @@ -1145,7 +1145,7 @@ void GscInfoWindow::fill_ui_statistics(const std::vector& props model_columns.add(col_tooltip); treeview->set_tooltip_column(col_tooltip.index()); - Gtk::TreeModelColumn col_storage; + Gtk::TreeModelColumn col_storage; model_columns.add(col_storage); @@ -1164,11 +1164,11 @@ void GscInfoWindow::fill_ui_statistics(const std::vector& props std::vector label_strings; // outside-of-tree properties for (const auto& p : props) { - if (p.section != StorageProperty::Section::data || p.subsection != StorageProperty::SubSection::devstat) + if (p.section != AtaStorageProperty::Section::data || p.subsection != AtaStorageProperty::SubSection::devstat) continue; // add non-entry-type properties to label above - if (!p.is_value_type()) { + if (!p.is_value_type()) { label_strings.emplace_back(p.displayable_name + ": " + p.format_value(), &p); if (int(p.warning) > int(max_tab_warning)) @@ -1178,7 +1178,7 @@ void GscInfoWindow::fill_ui_statistics(const std::vector& props Gtk::TreeRow row = *(list_store->append()); - const auto& st = p.get_value(); + const auto& st = p.get_value(); row[col_description] = (st.is_header ? p.displayable_name : (" " + p.displayable_name)); row[col_value] = st.format_value(); row[col_flags] = st.flags; // it's a string, not int. @@ -1286,7 +1286,7 @@ void GscInfoWindow::fill_ui_self_test_info() -void GscInfoWindow::fill_ui_self_test_log(const std::vector& props) +void GscInfoWindow::fill_ui_self_test_log(const std::vector& props) { auto* treeview = lookup_widget("selftest_log_treeview"); @@ -1333,7 +1333,7 @@ void GscInfoWindow::fill_ui_self_test_log(const std::vector& pr model_columns.add(col_tooltip); treeview->set_tooltip_column(col_tooltip.index()); - Gtk::TreeModelColumn col_storage; + Gtk::TreeModelColumn col_storage; model_columns.add(col_storage); @@ -1353,14 +1353,14 @@ void GscInfoWindow::fill_ui_self_test_log(const std::vector& pr std::vector label_strings; // outside-of-tree properties for (auto&& p : props) { - if (p.section != StorageProperty::Section::data || p.subsection != StorageProperty::SubSection::selftest_log) + if (p.section != AtaStorageProperty::Section::data || p.subsection != AtaStorageProperty::SubSection::selftest_log) continue; if (p.generic_name == "selftest_log") // the whole section, we don't need it continue; // add non-entry properties to label above - if (!p.is_value_type()) { + if (!p.is_value_type()) { label_strings.emplace_back(p.displayable_name + ": " + p.format_value(), &p); if (int(p.warning) > int(max_tab_warning)) @@ -1370,7 +1370,7 @@ void GscInfoWindow::fill_ui_self_test_log(const std::vector& pr Gtk::TreeRow row = *(list_store->append()); - const auto& sse = p.get_value(); + const auto& sse = p.get_value(); row[col_num] = sse.test_num; row[col_type] = sse.type; @@ -1397,7 +1397,7 @@ void GscInfoWindow::fill_ui_self_test_log(const std::vector& pr -void GscInfoWindow::fill_ui_error_log(const std::vector& props) +void GscInfoWindow::fill_ui_error_log(const std::vector& props) { auto* treeview = lookup_widget("error_log_treeview"); @@ -1437,7 +1437,7 @@ void GscInfoWindow::fill_ui_error_log(const std::vector& props) model_columns.add(col_tooltip); treeview->set_tooltip_column(col_tooltip.index()); - Gtk::TreeModelColumn col_storage; + Gtk::TreeModelColumn col_storage; model_columns.add(col_storage); Gtk::TreeModelColumn col_mark_name; @@ -1460,7 +1460,7 @@ void GscInfoWindow::fill_ui_error_log(const std::vector& props) std::vector label_strings; // outside-of-tree properties for (auto&& p : props) { - if (p.section != StorageProperty::Section::data || p.subsection != StorageProperty::SubSection::error_log) + if (p.section != AtaStorageProperty::Section::data || p.subsection != AtaStorageProperty::SubSection::error_log) continue; // Note: Don't use property description as a tooltip here. It won't be available if there's no property. @@ -1494,13 +1494,13 @@ void GscInfoWindow::fill_ui_error_log(const std::vector& props) // add non-tree properties to label above - } else if (!p.is_value_type()) { + } else if (!p.is_value_type()) { label_strings.emplace_back(p.displayable_name + ": " + p.format_value(), &p); if (p.generic_name == "error_log_error_count") label_strings.back().label += " "s + _("(Note: The number of entries may be limited to the newest ones)"); } else { - const auto& eb = p.get_value(); + const auto& eb = p.get_value(); std::string type_details = eb.type_more_info; @@ -1508,7 +1508,7 @@ void GscInfoWindow::fill_ui_error_log(const std::vector& props) row[col_num] = eb.error_num; row[col_hours] = eb.format_lifetime_hours(); row[col_state] = eb.device_state; - row[col_type] = StorageErrorBlock::get_displayable_error_types(eb.reported_types); + row[col_type] = AtaStorageErrorBlock::get_displayable_error_types(eb.reported_types); row[col_details] = (type_details.empty() ? "-" : type_details); // e.g. OBS has no details // There are no descriptions in self-test log entries, so don't display // "No description available" for all of them. @@ -1530,7 +1530,7 @@ void GscInfoWindow::fill_ui_error_log(const std::vector& props) -void GscInfoWindow::fill_ui_temperature_log(const std::vector& props) +void GscInfoWindow::fill_ui_temperature_log(const std::vector& props) { auto* textview = lookup_widget("temperature_log_textview"); @@ -1538,7 +1538,7 @@ void GscInfoWindow::fill_ui_temperature_log(const std::vector& std::vector label_strings; // outside-of-tree properties std::string temperature; - StorageProperty temp_property; + AtaStorageProperty temp_property; enum { temp_attr2 = 1, temp_attr1, temp_stat, temp_sct }; // less important to more important int temp_prop_source = 0; @@ -1550,22 +1550,22 @@ void GscInfoWindow::fill_ui_temperature_log(const std::vector& temp_prop_source = temp_sct; } if (temp_prop_source < temp_stat && p.generic_name == "stat_temperature_celsius") { - temperature = hz::number_to_string_locale(p.get_value().value_int); + temperature = hz::number_to_string_locale(p.get_value().value_int); temp_property = p; temp_prop_source = temp_stat; } if (temp_prop_source < temp_attr1 && p.generic_name == "attr_temperature_celsius") { - temperature = hz::number_to_string_locale(p.get_value().raw_value_int); + temperature = hz::number_to_string_locale(p.get_value().raw_value_int); temp_property = p; temp_prop_source = temp_attr1; } if (temp_prop_source < temp_attr2 && p.generic_name == "attr_temperature_celsius_x10") { - temperature = hz::number_to_string_locale(p.get_value().raw_value_int / 10); + temperature = hz::number_to_string_locale(p.get_value().raw_value_int / 10); temp_property = p; temp_prop_source = temp_attr2; } - if (p.section != StorageProperty::Section::data || p.subsection != StorageProperty::SubSection::temperature_log) + if (p.section != AtaStorageProperty::Section::data || p.subsection != AtaStorageProperty::SubSection::temperature_log) continue; if (p.generic_name == "sct_unsupported" && p.get_value()) { // only show if unsupported @@ -1602,7 +1602,7 @@ void GscInfoWindow::fill_ui_temperature_log(const std::vector& -WarningLevel GscInfoWindow::fill_ui_capabilities(const std::vector& props) +WarningLevel GscInfoWindow::fill_ui_capabilities(const std::vector& props) { auto* treeview = lookup_widget("capabilities_treeview"); @@ -1635,7 +1635,7 @@ WarningLevel GscInfoWindow::fill_ui_capabilities(const std::vectorset_tooltip_column(col_tooltip.index()); - Gtk::TreeModelColumn col_storage; + Gtk::TreeModelColumn col_storage; model_columns.add(col_storage); @@ -1655,16 +1655,16 @@ WarningLevel GscInfoWindow::fill_ui_capabilities(const std::vector()) { - flag_value = hz::number_to_string_nolocale(p.get_value().flag_value, 16); // 0xXX - str_value = hz::string_join(p.get_value().strvalues, "\n"); + if (p.is_value_type()) { + flag_value = hz::number_to_string_nolocale(p.get_value().flag_value, 16); // 0xXX + str_value = hz::string_join(p.get_value().strvalues, "\n"); } else { // no flag value here str_value = p.format_value(); @@ -1692,14 +1692,14 @@ WarningLevel GscInfoWindow::fill_ui_capabilities(const std::vector& props) +WarningLevel GscInfoWindow::fill_ui_error_recovery(const std::vector& props) { auto* textview = lookup_widget("erc_log_textview"); WarningLevel max_tab_warning = WarningLevel::none; for (auto&& p : props) { - if (p.section != StorageProperty::Section::data || p.subsection != StorageProperty::SubSection::erc_log) + if (p.section != AtaStorageProperty::Section::data || p.subsection != AtaStorageProperty::SubSection::erc_log) continue; // Note: Don't use property description as a tooltip here. It won't be available if there's no property. @@ -1717,14 +1717,14 @@ WarningLevel GscInfoWindow::fill_ui_error_recovery(const std::vector& props) +WarningLevel GscInfoWindow::fill_ui_selective_self_test_log(const std::vector& props) { auto* textview = lookup_widget("selective_selftest_log_textview"); WarningLevel max_tab_warning = WarningLevel::none; for (auto&& p : props) { - if (p.section != StorageProperty::Section::data || p.subsection != StorageProperty::SubSection::selective_selftest_log) + if (p.section != AtaStorageProperty::Section::data || p.subsection != AtaStorageProperty::SubSection::selective_selftest_log) continue; // Note: Don't use property description as a tooltip here. It won't be available if there's no property. @@ -1742,14 +1742,14 @@ WarningLevel GscInfoWindow::fill_ui_selective_self_test_log(const std::vector& props) +WarningLevel GscInfoWindow::fill_ui_physical(const std::vector& props) { auto* textview = lookup_widget("phy_log_textview"); WarningLevel max_tab_warning = WarningLevel::none; for (auto&& p : props) { - if (p.section != StorageProperty::Section::data || p.subsection != StorageProperty::SubSection::phy_log) + if (p.section != AtaStorageProperty::Section::data || p.subsection != AtaStorageProperty::SubSection::phy_log) continue; // Note: Don't use property description as a tooltip here. It won't be available if there's no property. @@ -1767,14 +1767,14 @@ WarningLevel GscInfoWindow::fill_ui_physical(const std::vector& -WarningLevel GscInfoWindow::fill_ui_directory(const std::vector& props) +WarningLevel GscInfoWindow::fill_ui_directory(const std::vector& props) { auto* textview = lookup_widget("directory_log_textview"); WarningLevel max_tab_warning = WarningLevel::none; for (auto&& p : props) { - if (p.section != StorageProperty::Section::data || p.subsection != StorageProperty::SubSection::directory_log) + if (p.section != AtaStorageProperty::Section::data || p.subsection != AtaStorageProperty::SubSection::directory_log) continue; // Note: Don't use property description as a tooltip here. It won't be available if there's no property. @@ -1891,25 +1891,25 @@ gboolean GscInfoWindow::test_idle_callback(void* data) self->test_timer_poll.stop(); // just in case self->test_timer_bar.stop(); // just in case - StorageSelftestEntry::Status status = self->current_test->get_status(); + AtaStorageSelftestEntry::Status status = self->current_test->get_status(); bool aborted = false; - StorageSelftestEntry::StatusSeverity severity = StorageSelftestEntry::StatusSeverity::none; + AtaStorageSelftestEntry::StatusSeverity severity = AtaStorageSelftestEntry::StatusSeverity::none; std::string result_msg; if (!self->test_error_msg.empty()) { aborted = true; - severity = StorageSelftestEntry::StatusSeverity::error; + severity = AtaStorageSelftestEntry::StatusSeverity::error; result_msg = Glib::ustring::compose(_("Test aborted: %1"), self->test_error_msg); } else { - severity = StorageSelftestEntry::get_status_severity(status); - if (status == StorageSelftestEntry::Status::aborted_by_host) { + severity = AtaStorageSelftestEntry::get_status_severity(status); + if (status == AtaStorageSelftestEntry::Status::aborted_by_host) { aborted = true; result_msg = ""s + _("Test was manually aborted.") + ""; // it's a StatusSeverity::none message } else { - result_msg = Glib::ustring::compose(_("Test result: %1."), StorageSelftestEntry::get_status_displayable_name(status)); + result_msg = Glib::ustring::compose(_("Test result: %1."), AtaStorageSelftestEntry::get_status_displayable_name(status)); // It may not reach 100% somehow, so do it manually. if (test_completion_progressbar) @@ -1917,7 +1917,7 @@ gboolean GscInfoWindow::test_idle_callback(void* data) } } - if (severity != StorageSelftestEntry::StatusSeverity::none) { + if (severity != AtaStorageSelftestEntry::StatusSeverity::none) { result_msg += "\n"s + _("Check the Self-Test Log for more information."); } @@ -1935,9 +1935,9 @@ gboolean GscInfoWindow::test_idle_callback(void* data) test_stop_button->set_sensitive(false); Gtk::StockID stock_id = Gtk::Stock::DIALOG_ERROR; - if (severity == StorageSelftestEntry::StatusSeverity::none) { + if (severity == AtaStorageSelftestEntry::StatusSeverity::none) { stock_id = Gtk::Stock::DIALOG_INFO; - } else if (severity == StorageSelftestEntry::StatusSeverity::warning) { + } else if (severity == AtaStorageSelftestEntry::StatusSeverity::warning) { stock_id = Gtk::Stock::DIALOG_WARNING; } diff --git a/src/gsc_info_window.h b/src/gsc_info_window.h index cbd4bb8..6283809 100644 --- a/src/gsc_info_window.h +++ b/src/gsc_info_window.h @@ -58,40 +58,40 @@ class GscInfoWindow : public AppBuilderWidget { protected: /// fill_ui_with_info() helper - void fill_ui_general(const std::vector& props); + void fill_ui_general(const std::vector& props); /// fill_ui_with_info() helper - void fill_ui_attributes(const std::vector& props); + void fill_ui_attributes(const std::vector& props); /// fill_ui_with_info() helper - void fill_ui_statistics(const std::vector& props); + void fill_ui_statistics(const std::vector& props); /// fill_ui_with_info() helper void fill_ui_self_test_info(); /// fill_ui_with_info() helper - void fill_ui_self_test_log(const std::vector& props); + void fill_ui_self_test_log(const std::vector& props); /// fill_ui_with_info() helper - void fill_ui_error_log(const std::vector& props); + void fill_ui_error_log(const std::vector& props); /// fill_ui_with_info() helper - void fill_ui_temperature_log(const std::vector& props); + void fill_ui_temperature_log(const std::vector& props); /// fill_ui_with_info() helper - WarningLevel fill_ui_capabilities(const std::vector& props); + WarningLevel fill_ui_capabilities(const std::vector& props); /// fill_ui_with_info() helper - WarningLevel fill_ui_error_recovery(const std::vector& props); + WarningLevel fill_ui_error_recovery(const std::vector& props); /// fill_ui_with_info() helper - WarningLevel fill_ui_selective_self_test_log(const std::vector& props); + WarningLevel fill_ui_selective_self_test_log(const std::vector& props); /// fill_ui_with_info() helper - WarningLevel fill_ui_physical(const std::vector& props); + WarningLevel fill_ui_physical(const std::vector& props); /// fill_ui_with_info() helper - WarningLevel fill_ui_directory(const std::vector& props); + WarningLevel fill_ui_directory(const std::vector& props); // -------------------- callbacks diff --git a/src/gsc_main_window.cpp b/src/gsc_main_window.cpp index 3a2c9a7..f944654 100644 --- a/src/gsc_main_window.cpp +++ b/src/gsc_main_window.cpp @@ -21,12 +21,12 @@ Copyright: #include "hz/fs.h" #include "rconfig/rconfig.h" #include "applib/storage_detector.h" -#include "applib/smartctl_parser.h" +#include "applib/smartctl_text_parser.h" #include "applib/gui_utils.h" // gui_show_error_dialog #include "applib/smartctl_executor.h" // get_smartctl_binary() #include "applib/smartctl_executor_gui.h" -#include "applib/app_gtkmm_utils.h" // app_gtkmm_* -#include "applib/storage_property_colors.h" // app_property_get_label_highlight_color +#include "applib/app_gtkmm_tools.h" // app_gtkmm_* +#include "applib/warning_colors.h" // app_property_get_label_highlight_color #include "applib/app_pcrecpp.h" // app_pcre_match #include "gsc_init.h" // app_quit() @@ -118,7 +118,7 @@ GscMainWindow::GscMainWindow(BaseObjectType* gtkcobj, Glib::RefPtr } std::string version, version_full; - if (!SmartctlParser::parse_version(output, version, version_full)) { + if (!SmartctlTextParser::parse_version(output, version, version_full)) { error_msg = _("Smartctl returned invalid output."); break; } @@ -941,7 +941,7 @@ void GscMainWindow::update_status_widgets() app_gtkmm_set_widget_tooltip(*name_label_, info_str, false); // in case it doesn't fit } - StorageProperty health_prop = drive->get_health_property(); + AtaStorageProperty health_prop = drive->get_health_property(); if (health_label_) { if (health_prop.generic_name == "overall_health") { diff --git a/src/gsc_main_window_iconview.h b/src/gsc_main_window_iconview.h index 2290842..39881df 100644 --- a/src/gsc_main_window_iconview.h +++ b/src/gsc_main_window_iconview.h @@ -22,8 +22,8 @@ Copyright: #include "hz/string_algo.h" // string_join #include "hz/debug.h" #include "hz/data_file.h" // data_file_find -#include "applib/app_gtkmm_utils.h" -#include "applib/storage_property_colors.h" +#include "applib/app_gtkmm_tools.h" +#include "applib/warning_colors.h" #include "gsc_main_window.h" #include "rconfig/rconfig.h" @@ -229,7 +229,7 @@ class GscMainWindowIconView : public Gtk::IconView { this->decorate_entry(row); - drive->signal_changed.connect(sigc::mem_fun(this, &GscMainWindowIconView::on_drive_changed)); + drive->signal_changed().connect(sigc::mem_fun(this, &GscMainWindowIconView::on_drive_changed)); if (scroll_to_it) { Gtk::TreeModel::Path tpath(row); @@ -296,7 +296,7 @@ class GscMainWindowIconView : public Gtk::IconView { if (rconfig::get_data("gui/icons_show_serial_number") && !drive->get_serial_number().empty()) { name += "\n" + Glib::Markup::escape_text(drive->get_serial_number()); } - StorageProperty scan_time_prop; + AtaStorageProperty scan_time_prop; if (drive->get_is_virtual()) { scan_time_prop = drive->lookup_property("scan_time"); if (!scan_time_prop.empty() && !scan_time_prop.get_value().empty()) { @@ -343,7 +343,7 @@ class GscMainWindowIconView : public Gtk::IconView { break; } - StorageProperty health_prop = drive->get_health_property(); + AtaStorageProperty health_prop = drive->get_health_property(); if (health_prop.warning != WarningLevel::none && health_prop.generic_name == "overall_health") { if (icon) { icon = icon->copy(); // work on a copy diff --git a/src/gsc_preferences_window.cpp b/src/gsc_preferences_window.cpp index e1fd820..ce05fe8 100644 --- a/src/gsc_preferences_window.cpp +++ b/src/gsc_preferences_window.cpp @@ -21,7 +21,7 @@ Copyright: #include "hz/string_sprintf.h" #include "rconfig/rconfig.h" #include "applib/storage_settings.h" -#include "applib/app_gtkmm_utils.h" +#include "applib/app_gtkmm_tools.h" #include "gsc_main_window.h" #include "gsc_preferences_window.h" diff --git a/src/gsc_text_window.h b/src/gsc_text_window.h index 75cc98f..47adc99 100644 --- a/src/gsc_text_window.h +++ b/src/gsc_text_window.h @@ -22,9 +22,8 @@ Copyright: #include "hz/fs.h" #include "rconfig/rconfig.h" -#include "applib/app_gtkmm_features.h" #include "applib/app_builder_widget.h" -#include "applib/app_gtkmm_utils.h" +#include "applib/app_gtkmm_tools.h"