NVMeController: record the config data
Add the sensor config data to NVMe controller, so the config data can be
accessed for the future usage such as configuring the NVMe metric.
Tested: N/A
Signed-off-by: Hao Jiang <jianghao@google.com>
Change-Id: I9142a30c7cdea2e4afc9d9023120cc5672a91e15
diff --git a/src/NVMeController.cpp b/src/NVMeController.cpp
index c0fa961..bae660b 100644
--- a/src/NVMeController.cpp
+++ b/src/NVMeController.cpp
@@ -610,11 +610,11 @@
NVMeController::NVMeController(
boost::asio::io_context& io, sdbusplus::asio::object_server& objServer,
std::shared_ptr<sdbusplus::asio::connection> conn, std::string path,
- std::shared_ptr<NVMeMiIntf> nvmeIntf, nvme_mi_ctrl_t ctrl,
- std::weak_ptr<NVMeSubsystem> subsys) :
+ const SensorData& configData, std::shared_ptr<NVMeMiIntf> nvmeIntf,
+ nvme_mi_ctrl_t ctrl, std::weak_ptr<NVMeSubsystem> subsys) :
isPrimary(true), io(io), objServer(objServer), conn(std::move(conn)),
- path(std::move(path)), nvmeIntf(std::move(nvmeIntf)), nvmeCtrl(ctrl),
- subsys(std::move(subsys))
+ path(std::move(path)), config(configData), nvmeIntf(std::move(nvmeIntf)),
+ nvmeCtrl(ctrl), subsys(std::move(subsys))
{}
NVMeController::~NVMeController()
diff --git a/src/NVMeController.hpp b/src/NVMeController.hpp
index 018304e..1fca19b 100644
--- a/src/NVMeController.hpp
+++ b/src/NVMeController.hpp
@@ -39,8 +39,9 @@
NVMeController(boost::asio::io_context& io,
sdbusplus::asio::object_server& objServer,
std::shared_ptr<sdbusplus::asio::connection> conn,
- std::string path, std::shared_ptr<NVMeMiIntf> nvmeIntf,
- nvme_mi_ctrl_t ctrl, std::weak_ptr<NVMeSubsystem> subsys);
+ std::string path, const SensorData& configData,
+ std::shared_ptr<NVMeMiIntf> nvmeIntf, nvme_mi_ctrl_t ctrl,
+ std::weak_ptr<NVMeSubsystem> subsys);
virtual ~NVMeController();
@@ -101,6 +102,7 @@
sdbusplus::asio::object_server& objServer;
std::shared_ptr<sdbusplus::asio::connection> conn;
std::string path;
+ SensorData config;
std::shared_ptr<sdbusplus::asio::dbus_interface> ctrlInterface;
std::shared_ptr<sdbusplus::asio::dbus_interface> securityInterface;
diff --git a/src/NVMeSubsys.cpp b/src/NVMeSubsys.cpp
index accdd1a..e2ae09c 100644
--- a/src/NVMeSubsys.cpp
+++ b/src/NVMeSubsys.cpp
@@ -445,7 +445,7 @@
{
auto nvmeController = std::make_shared<NVMeController>(
self->io, self->objServer, self->conn, path.string(),
- nvme, c, self->weak_from_this());
+ self->config, nvme, c, self->weak_from_this());
self->controllers.insert({*index, {nvmeController, {}}});
}