use new sdbusplus match constructors
Change-Id: Id833073b9e45fae24d6bd0e7f9310ef0ba8658de
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp
index e21727b..8bf27f2 100644
--- a/fault-monitor/fru-fault-monitor.cpp
+++ b/fault-monitor/fru-fault-monitor.cpp
@@ -117,22 +117,19 @@
return;
}
-int Add::created(sd_bus_message* msg,
- void* data,
- sd_bus_error* retError)
+void Add::created(sdbusplus::message::message& msg)
{
- auto m = sdbusplus::message::message(msg);
- auto bus = m.get_bus();
+ auto bus = msg.get_bus();
sdbusplus::message::object_path obPath;
- m.read(obPath);
+ msg.read(obPath);
std::string objectPath(std::move(obPath));
std::size_t found = objectPath.find(ELOG_ENTRY);
if (found == std::string::npos)
{
//Not a new error entry skip
- return 0;
+ return;
}
std::string service;
@@ -143,12 +140,12 @@
catch (MethodErr& e)
{
commit<MethodErr>();
- return 0;
+ return;
}
catch (ObjectNotFoundErr& e)
{
commit<ObjectNotFoundErr>();
- return 0;
+ return;
}
auto method = bus.new_method_call(service.c_str(), objectPath.c_str(),
@@ -164,7 +161,7 @@
report<AssociationRetrieveErr>(
AssociationRetrieveError::ELOG_ENTRY_PATH(
objectPath.c_str()));
- return 0;
+ return;
}
sdbusplus::message::variant<AssociationList> assoc;
@@ -175,7 +172,7 @@
if (assocs.empty())
{
//No associations skip
- return 0;
+ return;
}
for (const auto& item : assocs)
@@ -183,46 +180,43 @@
if (std::get<1>(item).compare(CALLOUT_REV_ASSOCIATION) == 0)
{
action(bus, std::get<2>(item), true);
- static_cast<Add*>(data)->removeWatches.emplace_back(
- std::make_unique<Remove>(bus, std::get<2>(item)));
+ removeWatches.emplace_back(
+ std::make_unique<Remove>(bus, std::get<2>(item)));
}
}
- return 0;
+ return;
}
-int Remove::removed(sd_bus_message* msg,
- void* data,
- sd_bus_error* retError)
+void Remove::removed(sdbusplus::message::message& msg)
{
- auto m = sdbusplus::message::message(msg);
- auto bus = m.get_bus();
+ auto bus = msg.get_bus();
std::string assoc;
- m.read(assoc);
+ msg.read(assoc);
if (assoc.compare("org.openbmc.Association"))
{
//Skip if not about association
- return 0;
+ return;
}
std::map<std::string, std::vector<std::string>> endPoints;
- m.read(endPoints);
+ msg.read(endPoints);
auto it = endPoints.find("endpoints");
if (it == endPoints.end())
{
//No end points,skip
- return 0;
+ return;
}
if (!((*it).second.empty()))
{
//Skip, end points are not empty
- return 0;
+ return;
}
- action(bus, static_cast<Remove*>(data)->inventoryPath, false);
- return 0;
+ action(bus, inventoryPath, false);
+ return;
}
}//namespace monitor