sdbusplus: use shorter type aliases
The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are for:
* bus_t
* exception_t
* manager_t
* match_t
* message_t
* object_t
* slot_t
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9029cc722e7712633c15436bd3868d8c3209f567
diff --git a/control/fan.cpp b/control/fan.cpp
index e067205..d368791 100644
--- a/control/fan.cpp
+++ b/control/fan.cpp
@@ -32,7 +32,7 @@
constexpr auto FAN_SENSOR_PATH = "/xyz/openbmc_project/sensors/fan_tach/";
constexpr auto FAN_TARGET_PROPERTY = "Target";
-Fan::Fan(sdbusplus::bus::bus& bus, const FanDefinition& def) :
+Fan::Fan(sdbusplus::bus_t& bus, const FanDefinition& def) :
_bus(bus), _name(std::get<fanNamePos>(def)),
_interface(std::get<targetInterfacePos>(def))
{
@@ -66,7 +66,7 @@
_bus, sensor.second, sensor.first, _interface,
FAN_TARGET_PROPERTY, std::move(value));
}
- catch (const sdbusplus::exception::exception&)
+ catch (const sdbusplus::exception_t&)
{
throw util::DBusPropertyError{"DBus set property failed",
sensor.second, sensor.first,
diff --git a/control/fan.hpp b/control/fan.hpp
index f686817..de0a85c 100644
--- a/control/fan.hpp
+++ b/control/fan.hpp
@@ -36,7 +36,7 @@
* @param[in] bus - the dbus object
* @param[in] def - the fan definition data
*/
- Fan(sdbusplus::bus::bus& bus, const FanDefinition& def);
+ Fan(sdbusplus::bus_t& bus, const FanDefinition& def);
/**
* Sets the speed value on all contained sensors
@@ -59,7 +59,7 @@
/**
* The dbus object
*/
- sdbusplus::bus::bus& _bus;
+ sdbusplus::bus_t& _bus;
/**
* The inventory name of the fan
diff --git a/control/functor.hpp b/control/functor.hpp
index 9f81fc5..59e15df 100644
--- a/control/functor.hpp
+++ b/control/functor.hpp
@@ -102,7 +102,7 @@
* Extract the property from the PropertiesChanged
* message and run the handler function.
*/
- void operator()(sdbusplus::bus::bus& bus, sdbusplus::message::message& msg,
+ void operator()(sdbusplus::bus_t& bus, sdbusplus::message_t& msg,
Zone& zone) const
{
if (msg)
@@ -137,7 +137,7 @@
auto val = zone.getPropertyByName<T>(_path, _intf, _prop);
_handler(zone, _path, _intf, _prop, std::forward<T>(val));
}
- catch (const sdbusplus::exception::exception&)
+ catch (const sdbusplus::exception_t&)
{
// Property will not be used unless a property changed
// signal message is received for this property.
@@ -168,7 +168,7 @@
auto val = zone.getPropertyByName<T>(path, intf, prop);
handler(zone, path, intf, prop, std::forward<T>(val));
}
- catch (const sdbusplus::exception::exception&)
+ catch (const sdbusplus::exception_t&)
{
// Property value not sent to handler
}
@@ -245,7 +245,7 @@
* Extract the property from the InterfacesAdded
* message and run the handler function.
*/
- void operator()(sdbusplus::bus::bus&, sdbusplus::message::message& msg,
+ void operator()(sdbusplus::bus_t&, sdbusplus::message_t& msg,
Zone& zone) const
{
if (msg)
@@ -332,7 +332,7 @@
* Extract the interfaces from the InterfacesRemoved
* message and run the handler function.
*/
- void operator()(sdbusplus::bus::bus&, sdbusplus::message::message& msg,
+ void operator()(sdbusplus::bus_t&, sdbusplus::message_t& msg,
Zone& zone) const
{
if (msg)
@@ -403,7 +403,7 @@
* Extract the name owner from the NameOwnerChanged
* message and run the handler function.
*/
- void operator()(sdbusplus::bus::bus& bus, sdbusplus::message::message& msg,
+ void operator()(sdbusplus::bus_t& bus, sdbusplus::message_t& msg,
Zone& zone) const
{
if (msg)
diff --git a/control/json/dbus_zone.hpp b/control/json/dbus_zone.hpp
index 8dfce1a..83abb53 100644
--- a/control/json/dbus_zone.hpp
+++ b/control/json/dbus_zone.hpp
@@ -18,7 +18,7 @@
#include "xyz/openbmc_project/Control/ThermalMode/server.hpp"
/* Extend the Control::ThermalMode interface */
-using ThermalModeIntf = sdbusplus::server::object::object<
+using ThermalModeIntf = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::Control::server::ThermalMode>;
namespace phosphor::fan::control::json
diff --git a/control/json/event.hpp b/control/json/event.hpp
index 0873c06..e0bdd06 100644
--- a/control/json/event.hpp
+++ b/control/json/event.hpp
@@ -150,7 +150,7 @@
private:
/* The sdbusplus bus object */
- sdbusplus::bus::bus& _bus;
+ sdbusplus::bus_t& _bus;
/* The event's manager */
Manager* _manager;
diff --git a/control/json/fan.cpp b/control/json/fan.cpp
index cf5a7e3..b9c5a58 100644
--- a/control/json/fan.cpp
+++ b/control/json/fan.cpp
@@ -103,7 +103,7 @@
_bus, sensor.second, sensor.first, _interface,
FAN_TARGET_PROPERTY, std::move(value));
}
- catch (const sdbusplus::exception::exception&)
+ catch (const sdbusplus::exception_t&)
{
throw util::DBusPropertyError{
fmt::format("Failed to set target for fan {}", _name).c_str(),
diff --git a/control/json/fan.hpp b/control/json/fan.hpp
index 116e50f..124a916 100644
--- a/control/json/fan.hpp
+++ b/control/json/fan.hpp
@@ -128,7 +128,7 @@
void unlockTarget(uint64_t target);
/* The sdbusplus bus object */
- sdbusplus::bus::bus& _bus;
+ sdbusplus::bus_t& _bus;
/**
* Interface containing the `Target` property
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index 19d9d9b..0b1c45f 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -764,7 +764,7 @@
}
}
-void Manager::handleSignal(sdbusplus::message::message& msg,
+void Manager::handleSignal(sdbusplus::message_t& msg,
const std::vector<SignalPkg>* pkgs)
{
for (auto& pkg : *pkgs)
diff --git a/control/json/manager.hpp b/control/json/manager.hpp
index 78963a4..5b6aaac 100644
--- a/control/json/manager.hpp
+++ b/control/json/manager.hpp
@@ -93,8 +93,8 @@
* Signal handler function that handles parsing a signal's message for a
* particular signal object and stores the results in the manager
*/
-using SignalHandler = std::function<bool(sdbusplus::message::message&,
- const SignalObject&, Manager&)>;
+using SignalHandler =
+ std::function<bool(sdbusplus::message_t&, const SignalObject&, Manager&)>;
/**
* Package of data required when a signal is received
* Tuple constructed of:
@@ -465,7 +465,7 @@
* @param[in] msg - Signal message containing the signal's data
* @param[in] pkgs - Signal packages associated to the signal being handled
*/
- void handleSignal(sdbusplus::message::message& msg,
+ void handleSignal(sdbusplus::message_t& msg,
const std::vector<SignalPkg>* pkgs);
/**
@@ -593,13 +593,13 @@
void insertFilteredObjects(ManagedObjects& ref);
/* The sdbusplus bus object to use */
- sdbusplus::bus::bus& _bus;
+ sdbusplus::bus_t& _bus;
/* The sdeventplus even loop to use */
sdeventplus::Event _event;
/* The sdbusplus manager object to set the ObjectManager interface */
- sdbusplus::server::manager::manager _mgr;
+ sdbusplus::server::manager_t _mgr;
/* Whether loading the config files is allowed or not */
bool _loadAllowed;
diff --git a/control/manager.cpp b/control/manager.cpp
index 023df39..e00f9b5 100644
--- a/control/manager.cpp
+++ b/control/manager.cpp
@@ -54,7 +54,7 @@
* @param[in] condition - The condition to check if true
* @return result - True if the condition is true
*/
-bool checkCondition(sdbusplus::bus::bus& bus, const Condition& c)
+bool checkCondition(sdbusplus::bus_t& bus, const Condition& c)
{
auto& type = std::get<conditionTypePos>(c);
auto& properties = std::get<conditionPropertyListPos>(c);
@@ -81,7 +81,7 @@
}
// Note: Future code will check 'mode' before starting control algorithm
-Manager::Manager(sdbusplus::bus::bus& bus, const sdeventplus::Event& event,
+Manager::Manager(sdbusplus::bus_t& bus, const sdeventplus::Event& event,
Mode mode) :
_bus(bus),
_objMgr(bus, CONTROL_OBJPATH)
diff --git a/control/manager.hpp b/control/manager.hpp
index bb46a41..992a51a 100644
--- a/control/manager.hpp
+++ b/control/manager.hpp
@@ -40,8 +40,7 @@
* @param[in] event - The event loop
* @param[in] mode - The control mode
*/
- Manager(sdbusplus::bus::bus& bus, const sdeventplus::Event& event,
- Mode mode);
+ Manager(sdbusplus::bus_t& bus, const sdeventplus::Event& event, Mode mode);
/**
* Does the fan control inititialization, which is
@@ -54,12 +53,12 @@
/**
* The dbus object
*/
- sdbusplus::bus::bus& _bus;
+ sdbusplus::bus_t& _bus;
/**
* The sdbusplus object manager
*/
- sdbusplus::server::manager::manager _objMgr;
+ sdbusplus::server::manager_t _objMgr;
/**
* The fan zones in the system
diff --git a/control/types.hpp b/control/types.hpp
index 8bc8690..570cf35 100644
--- a/control/types.hpp
+++ b/control/types.hpp
@@ -43,8 +43,8 @@
constexpr auto propPos = 2;
using Group = std::vector<std::tuple<std::string, std::string, std::string>>;
using ZoneHandler = std::function<void(Zone&)>;
-using SignalHandler = std::function<void(sdbusplus::bus::bus&,
- sdbusplus::message::message&, Zone&)>;
+using SignalHandler =
+ std::function<void(sdbusplus::bus_t&, sdbusplus::message_t&, Zone&)>;
using MethodHandler = std::function<void(Zone&, const Group&)>;
using Action = std::function<void(Zone&, const Group&)>;
using Trigger = std::function<void(Zone&, const std::string&, const Group&,
diff --git a/control/zone.cpp b/control/zone.cpp
index be539bf..6e95477 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -47,7 +47,7 @@
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
-Zone::Zone(Mode mode, sdbusplus::bus::bus& bus, const std::string& path,
+Zone::Zone(Mode mode, sdbusplus::bus_t& bus, const std::string& path,
const sdeventplus::Event& event, const ZoneDefinition& def) :
ThermalObject(bus, path.c_str(), ThermalObject::action::defer_emit),
_bus(bus), _path(path),
@@ -415,8 +415,7 @@
[this, &eventGroup](auto const& action) { action(*this, eventGroup); });
}
-void Zone::handleEvent(sdbusplus::message::message& msg,
- const EventData* eventData)
+void Zone::handleEvent(sdbusplus::message_t& msg, const EventData* eventData)
{
// Handle the callback
std::get<eventHandlerPos> (*eventData)(_bus, msg, *this);
@@ -553,7 +552,7 @@
["Current"];
if (eData != nullptr)
{
- sdbusplus::message::message nullMsg{nullptr};
+ sdbusplus::message_t nullMsg{nullptr};
handleEvent(nullMsg, eData);
}
}
diff --git a/control/zone.hpp b/control/zone.hpp
index a66275a..3decb32 100644
--- a/control/zone.hpp
+++ b/control/zone.hpp
@@ -21,7 +21,7 @@
namespace control
{
-using ThermalObject = sdbusplus::server::object::object<
+using ThermalObject = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::Control::server::ThermalMode>;
/**
@@ -60,7 +60,7 @@
* @param[in] event - Event loop reference
* @param[in] def - the fan zone definition data
*/
- Zone(Mode mode, sdbusplus::bus::bus& bus, const std::string& path,
+ Zone(Mode mode, sdbusplus::bus_t& bus, const std::string& path,
const sdeventplus::Event& event, const ZoneDefinition& def);
/**
@@ -563,8 +563,7 @@
* @param[in] msg - Expanded sdbusplus message data
* @param[in] eventData - The single event's data
*/
- void handleEvent(sdbusplus::message::message& msg,
- const EventData* eventData);
+ void handleEvent(sdbusplus::message_t& msg, const EventData* eventData);
/**
* @brief Add a signal to the list of signal based events
@@ -664,7 +663,7 @@
/**
* The dbus object
*/
- sdbusplus::bus::bus& _bus;
+ sdbusplus::bus_t& _bus;
/**
* Zone object path