NVMeSensorMain: Define deriveRootBusPath()
Continue lifting code from the lambda to simplify its implementation.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I28614a557bf61e1c32075477f8926f8d2c632bc3
diff --git a/src/NVMeSensorMain.cpp b/src/NVMeSensorMain.cpp
index ed932cf..2621674 100644
--- a/src/NVMeSensorMain.cpp
+++ b/src/NVMeSensorMain.cpp
@@ -64,6 +64,12 @@
return std::get<std::string>(findSensorName->second);
}
+static std::filesystem::path deriveRootBusPath(int busNumber)
+{
+ return "/sys/bus/i2c/devices/i2c-" + std::to_string(busNumber) +
+ "/mux_device";
+}
+
static void handleSensorConfigurations(
boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
@@ -125,8 +131,7 @@
int rootBus = *busNumber;
- std::string muxPath = "/sys/bus/i2c/devices/i2c-" +
- std::to_string(*busNumber) + "/mux_device";
+ std::filesystem::path muxPath = deriveRootBusPath(*busNumber);
if (std::filesystem::is_symlink(muxPath))
{