From c493f1d1137a0b4e956ece4249a1915bd78ef4b4 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Mon, 24 Oct 2022 19:42:38 +0900 Subject: [PATCH 1/2] refactor(system_monitor/hdd_monitor): rename structs and functions Signed-off-by: Kenji Miyake --- system/system_monitor/CMakeLists.txt | 2 +- .../include/hdd_reader/hdd_reader.hpp | 10 +- .../hdd_monitor/hdd_monitor.hpp | 76 ++++---- .../launch/system_monitor.launch.py | 2 +- .../reader/hdd_reader/hdd_reader.cpp | 42 ++--- .../src/hdd_monitor/hdd_monitor.cpp | 162 +++++++++--------- .../test/src/hdd_monitor/test_hdd_monitor.cpp | 72 ++++---- 7 files changed, 178 insertions(+), 188 deletions(-) diff --git a/system/system_monitor/CMakeLists.txt b/system/system_monitor/CMakeLists.txt index c5a2daa3e87ba..97eddcb590a5f 100644 --- a/system/system_monitor/CMakeLists.txt +++ b/system/system_monitor/CMakeLists.txt @@ -151,7 +151,7 @@ rclcpp_components_register_node(cpu_monitor_lib ) rclcpp_components_register_node(hdd_monitor_lib - PLUGIN "HDDMonitor" + PLUGIN "HddMonitor" EXECUTABLE hdd_monitor ) diff --git a/system/system_monitor/include/hdd_reader/hdd_reader.hpp b/system/system_monitor/include/hdd_reader/hdd_reader.hpp index 2762dd8995b00..a2cf8757a30f7 100644 --- a/system/system_monitor/include/hdd_reader/hdd_reader.hpp +++ b/system/system_monitor/include/hdd_reader/hdd_reader.hpp @@ -31,15 +31,15 @@ /** * @brief Enumeration of Request ID to hdd_reader */ -enum HDDReaderRequestID { - GetHDDInfo, +enum HddReaderRequestId { + GetHddInfo, UnmountDevice, }; /** * @brief HDD device */ -struct HDDDevice +struct HddDevice { std::string name_; //!< @brief Device name uint8_t temp_attribute_id_; //!< @brief S.M.A.R.T attribute ID of temperature @@ -69,7 +69,7 @@ struct HDDDevice /** * @brief HDD information */ -struct HDDInfo +struct HddInfo { int error_code_; //!< @brief error code, 0 on success, otherwise error std::string model_; //!< @brief Model number @@ -133,6 +133,6 @@ struct UnmountDeviceInfo /** * @brief HDD information list */ -typedef std::map HDDInfoList; +typedef std::map HddInfoList; #endif // HDD_READER__HDD_READER_HPP_ diff --git a/system/system_monitor/include/system_monitor/hdd_monitor/hdd_monitor.hpp b/system/system_monitor/include/system_monitor/hdd_monitor/hdd_monitor.hpp index 6e7d010645fe6..2d7ed4f3b3aa9 100644 --- a/system/system_monitor/include/system_monitor/hdd_monitor/hdd_monitor.hpp +++ b/system/system_monitor/include/system_monitor/hdd_monitor/hdd_monitor.hpp @@ -31,7 +31,7 @@ /** * @brief error and warning temperature levels */ -struct HDDParam +struct HddParam { std::string part_device_; //!< @brief partition device std::string disk_device_; //!< @brief disk device @@ -53,7 +53,7 @@ struct HDDParam total_data_written_attribute_id_; //!< @brief S.M.A.R.T attribute ID of total data written uint8_t recovered_error_attribute_id_; //!< @brief S.M.A.R.T attribute ID of recovered error - HDDParam() + HddParam() : temp_warn_(55.0), temp_error_(70.0), power_on_hours_warn_(3000000), @@ -90,17 +90,17 @@ struct SysfsDevStat /** * @brief statistics of HDD */ -struct HDDStat +struct HddStat { - std::string device_; //!< @brief device - std::string error_str_; //!< @brief error string - float read_data_rate_MBs_; //!< @brief data rate of read (MB/s) - float write_data_rate_MBs_; //!< @brief data rate of write (MB/s) - float read_iops_; //!< @brief IOPS of read - float write_iops_; //!< @brief IOPS of write - SysfsDevStat last_sfdevstat_; //!< @brief last statistics of sysfs device - - HDDStat() : read_data_rate_MBs_(0.0), write_data_rate_MBs_(0.0), read_iops_(0.0), write_iops_(0.0) + std::string device_; //!< @brief device + std::string error_str_; //!< @brief error string + float read_data_rate_MBs_; //!< @brief data rate of read (MB/s) + float write_data_rate_MBs_; //!< @brief data rate of write (MB/s) + float read_iops_; //!< @brief IOPS of read + float write_iops_; //!< @brief IOPS of write + SysfsDevStat last_sysfs_dev_stat_; //!< @brief last statistics of sysfs device + + HddStat() : read_data_rate_MBs_(0.0), write_data_rate_MBs_(0.0), read_iops_(0.0), write_iops_(0.0) { } }; @@ -108,7 +108,7 @@ struct HDDStat /** * @brief SMART information items to check */ -enum class HDDSMARTInfoItem : uint32_t { +enum class HddSmartInfoItem : uint32_t { TEMPERATURE = 0, POWER_ON_HOURS = 1, TOTAL_DATA_WRITTEN = 2, @@ -119,7 +119,7 @@ enum class HDDSMARTInfoItem : uint32_t { /** * @brief HDD statistics items to check */ -enum class HDDStatItem : uint32_t { +enum class HddStatItem : uint32_t { READ_DATA_RATE = 0, WRITE_DATA_RATE = 1, READ_IOPS = 2, @@ -127,14 +127,14 @@ enum class HDDStatItem : uint32_t { SIZE }; -class HDDMonitor : public rclcpp::Node +class HddMonitor : public rclcpp::Node { public: /** * @brief constructor * @param [in] options Options associated with this node. */ - explicit HDDMonitor(const rclcpp::NodeOptions & options); + explicit HddMonitor(const rclcpp::NodeOptions & options); protected: using DiagStatus = diagnostic_msgs::msg::DiagnosticStatus; @@ -145,7 +145,7 @@ class HDDMonitor : public rclcpp::Node * @note NOLINT syntax is needed since diagnostic_updater asks for a non-const reference * to pass diagnostic message updated in this function to diagnostic publish calls. */ - void checkSMARTTemperature( + void checkSmartTemperature( diagnostic_updater::DiagnosticStatusWrapper & stat); // NOLINT(runtime/references) /** @@ -154,7 +154,7 @@ class HDDMonitor : public rclcpp::Node * @note NOLINT syntax is needed since diagnostic_updater asks for a non-const reference * to pass diagnostic message updated in this function to diagnostic publish calls. */ - void checkSMARTPowerOnHours( + void checkSmartPowerOnHours( diagnostic_updater::DiagnosticStatusWrapper & stat); // NOLINT(runtime/references) /** @@ -163,7 +163,7 @@ class HDDMonitor : public rclcpp::Node * @note NOLINT syntax is needed since diagnostic_updater asks for a non-const reference * to pass diagnostic message updated in this function to diagnostic publish calls. */ - void checkSMARTTotalDataWritten( + void checkSmartTotalDataWritten( diagnostic_updater::DiagnosticStatusWrapper & stat); // NOLINT(runtime/references) /** @@ -172,7 +172,7 @@ class HDDMonitor : public rclcpp::Node * @note NOLINT syntax is needed since diagnostic_updater asks for a non-const reference * to pass diagnostic message updated in this function to diagnostic publish calls. */ - void checkSMARTRecoveredError( + void checkSmartRecoveredError( diagnostic_updater::DiagnosticStatusWrapper & stat); // NOLINT(runtime/references) /** @@ -182,9 +182,9 @@ class HDDMonitor : public rclcpp::Node * @note NOLINT syntax is needed since diagnostic_updater asks for a non-const reference * to pass diagnostic message updated in this function to diagnostic publish calls. */ - void checkSMART( + void checkSmart( diagnostic_updater::DiagnosticStatusWrapper & stat, - HDDSMARTInfoItem item); // NOLINT(runtime/references) + HddSmartInfoItem item); // NOLINT(runtime/references) /** * @brief check HDD usage @@ -219,7 +219,7 @@ class HDDMonitor : public rclcpp::Node * @note NOLINT syntax is needed since diagnostic_updater asks for a non-const reference * to pass diagnostic message updated in this function to diagnostic publish calls. */ - void checkReadIOPS( + void checkReadIops( diagnostic_updater::DiagnosticStatusWrapper & stat); // NOLINT(runtime/references) /** @@ -228,7 +228,7 @@ class HDDMonitor : public rclcpp::Node * @note NOLINT syntax is needed since diagnostic_updater asks for a non-const reference * to pass diagnostic message updated in this function to diagnostic publish calls. */ - void checkWriteIOPS( + void checkWriteIops( diagnostic_updater::DiagnosticStatusWrapper & stat); // NOLINT(runtime/references) /** @@ -240,7 +240,7 @@ class HDDMonitor : public rclcpp::Node */ void checkStatistics( diagnostic_updater::DiagnosticStatusWrapper & stat, - HDDStatItem item); // NOLINT(runtime/references) + HddStatItem item); // NOLINT(runtime/references) /** * @brief check HDD connection @@ -261,7 +261,7 @@ class HDDMonitor : public rclcpp::Node /** * @brief get HDD parameters */ - void getHDDParams(); + void getHddParams(); /** * @brief get device name from mount point @@ -278,17 +278,17 @@ class HDDMonitor : public rclcpp::Node /** * @brief update HDD information list */ - void updateHDDInfoList(); + void updateHddInfoList(); /** * @brief start HDD transfer measurement */ - void startHDDTransferMeasurement(); + void startHddTransferMeasurement(); /** * @brief update HDD statistics */ - void updateHDDStatistics(); + void updateHddStatistics(); /** * @brief get increment value of sysfs device stats per second @@ -303,15 +303,15 @@ class HDDMonitor : public rclcpp::Node /** * @brief read stats for current whole device using /sys/block/ directory * @param [in] device device name - * @param [out] sfdevstat statistics of sysfs device + * @param [out] sysfs_dev_stat statistics of sysfs device * @return result of success or failure */ - int readSysfsDeviceStat(const std::string & device, SysfsDevStat & sfdevstat); + int readSysfsDeviceStat(const std::string & device, SysfsDevStat & sysfs_dev_stat); /** * @brief update HDD connections */ - void updateHDDConnections(); + void updateHddConnections(); /** * @brief unmount device @@ -321,26 +321,26 @@ class HDDMonitor : public rclcpp::Node int unmountDevice(std::string & device); diagnostic_updater::Updater updater_; //!< @brief Updater class which advertises to /diagnostics - rclcpp::TimerBase::SharedPtr timer_; //!< @brief timer to get HDD information from HDDReader + rclcpp::TimerBase::SharedPtr timer_; //!< @brief timer to get HDD information from HddReader char hostname_[HOST_NAME_MAX + 1]; //!< @brief host name int hdd_reader_port_; //!< @brief port number to connect to hdd_reader - std::map hdd_params_; //!< @brief list of error and warning levels + std::map hdd_params_; //!< @brief list of error and warning levels std::map hdd_connected_flags_; //!< @brief list of flag whether HDD is connected std::map initial_recovered_errors_; //!< @brief list of initial recovered error count - std::map hdd_stats_; //!< @brief list of HDD statistics + std::map hdd_stats_; //!< @brief list of HDD statistics //!< @brief diagnostic of connection diagnostic_updater::DiagnosticStatusWrapper connect_diag_; - HDDInfoList hdd_info_list_; //!< @brief list of HDD information + HddInfoList hdd_info_list_; //!< @brief list of HDD information rclcpp::Time last_hdd_stat_update_time_; //!< @brief last HDD statistics update time /** * @brief HDD SMART status messages */ - const std::map smart_dicts_[static_cast(HDDSMARTInfoItem::SIZE)] = { + const std::map smart_dicts_[static_cast(HddSmartInfoItem::SIZE)] = { // temperature {{DiagStatus::OK, "OK"}, {DiagStatus::WARN, "hot"}, {DiagStatus::ERROR, "critical hot"}}, // power on hours @@ -364,7 +364,7 @@ class HDDMonitor : public rclcpp::Node /** * @brief HDD statistics status messages */ - const std::map stat_dicts_[static_cast(HDDStatItem::SIZE)] = { + const std::map stat_dicts_[static_cast(HddStatItem::SIZE)] = { // data rate of read {{DiagStatus::OK, "OK"}, {DiagStatus::WARN, "high data rate of read"}, diff --git a/system/system_monitor/launch/system_monitor.launch.py b/system/system_monitor/launch/system_monitor.launch.py index c4168e05e508c..8ec168c5992f6 100644 --- a/system/system_monitor/launch/system_monitor.launch.py +++ b/system/system_monitor/launch/system_monitor.launch.py @@ -40,7 +40,7 @@ def launch_setup(context, *args, **kwargs): hdd_monitor_config = yaml.safe_load(f)["/**"]["ros__parameters"] hdd_monitor = ComposableNode( package="system_monitor", - plugin="HDDMonitor", + plugin="HddMonitor", name="hdd_monitor", parameters=[ hdd_monitor_config, diff --git a/system/system_monitor/reader/hdd_reader/hdd_reader.cpp b/system/system_monitor/reader/hdd_reader/hdd_reader.cpp index dc5581b3430f1..0aa4d781611d3 100644 --- a/system/system_monitor/reader/hdd_reader/hdd_reader.cpp +++ b/system/system_monitor/reader/hdd_reader/hdd_reader.cpp @@ -51,23 +51,13 @@ // 7634-7647 Unassigned constexpr int PORT = 7635; -/** - * @brief HDD information - */ -struct HDD_Info -{ - std::string model_; //!< @brief Model number - std::string serial_; //!< @brief Serial number - int temperature_; //!< @brief Temperature -}; - /** * @brief ATA PASS-THROUGH (12) command * @note For details please see the document below. * - ATA Command Pass-Through * https://www.t10.org/ftp/t10/document.04/04-262r8.pdf */ -struct ATAPassThrough12 +struct AtaPassThrough12 { uint8_t operation_code_; //!< @brief OPERATION CODE (A1h) uint8_t reserved0_ : 1; //!< @brief Reserved @@ -123,7 +113,7 @@ struct AttributeEntry * - SMART Attribute Overview * http://www.t13.org/Documents/UploadedDocuments/docs2005/e05171r0-ACS-SMARTAttributes_Overview.pdf */ -struct SMARTData +struct SmartData { // Offset 0..361 X Vendor specific uint16_t smart_structure_version_; //!< @brief SMART structure version @@ -190,10 +180,10 @@ void swap_char(std::string & str, size_t size) * - ATA Command Set - 4 (ACS-4) * http://www.t13.org/Documents/UploadedDocuments/docs2016/di529r14-ATAATAPI_Command_Set_-_4.pdf */ -int get_ata_identify(int fd, HDDInfo * info) +int get_ata_identify(int fd, HddInfo * info) { sg_io_hdr_t hdr{}; - ATAPassThrough12 ata{}; + AtaPassThrough12 ata{}; unsigned char data[512]{}; // 256 words // Create a command descriptor block(CDB) @@ -249,11 +239,11 @@ int get_ata_identify(int fd, HDDInfo * info) * - SMART Attribute Annex * http://www.t13.org/documents/uploadeddocuments/docs2005/e05148r0-acs-smartattributesannex.pdf */ -int get_ata_SMARTData(int fd, HDDInfo * info, const HDDDevice & device) +int get_ata_smart_data(int fd, HddInfo * info, const HddDevice & device) { sg_io_hdr_t hdr{}; - ATAPassThrough12 ata{}; - SMARTData data{}; + AtaPassThrough12 ata{}; + SmartData data{}; // Create a command descriptor block(CDB) ata.operation_code_ = 0xA1; // ATA PASS-THROUGH (12) command @@ -323,7 +313,7 @@ int get_ata_SMARTData(int fd, HDDInfo * info, const HDDDevice & device) * - NVM Express 1.2b * https://www.nvmexpress.org/wp-content/uploads/NVM_Express_1_2b_Gold_20160603.pdf */ -int get_nvme_identify(int fd, HDDInfo * info) +int get_nvme_identify(int fd, HddInfo * info) { nvme_admin_cmd cmd{}; char data[4096]{}; // Fixed size for Identify command @@ -361,7 +351,7 @@ int get_nvme_identify(int fd, HDDInfo * info) * - NVM Express 1.2b * https://www.nvmexpress.org/wp-content/uploads/NVM_Express_1_2b_Gold_20160603.pdf */ -int get_nvme_SMARTData(int fd, HDDInfo * info) +int get_nvme_smart_data(int fd, HddInfo * info) { nvme_admin_cmd cmd{}; unsigned char data[144]{}; // 36 Dword (get byte 0 to 143) @@ -415,8 +405,8 @@ int get_nvme_SMARTData(int fd, HDDInfo * info) */ int get_hdd_info(boost::archive::text_iarchive & ia, boost::archive::text_oarchive & oa) { - std::vector hdd_devices; - HDDInfoList list; + std::vector hdd_devices; + HddInfoList list; try { ia & hdd_devices; @@ -426,7 +416,7 @@ int get_hdd_info(boost::archive::text_iarchive & ia, boost::archive::text_oarchi } for (auto & hdd_device : hdd_devices) { - HDDInfo info{}; + HddInfo info{}; // Open a file int fd = open(hdd_device.name_.c_str(), O_RDONLY); @@ -447,7 +437,7 @@ int get_hdd_info(boost::archive::text_iarchive & ia, boost::archive::text_oarchi continue; } // Get SMART DATA for ATA drive - info.error_code_ = get_ata_SMARTData(fd, &info, hdd_device); + info.error_code_ = get_ata_SmartData(fd, &info, hdd_device); if (info.error_code_ != 0) { syslog(LOG_ERR, "Failed to get SMART LOG for ATA drive. %s\n", strerror(info.error_code_)); close(fd); @@ -462,7 +452,7 @@ int get_hdd_info(boost::archive::text_iarchive & ia, boost::archive::text_oarchi continue; } // Get SMART / Health Information for NVMe drive - info.error_code_ = get_nvme_SMARTData(fd, &info); + info.error_code_ = get_nvme_smart_data(fd, &info); if (info.error_code_ != 0) { syslog( LOG_ERR, "Failed to get SMART / Health Information for NVMe drive. %s\n", @@ -619,10 +609,10 @@ void run(int port) boost::archive::text_oarchive oa(oss); switch (request_id) { - case HDDReaderRequestID::GetHDDInfo: + case HddReaderRequestId::GetHddInfo: ret = get_hdd_info(ia, oa); break; - case HDDReaderRequestID::UnmountDevice: + case HddReaderRequestId::UnmountDevice: ret = unmount_device_with_lazy(ia, oa); break; default: diff --git a/system/system_monitor/src/hdd_monitor/hdd_monitor.cpp b/system/system_monitor/src/hdd_monitor/hdd_monitor.cpp index 85a3ba7742cab..91f48047a2142 100644 --- a/system/system_monitor/src/hdd_monitor/hdd_monitor.cpp +++ b/system/system_monitor/src/hdd_monitor/hdd_monitor.cpp @@ -39,7 +39,7 @@ namespace bp = boost::process; -HDDMonitor::HDDMonitor(const rclcpp::NodeOptions & options) +HddMonitor::HddMonitor(const rclcpp::NodeOptions & options) : Node("hdd_monitor", options), updater_(this), hdd_reader_port_(declare_parameter("hdd_reader_port", 7635)), @@ -49,54 +49,54 @@ HDDMonitor::HDDMonitor(const rclcpp::NodeOptions & options) gethostname(hostname_, sizeof(hostname_)); - getHDDParams(); + getHddParams(); updater_.setHardwareID(hostname_); - updater_.add("HDD Temperature", this, &HDDMonitor::checkSMARTTemperature); - updater_.add("HDD PowerOnHours", this, &HDDMonitor::checkSMARTPowerOnHours); - updater_.add("HDD TotalDataWritten", this, &HDDMonitor::checkSMARTTotalDataWritten); - updater_.add("HDD RecoveredError", this, &HDDMonitor::checkSMARTRecoveredError); - updater_.add("HDD Usage", this, &HDDMonitor::checkUsage); - updater_.add("HDD ReadDataRate", this, &HDDMonitor::checkReadDataRate); - updater_.add("HDD WriteDataRate", this, &HDDMonitor::checkWriteDataRate); - updater_.add("HDD ReadIOPS", this, &HDDMonitor::checkReadIOPS); - updater_.add("HDD WriteIOPS", this, &HDDMonitor::checkWriteIOPS); - updater_.add("HDD Connection", this, &HDDMonitor::checkConnection); + updater_.add("HDD Temperature", this, &HddMonitor::checkSmartTemperature); + updater_.add("HDD PowerOnHours", this, &HddMonitor::checkSmartPowerOnHours); + updater_.add("HDD TotalDataWritten", this, &HddMonitor::checkSmartTotalDataWritten); + updater_.add("HDD RecoveredError", this, &HddMonitor::checkSmartRecoveredError); + updater_.add("HDD Usage", this, &HddMonitor::checkUsage); + updater_.add("HDD ReadDataRate", this, &HddMonitor::checkReadDataRate); + updater_.add("HDD WriteDataRate", this, &HddMonitor::checkWriteDataRate); + updater_.add("HDD ReadIOPS", this, &HddMonitor::checkReadIops); + updater_.add("HDD WriteIOPS", this, &HddMonitor::checkWriteIops); + updater_.add("HDD Connection", this, &HddMonitor::checkConnection); // get HDD connection status - updateHDDConnections(); + updateHddConnections(); // get HDD information from HDD reader for the first time - updateHDDInfoList(); + updateHddInfoList(); // start HDD transfer measurement - startHDDTransferMeasurement(); + startHddTransferMeasurement(); - timer_ = rclcpp::create_timer(this, get_clock(), 1s, std::bind(&HDDMonitor::onTimer, this)); + timer_ = rclcpp::create_timer(this, get_clock(), 1s, std::bind(&HddMonitor::onTimer, this)); } -void HDDMonitor::checkSMARTTemperature(diagnostic_updater::DiagnosticStatusWrapper & stat) +void HddMonitor::checkSmartTemperature(diagnostic_updater::DiagnosticStatusWrapper & stat) { - checkSMART(stat, HDDSMARTInfoItem::TEMPERATURE); + checkSmart(stat, HddSmartInfoItem::TEMPERATURE); } -void HDDMonitor::checkSMARTPowerOnHours(diagnostic_updater::DiagnosticStatusWrapper & stat) +void HddMonitor::checkSmartPowerOnHours(diagnostic_updater::DiagnosticStatusWrapper & stat) { - checkSMART(stat, HDDSMARTInfoItem::POWER_ON_HOURS); + checkSmart(stat, HddSmartInfoItem::POWER_ON_HOURS); } -void HDDMonitor::checkSMARTTotalDataWritten(diagnostic_updater::DiagnosticStatusWrapper & stat) +void HddMonitor::checkSmartTotalDataWritten(diagnostic_updater::DiagnosticStatusWrapper & stat) { - checkSMART(stat, HDDSMARTInfoItem::TOTAL_DATA_WRITTEN); + checkSmart(stat, HddSmartInfoItem::TOTAL_DATA_WRITTEN); } -void HDDMonitor::checkSMARTRecoveredError(diagnostic_updater::DiagnosticStatusWrapper & stat) +void HddMonitor::checkSmartRecoveredError(diagnostic_updater::DiagnosticStatusWrapper & stat) { - checkSMART(stat, HDDSMARTInfoItem::RECOVERED_ERROR); + checkSmart(stat, HddSmartInfoItem::RECOVERED_ERROR); } -void HDDMonitor::checkSMART( - diagnostic_updater::DiagnosticStatusWrapper & stat, HDDSMARTInfoItem item) +void HddMonitor::checkSmart( + diagnostic_updater::DiagnosticStatusWrapper & stat, HddSmartInfoItem item) { // Remember start time to measure elapsed time const auto t_start = SystemMonitorUtility::startMeasurement(); @@ -146,7 +146,7 @@ void HDDMonitor::checkSMART( } switch (item) { - case HDDSMARTInfoItem::TEMPERATURE: { + case HddSmartInfoItem::TEMPERATURE: { float temp = static_cast(hdd_itr->second.temp_); level = DiagStatus::OK; @@ -162,7 +162,7 @@ void HDDMonitor::checkSMART( val_str = "not available"; } } break; - case HDDSMARTInfoItem::POWER_ON_HOURS: { + case HddSmartInfoItem::POWER_ON_HOURS: { int64_t power_on_hours = static_cast(hdd_itr->second.power_on_hours_); level = DiagStatus::OK; @@ -176,7 +176,7 @@ void HDDMonitor::checkSMART( val_str = "not available"; } } break; - case HDDSMARTInfoItem::TOTAL_DATA_WRITTEN: { + case HddSmartInfoItem::TOTAL_DATA_WRITTEN: { uint64_t total_data_written = static_cast(hdd_itr->second.total_data_written_); level = DiagStatus::OK; @@ -190,7 +190,7 @@ void HDDMonitor::checkSMART( val_str = "not available"; } } break; - case HDDSMARTInfoItem::RECOVERED_ERROR: { + case HddSmartInfoItem::RECOVERED_ERROR: { int32_t recovered_error = static_cast(hdd_itr->second.recovered_error_); if (initial_recovered_errors_.find(itr->first) == initial_recovered_errors_.end()) { initial_recovered_errors_[itr->first] = recovered_error; @@ -232,7 +232,7 @@ void HDDMonitor::checkSMART( SystemMonitorUtility::stopMeasurement(t_start, stat); } -void HDDMonitor::checkUsage(diagnostic_updater::DiagnosticStatusWrapper & stat) +void HddMonitor::checkUsage(diagnostic_updater::DiagnosticStatusWrapper & stat) { // Remember start time to measure elapsed time const auto t_start = SystemMonitorUtility::startMeasurement(); @@ -354,28 +354,28 @@ void HDDMonitor::checkUsage(diagnostic_updater::DiagnosticStatusWrapper & stat) SystemMonitorUtility::stopMeasurement(t_start, stat); } -void HDDMonitor::checkReadDataRate(diagnostic_updater::DiagnosticStatusWrapper & stat) +void HddMonitor::checkReadDataRate(diagnostic_updater::DiagnosticStatusWrapper & stat) { - checkStatistics(stat, HDDStatItem::READ_DATA_RATE); + checkStatistics(stat, HddStatItem::READ_DATA_RATE); } -void HDDMonitor::checkWriteDataRate(diagnostic_updater::DiagnosticStatusWrapper & stat) +void HddMonitor::checkWriteDataRate(diagnostic_updater::DiagnosticStatusWrapper & stat) { - checkStatistics(stat, HDDStatItem::WRITE_DATA_RATE); + checkStatistics(stat, HddStatItem::WRITE_DATA_RATE); } -void HDDMonitor::checkReadIOPS(diagnostic_updater::DiagnosticStatusWrapper & stat) +void HddMonitor::checkReadIops(diagnostic_updater::DiagnosticStatusWrapper & stat) { - checkStatistics(stat, HDDStatItem::READ_IOPS); + checkStatistics(stat, HddStatItem::READ_IOPS); } -void HDDMonitor::checkWriteIOPS(diagnostic_updater::DiagnosticStatusWrapper & stat) +void HddMonitor::checkWriteIops(diagnostic_updater::DiagnosticStatusWrapper & stat) { - checkStatistics(stat, HDDStatItem::WRITE_IOPS); + checkStatistics(stat, HddStatItem::WRITE_IOPS); } -void HDDMonitor::checkStatistics( - diagnostic_updater::DiagnosticStatusWrapper & stat, HDDStatItem item) +void HddMonitor::checkStatistics( + diagnostic_updater::DiagnosticStatusWrapper & stat, HddStatItem item) { // Remember start time to measure elapsed time const auto t_start = SystemMonitorUtility::startMeasurement(); @@ -399,7 +399,7 @@ void HDDMonitor::checkStatistics( int level = DiagStatus::OK; switch (item) { - case HDDStatItem::READ_DATA_RATE: { + case HddStatItem::READ_DATA_RATE: { float read_data_rate = hdd_stats_[itr->first].read_data_rate_MBs_; if (read_data_rate >= itr->second.read_data_rate_warn_) { @@ -408,7 +408,7 @@ void HDDMonitor::checkStatistics( key_str = fmt::format("HDD {}: data rate of read", hdd_index); val_str = fmt::format("{:.2f} MB/s", read_data_rate); } break; - case HDDStatItem::WRITE_DATA_RATE: { + case HddStatItem::WRITE_DATA_RATE: { float write_data_rate = hdd_stats_[itr->first].write_data_rate_MBs_; if (write_data_rate >= itr->second.write_data_rate_warn_) { @@ -417,7 +417,7 @@ void HDDMonitor::checkStatistics( key_str = fmt::format("HDD {}: data rate of write", hdd_index); val_str = fmt::format("{:.2f} MB/s", write_data_rate); } break; - case HDDStatItem::READ_IOPS: { + case HddStatItem::READ_IOPS: { float read_iops = hdd_stats_[itr->first].read_iops_; if (read_iops >= itr->second.read_iops_warn_) { @@ -426,7 +426,7 @@ void HDDMonitor::checkStatistics( key_str = fmt::format("HDD {}: IOPS of read", hdd_index); val_str = fmt::format("{:.2f} IOPS", read_iops); } break; - case HDDStatItem::WRITE_IOPS: { + case HddStatItem::WRITE_IOPS: { float write_iops = hdd_stats_[itr->first].write_iops_; if (write_iops >= itr->second.write_iops_warn_) { @@ -464,7 +464,7 @@ void HDDMonitor::checkStatistics( SystemMonitorUtility::stopMeasurement(t_start, stat); } -void HDDMonitor::checkConnection(diagnostic_updater::DiagnosticStatusWrapper & stat) +void HddMonitor::checkConnection(diagnostic_updater::DiagnosticStatusWrapper & stat) { // Remember start time to measure elapsed time const auto t_start = SystemMonitorUtility::startMeasurement(); @@ -497,14 +497,14 @@ void HDDMonitor::checkConnection(diagnostic_updater::DiagnosticStatusWrapper & s SystemMonitorUtility::stopMeasurement(t_start, stat); } -void HDDMonitor::getHDDParams() +void HddMonitor::getHddParams() { const auto num_disks = this->declare_parameter("num_disks", 0); for (auto i = 0; i < num_disks; ++i) { const auto prefix = "disks.disk" + std::to_string(i); const auto mount_point = declare_parameter(prefix + ".name", "/"); - HDDParam param; + HddParam param; param.temp_warn_ = declare_parameter(prefix + ".temp_warn", 55.0f); param.temp_error_ = declare_parameter(prefix + ".temp_error", 70.0f); param.power_on_hours_warn_ = declare_parameter(prefix + ".power_on_hours_warn", 3000000); @@ -532,12 +532,12 @@ void HDDMonitor::getHDDParams() hdd_params_[mount_point] = param; - HDDStat stat; + HddStat stat; hdd_stats_[mount_point] = stat; } } -std::string HDDMonitor::getDeviceFromMountPoint(const std::string & mount_point) +std::string HddMonitor::getDeviceFromMountPoint(const std::string & mount_point) { std::string ret; @@ -577,14 +577,14 @@ std::string HDDMonitor::getDeviceFromMountPoint(const std::string & mount_point) return ret; } -void HDDMonitor::onTimer() +void HddMonitor::onTimer() { - updateHDDConnections(); - updateHDDInfoList(); - updateHDDStatistics(); + updateHddConnections(); + updateHddInfoList(); + updateHddStatistics(); } -void HDDMonitor::updateHDDInfoList() +void HddMonitor::updateHddInfoList() { // Clear diagnostic of connection connect_diag_.clear(); @@ -624,14 +624,14 @@ void HDDMonitor::updateHDDInfoList() return; } - uint8_t request_id = HDDReaderRequestID::GetHDDInfo; - std::vector hdd_devices; + uint8_t request_id = HddReaderRequestId::GetHddInfo; + std::vector hdd_devices; for (auto itr = hdd_params_.begin(); itr != hdd_params_.end(); ++itr) { if (!hdd_connected_flags_[itr->first]) { continue; } - HDDDevice device; + HddDevice device; device.name_ = itr->second.disk_device_; device.temp_attribute_id_ = itr->second.temp_attribute_id_; device.power_on_hours_attribute_id_ = itr->second.power_on_hours_attribute_id_; @@ -693,7 +693,7 @@ void HDDMonitor::updateHDDInfoList() } } -void HDDMonitor::startHDDTransferMeasurement() +void HddMonitor::startHddTransferMeasurement() { for (auto & hdd_stat : hdd_stats_) { hdd_stat.second.error_str_ = ""; @@ -702,18 +702,18 @@ void HDDMonitor::startHDDTransferMeasurement() continue; } - SysfsDevStat sfdevstat; - if (readSysfsDeviceStat(hdd_stat.second.device_, sfdevstat)) { + SysfsDevStat sysfs_dev_stat; + if (readSysfsDeviceStat(hdd_stat.second.device_, sysfs_dev_stat)) { hdd_stat.second.error_str_ = "stat file read error"; continue; } - hdd_stat.second.last_sfdevstat_ = sfdevstat; + hdd_stat.second.last_sysfs_dev_stat_ = sysfs_dev_stat; } last_hdd_stat_update_time_ = this->now(); } -void HDDMonitor::updateHDDStatistics() +void HddMonitor::updateHddStatistics() { double duration_sec = (this->now() - last_hdd_stat_update_time_).seconds(); @@ -724,32 +724,32 @@ void HDDMonitor::updateHDDStatistics() continue; } - SysfsDevStat sfdevstat; - if (readSysfsDeviceStat(hdd_stat.second.device_, sfdevstat)) { + SysfsDevStat sysfs_dev_stat; + if (readSysfsDeviceStat(hdd_stat.second.device_, sysfs_dev_stat)) { hdd_stat.second.error_str_ = "stat file read error"; continue; } - SysfsDevStat & last_sfdevstat = hdd_stat.second.last_sfdevstat_; + SysfsDevStat & last_sysfs_dev_stat = hdd_stat.second.last_sysfs_dev_stat_; hdd_stat.second.read_data_rate_MBs_ = getIncreaseSysfsDeviceStatValuePerSec( - sfdevstat.rd_sectors_, last_sfdevstat.rd_sectors_, duration_sec); + sysfs_dev_stat.rd_sectors_, last_sysfs_dev_stat.rd_sectors_, duration_sec); hdd_stat.second.read_data_rate_MBs_ /= 2048; hdd_stat.second.write_data_rate_MBs_ = getIncreaseSysfsDeviceStatValuePerSec( - sfdevstat.wr_sectors_, last_sfdevstat.wr_sectors_, duration_sec); + sysfs_dev_stat.wr_sectors_, last_sysfs_dev_stat.wr_sectors_, duration_sec); hdd_stat.second.write_data_rate_MBs_ /= 2048; hdd_stat.second.read_iops_ = getIncreaseSysfsDeviceStatValuePerSec( - sfdevstat.rd_ios_, last_sfdevstat.rd_ios_, duration_sec); + sysfs_dev_stat.rd_ios_, last_sysfs_dev_stat.rd_ios_, duration_sec); hdd_stat.second.write_iops_ = getIncreaseSysfsDeviceStatValuePerSec( - sfdevstat.wr_ios_, last_sfdevstat.wr_ios_, duration_sec); + sysfs_dev_stat.wr_ios_, last_sysfs_dev_stat.wr_ios_, duration_sec); - hdd_stat.second.last_sfdevstat_ = sfdevstat; + hdd_stat.second.last_sysfs_dev_stat_ = sysfs_dev_stat; } last_hdd_stat_update_time_ = this->now(); } -double HDDMonitor::getIncreaseSysfsDeviceStatValuePerSec( +double HddMonitor::getIncreaseSysfsDeviceStatValuePerSec( uint64_t cur_val, uint64_t last_val, double duration_sec) { if (cur_val > last_val && duration_sec > 0.0) { @@ -758,7 +758,7 @@ double HDDMonitor::getIncreaseSysfsDeviceStatValuePerSec( return 0.0; } -int HDDMonitor::readSysfsDeviceStat(const std::string & device, SysfsDevStat & sfdevstat) +int HddMonitor::readSysfsDeviceStat(const std::string & device, SysfsDevStat & sysfs_dev_stat) { int ret = -1; unsigned int ios_pgr, tot_ticks, rq_ticks, wr_ticks; @@ -779,10 +779,10 @@ int HDDMonitor::readSysfsDeviceStat(const std::string & device, SysfsDevStat & s &tot_ticks, &rq_ticks, &dc_ios, &dc_merges, &dc_sec, &dc_ticks); if (i >= 7) { - sfdevstat.rd_ios_ = rd_ios; - sfdevstat.rd_sectors_ = rd_sec_or_wr_ios; - sfdevstat.wr_ios_ = wr_ios; - sfdevstat.wr_sectors_ = wr_sec; + sysfs_dev_stat.rd_ios_ = rd_ios; + sysfs_dev_stat.rd_sectors_ = rd_sec_or_wr_ios; + sysfs_dev_stat.wr_ios_ = wr_ios; + sysfs_dev_stat.wr_sectors_ = wr_sec; ret = 0; } @@ -790,7 +790,7 @@ int HDDMonitor::readSysfsDeviceStat(const std::string & device, SysfsDevStat & s return ret; } -void HDDMonitor::updateHDDConnections() +void HddMonitor::updateHddConnections() { for (auto & hdd_param : hdd_params_) { hdd_connected_flags_[hdd_param.first] = false; @@ -829,7 +829,7 @@ void HDDMonitor::updateHDDConnections() } } -int HDDMonitor::unmountDevice(std::string & device) +int HddMonitor::unmountDevice(std::string & device) { // Create a new socket int sock = socket(AF_INET, SOCK_STREAM, 0); @@ -862,7 +862,7 @@ int HDDMonitor::unmountDevice(std::string & device) return -1; } - uint8_t request_id = HDDReaderRequestID::UnmountDevice; + uint8_t request_id = HddReaderRequestId::UnmountDevice; std::vector umount_dev_infos; UnmountDeviceInfo dev_info; @@ -923,4 +923,4 @@ int HDDMonitor::unmountDevice(std::string & device) } #include -RCLCPP_COMPONENTS_REGISTER_NODE(HDDMonitor) +RCLCPP_COMPONENTS_REGISTER_NODE(HddMonitor) diff --git a/system/system_monitor/test/src/hdd_monitor/test_hdd_monitor.cpp b/system/system_monitor/test/src/hdd_monitor/test_hdd_monitor.cpp index 64d78de19418d..375ac6083fe99 100644 --- a/system/system_monitor/test/src/hdd_monitor/test_hdd_monitor.cpp +++ b/system/system_monitor/test/src/hdd_monitor/test_hdd_monitor.cpp @@ -33,13 +33,13 @@ using DiagStatus = diagnostic_msgs::msg::DiagnosticStatus; char ** argv_; -class TestHDDMonitor : public HDDMonitor +class TestHddMonitor : public HddMonitor { - friend class HDDMonitorTestSuite; + friend class HddMonitorTestSuite; public: - TestHDDMonitor(const std::string & node_name, const rclcpp::NodeOptions & options) - : HDDMonitor(node_name, options) + TestHddMonitor(const std::string & node_name, const rclcpp::NodeOptions & options) + : HddMonitor(node_name, options) { } @@ -48,11 +48,11 @@ class TestHDDMonitor : public HDDMonitor array_ = *diag_msg; } - void addHDDParams( + void addHddParams( const std::string & name, float temp_warn, float temp_error, float usage_warn, float usage_error) { - HDDParam param; + HddParam param; param.temp_warn_ = temp_warn; param.temp_error_ = temp_error; param.usage_warn_ = usage_warn; @@ -60,7 +60,7 @@ class TestHDDMonitor : public HDDMonitor hdd_params_[name] = param; } - void changeHDDParams(float temp_warn, float temp_error, float usage_warn, float usage_error) + void changeHddParams(float temp_warn, float temp_error, float usage_warn, float usage_error) { for (auto itr = hdd_params_.begin(); itr != hdd_params_.end(); ++itr) { itr->second.temp_warn_ = temp_warn; @@ -70,7 +70,7 @@ class TestHDDMonitor : public HDDMonitor } } - void removeHDDParams(const std::string & name) + void removeHddParams(const std::string & name) { for (auto itr = hdd_params_.begin(); itr != hdd_params_.end(); ++itr) { if (itr->first == name) { @@ -80,7 +80,7 @@ class TestHDDMonitor : public HDDMonitor } } - void clearHDDParams() { hdd_params_.clear(); } + void clearHddParams() { hdd_params_.clear(); } void update() { updater_.force_update(); } @@ -105,10 +105,10 @@ class TestHDDMonitor : public HDDMonitor const std::string prefix_ = std::string(this->get_name()) + ": "; }; -class HDDMonitorTestSuite : public ::testing::Test +class HddMonitorTestSuite : public ::testing::Test { public: - HDDMonitorTestSuite() + HddMonitorTestSuite() { // Get directory of executable const fs::path exe_path(argv_[0]); @@ -118,7 +118,7 @@ class HDDMonitorTestSuite : public ::testing::Test } protected: - std::unique_ptr monitor_; + std::unique_ptr monitor_; rclcpp::Subscription::SharedPtr sub_; std::string exe_dir_; std::string df_; @@ -128,9 +128,9 @@ class HDDMonitorTestSuite : public ::testing::Test using std::placeholders::_1; rclcpp::init(0, nullptr); rclcpp::NodeOptions node_options; - monitor_ = std::make_unique("test_hdd_monitor", node_options); + monitor_ = std::make_unique("test_hdd_monitor", node_options); sub_ = monitor_->create_subscription( - "/diagnostics", 1000, std::bind(&TestHDDMonitor::diagCallback, monitor_.get(), _1)); + "/diagnostics", 1000, std::bind(&TestHddMonitor::diagCallback, monitor_.get(), _1)); // Remove dummy executable if exists if (fs::exists(df_)) { fs::remove(df_); @@ -245,8 +245,8 @@ void * hdd_reader(void * args) ret = 0; std::ostringstream oss; boost::archive::text_oarchive oa(oss); - HDDInfoList list; - HDDInfo info = {0}; + HddInfoList list; + HddInfo info = {0}; switch (*mode) { case Normal: @@ -313,7 +313,7 @@ void * hdd_reader(void * args) return nullptr; } -TEST_F(HDDMonitorTestSuite, tempNormalTest) +TEST_F(HddMonitorTestSuite, tempNormalTest) { pthread_t th; ThreadTestMode mode = Normal; @@ -337,7 +337,7 @@ TEST_F(HDDMonitorTestSuite, tempNormalTest) ASSERT_EQ(status.level, DiagStatus::OK); } -TEST_F(HDDMonitorTestSuite, tempWarnTest) +TEST_F(HddMonitorTestSuite, tempWarnTest) { pthread_t th; ThreadTestMode mode = Hot; @@ -361,7 +361,7 @@ TEST_F(HDDMonitorTestSuite, tempWarnTest) ASSERT_EQ(status.level, DiagStatus::WARN); } -TEST_F(HDDMonitorTestSuite, tempErrorTest) +TEST_F(HddMonitorTestSuite, tempErrorTest) { pthread_t th; ThreadTestMode mode = CriticalHot; @@ -385,7 +385,7 @@ TEST_F(HDDMonitorTestSuite, tempErrorTest) ASSERT_EQ(status.level, DiagStatus::ERROR); } -TEST_F(HDDMonitorTestSuite, tempReturnsErrorTest) +TEST_F(HddMonitorTestSuite, tempReturnsErrorTest) { pthread_t th; ThreadTestMode mode = ReturnsError; @@ -412,7 +412,7 @@ TEST_F(HDDMonitorTestSuite, tempReturnsErrorTest) ASSERT_STREQ(value.c_str(), strerror(EACCES)); } -TEST_F(HDDMonitorTestSuite, tempRecvTimeoutTest) +TEST_F(HddMonitorTestSuite, tempRecvTimeoutTest) { pthread_t th; ThreadTestMode mode = RecvTimeout; @@ -443,7 +443,7 @@ TEST_F(HDDMonitorTestSuite, tempRecvTimeoutTest) ASSERT_STREQ(value.c_str(), strerror(EWOULDBLOCK)); } -TEST_F(HDDMonitorTestSuite, tempRecvNoDataTest) +TEST_F(HddMonitorTestSuite, tempRecvNoDataTest) { pthread_t th; ThreadTestMode mode = RecvNoData; @@ -470,7 +470,7 @@ TEST_F(HDDMonitorTestSuite, tempRecvNoDataTest) ASSERT_STREQ(value.c_str(), "No data received"); } -TEST_F(HDDMonitorTestSuite, tempFormatErrorTest) +TEST_F(HddMonitorTestSuite, tempFormatErrorTest) { pthread_t th; ThreadTestMode mode = FormatError; @@ -497,7 +497,7 @@ TEST_F(HDDMonitorTestSuite, tempFormatErrorTest) ASSERT_STREQ(value.c_str(), "input stream error"); } -TEST_F(HDDMonitorTestSuite, tempConnectErrorTest) +TEST_F(HddMonitorTestSuite, tempConnectErrorTest) { // Publish topic monitor_->update(); @@ -516,10 +516,10 @@ TEST_F(HDDMonitorTestSuite, tempConnectErrorTest) ASSERT_STREQ(value.c_str(), strerror(ECONNREFUSED)); } -TEST_F(HDDMonitorTestSuite, tempInvalidDiskParameterTest) +TEST_F(HddMonitorTestSuite, tempInvalidDiskParameterTest) { // Clear list - monitor_->clearHDDParams(); + monitor_->clearHddParams(); // Publish topic monitor_->update(); @@ -535,10 +535,10 @@ TEST_F(HDDMonitorTestSuite, tempInvalidDiskParameterTest) ASSERT_STREQ(status.message.c_str(), "invalid disk parameter"); } -TEST_F(HDDMonitorTestSuite, tempNoSuchDeviceTest) +TEST_F(HddMonitorTestSuite, tempNoSuchDeviceTest) { // Add test file to list - monitor_->addHDDParams("/dev/sdx", 55.0, 77.0, 0.95, 0.99); + monitor_->addHddParams("/dev/sdx", 55.0, 77.0, 0.95, 0.99); pthread_t th; ThreadTestMode mode = Normal; @@ -565,10 +565,10 @@ TEST_F(HDDMonitorTestSuite, tempNoSuchDeviceTest) ASSERT_STREQ(value.c_str(), strerror(ENOENT)); // Remove test fie from list - monitor_->removeHDDParams("/dev/sdx"); + monitor_->removeHddParams("/dev/sdx"); } -TEST_F(HDDMonitorTestSuite, usageWarnTest) +TEST_F(HddMonitorTestSuite, usageWarnTest) { // Verify normal behavior { @@ -589,7 +589,7 @@ TEST_F(HDDMonitorTestSuite, usageWarnTest) // Verify warning { // Change warning level - monitor_->changeHDDParams(55.0, 77.0, 0.00, 0.99); + monitor_->changeHddParams(55.0, 77.0, 0.00, 0.99); // Publish topic monitor_->update(); @@ -607,7 +607,7 @@ TEST_F(HDDMonitorTestSuite, usageWarnTest) // Verify normal behavior { // Change back to normal - monitor_->changeHDDParams(55.0, 77.0, 0.95, 0.99); + monitor_->changeHddParams(55.0, 77.0, 0.95, 0.99); // Publish topic monitor_->update(); @@ -623,7 +623,7 @@ TEST_F(HDDMonitorTestSuite, usageWarnTest) } } -TEST_F(HDDMonitorTestSuite, usageErrorTest) +TEST_F(HddMonitorTestSuite, usageErrorTest) { // Verify normal behavior { @@ -644,7 +644,7 @@ TEST_F(HDDMonitorTestSuite, usageErrorTest) // Verify warning { // Change error level - monitor_->changeHDDParams(55.0, 77.0, 0.95, 0.00); + monitor_->changeHddParams(55.0, 77.0, 0.95, 0.00); // Publish topic monitor_->update(); @@ -662,7 +662,7 @@ TEST_F(HDDMonitorTestSuite, usageErrorTest) // Verify normal behavior { // Change back to normal - monitor_->changeHDDParams(55.0, 77.0, 0.95, 0.99); + monitor_->changeHddParams(55.0, 77.0, 0.95, 0.99); // Publish topic monitor_->update(); @@ -678,7 +678,7 @@ TEST_F(HDDMonitorTestSuite, usageErrorTest) } } -TEST_F(HDDMonitorTestSuite, usageDfErrorTest) +TEST_F(HddMonitorTestSuite, usageDfErrorTest) { // Symlink df1 to df fs::create_symlink(exe_dir_ + "/df1", df_); From 99eeb78a91291b53ad150ca34dfbda7addcf5b01 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Tue, 25 Oct 2022 08:54:18 +0900 Subject: [PATCH 2/2] fix a mistake Signed-off-by: Kenji Miyake --- system/system_monitor/reader/hdd_reader/hdd_reader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/system_monitor/reader/hdd_reader/hdd_reader.cpp b/system/system_monitor/reader/hdd_reader/hdd_reader.cpp index 0aa4d781611d3..9d8b54de0773e 100644 --- a/system/system_monitor/reader/hdd_reader/hdd_reader.cpp +++ b/system/system_monitor/reader/hdd_reader/hdd_reader.cpp @@ -437,7 +437,7 @@ int get_hdd_info(boost::archive::text_iarchive & ia, boost::archive::text_oarchi continue; } // Get SMART DATA for ATA drive - info.error_code_ = get_ata_SmartData(fd, &info, hdd_device); + info.error_code_ = get_ata_smart_data(fd, &info, hdd_device); if (info.error_code_ != 0) { syslog(LOG_ERR, "Failed to get SMART LOG for ATA drive. %s\n", strerror(info.error_code_)); close(fd);