Fix static unordered_map may lead to segfault issue
When inserting element to static unordered_map, it
may cause segfault unexpectedly. Move their declaration
to the Nvme class to avoid this issue
Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: I8d2b15e735b4140210118544c4648d0c221f1d6b
diff --git a/nvme_manager.hpp b/nvme_manager.hpp
index 97ef204..78eabe3 100644
--- a/nvme_manager.hpp
+++ b/nvme_manager.hpp
@@ -124,6 +124,10 @@
void createNVMeInventory();
+ /** @brief read NVMe information via Smbus */
+ bool getNVMeInfobyBusID(int busID,
+ phosphor::nvme::Nvme::NVMeData& nvmeData);
+
/** @brief read and update NVME data to dbus */
void readNvmeData(NVMeConfig& config);
@@ -137,6 +141,13 @@
std::vector<phosphor::nvme::Nvme::NVMeConfig> configs;
+ /** @brief error status for Smbus */
+ std::unordered_map<int, bool> isErrorSmbus;
+ /** @brief error status for LED */
+ std::unordered_map<std::string, bool> isError;
+ /** @brief error status for NVMe power*/
+ std::unordered_map<std::string, bool> isErrorPower;
+
/** @brief Set up initial configuration value of NVMe */
void init();
/** @brief Monitor NVMe drives every one second */