mainloop: Cache devpath at startup
Currently the devpath is determined after a bus error to make
a callout. Finding the path at startup is less prone to race
conditions around ENOENT on driver unload in the event of a
callout.
Change-Id: I8ce8d9f630c8b7ecc398082002aa113ab352d3cb
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/mainloop.cpp b/mainloop.cpp
index 486a175..11f03a5 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -208,6 +208,7 @@
MainLoop::MainLoop(
sdbusplus::bus::bus&& bus,
const std::string& path,
+ const std::string& devPath,
const char* prefix,
const char* root)
: _bus(std::move(bus)),
@@ -215,6 +216,7 @@
_shutdown(false),
_hwmonRoot(),
_instance(),
+ _devPath(devPath),
_prefix(prefix),
_root(root),
state()