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/monitor/conditions.cpp b/monitor/conditions.cpp
index 19e9cd8..62e272c 100644
--- a/monitor/conditions.cpp
+++ b/monitor/conditions.cpp
@@ -22,7 +22,7 @@
Condition propertiesMatch(std::vector<PropertyState>&& propStates)
{
- return [pStates = std::move(propStates)](sdbusplus::bus::bus& bus) {
+ return [pStates = std::move(propStates)](sdbusplus::bus_t& bus) {
return std::all_of(
pStates.begin(), pStates.end(), [&bus](const auto& p) {
return util::SDBusPlus::getPropertyVariant<PropertyValue>(
diff --git a/monitor/fan.cpp b/monitor/fan.cpp
index 508d6ac..910d975 100644
--- a/monitor/fan.cpp
+++ b/monitor/fan.cpp
@@ -35,7 +35,7 @@
using namespace phosphor::logging;
using namespace sdbusplus::bus::match;
-Fan::Fan(Mode mode, sdbusplus::bus::bus& bus, const sdeventplus::Event& event,
+Fan::Fan(Mode mode, sdbusplus::bus_t& bus, const sdeventplus::Event& event,
std::unique_ptr<trust::Manager>& trust, const FanDefinition& def,
System& system) :
_bus(bus),
@@ -143,7 +143,7 @@
}
}
-void Fan::presenceIfaceAdded(sdbusplus::message::message& msg)
+void Fan::presenceIfaceAdded(sdbusplus::message_t& msg)
{
sdbusplus::message::object_path path;
std::map<std::string, std::map<std::string, std::variant<bool>>> interfaces;
@@ -467,7 +467,7 @@
return dbusError;
}
-void Fan::presenceChanged(sdbusplus::message::message& msg)
+void Fan::presenceChanged(sdbusplus::message_t& msg)
{
std::string interface;
std::map<std::string, std::variant<bool>> properties;
diff --git a/monitor/fan.hpp b/monitor/fan.hpp
index 8d9f3b2..7dfd6da 100644
--- a/monitor/fan.hpp
+++ b/monitor/fan.hpp
@@ -80,7 +80,7 @@
* @param def - the fan definition structure
* @param system - Reference to the system object
*/
- Fan(Mode mode, sdbusplus::bus::bus& bus, const sdeventplus::Event& event,
+ Fan(Mode mode, sdbusplus::bus_t& bus, const sdeventplus::Event& event,
std::unique_ptr<trust::Manager>& trust, const FanDefinition& def,
System& system);
@@ -229,7 +229,7 @@
*
* @param[in] msg - The message from the propertiesChanged signal
*/
- void presenceChanged(sdbusplus::message::message& msg);
+ void presenceChanged(sdbusplus::message_t& msg);
/**
* @brief Called when there is an interfacesAdded signal on the
@@ -238,12 +238,12 @@
*
* @param[in] msg - The message from the interfacesAdded signal
*/
- void presenceIfaceAdded(sdbusplus::message::message& msg);
+ void presenceIfaceAdded(sdbusplus::message_t& msg);
/**
* @brief the dbus object
*/
- sdbusplus::bus::bus& _bus;
+ sdbusplus::bus_t& _bus;
/**
* @brief The inventory name of the fan
@@ -312,13 +312,13 @@
* for the inventory item interface to track the
* Present property.
*/
- sdbusplus::bus::match::match _presenceMatch;
+ sdbusplus::bus::match_t _presenceMatch;
/**
* @brief The match object for the interfacesAdded signal
* for the interface that has the Present property.
*/
- sdbusplus::bus::match::match _presenceIfaceAddedMatch;
+ sdbusplus::bus::match_t _presenceIfaceAddedMatch;
/**
* @brief The current presence state
diff --git a/monitor/system.cpp b/monitor/system.cpp
index 9da828b..77f3fab 100644
--- a/monitor/system.cpp
+++ b/monitor/system.cpp
@@ -33,6 +33,7 @@
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
+#include <sdbusplus/bus/match.hpp>
#include <sdeventplus/event.hpp>
#include <sdeventplus/source/signal.hpp>
@@ -44,7 +45,7 @@
using namespace phosphor::logging;
-System::System(Mode mode, sdbusplus::bus::bus& bus,
+System::System(Mode mode, sdbusplus::bus_t& bus,
const sdeventplus::Event& event) :
_mode(mode),
_bus(bus), _event(event),
@@ -59,7 +60,7 @@
namespace match = sdbusplus::bus::match;
// must be done before service detection
- _inventoryMatch = std::make_unique<match::match>(
+ _inventoryMatch = std::make_unique<sdbusplus::bus::match_t>(
_bus, match::rules::nameOwnerChanged(util::INVENTORY_SVC),
std::bind(&System::inventoryOnlineCb, this, std::placeholders::_1));
@@ -177,7 +178,7 @@
for (const auto& [serviceName, unused] : sensorMap)
{
// map its service name to the sensor
- _sensorMatch.emplace_back(std::make_unique<match::match>(
+ _sensorMatch.emplace_back(std::make_unique<sdbusplus::bus::match_t>(
_bus, match::rules::nameOwnerChanged(serviceName),
std::bind(&System::tachSignalOffline, this,
std::placeholders::_1, sensorMap)));
@@ -190,7 +191,7 @@
}
}
-void System::inventoryOnlineCb(sdbusplus::message::message& msg)
+void System::inventoryOnlineCb(sdbusplus::message_t& msg)
{
namespace match = sdbusplus::bus::match;
@@ -283,7 +284,7 @@
// Determine on/offline status, set all sensors for that service
// to new state
//
-void System::tachSignalOffline(sdbusplus::message::message& msg,
+void System::tachSignalOffline(sdbusplus::message_t& msg,
SensorMapType const& sensorMap)
{
std::string serviceName, oldOwner, newOwner;
diff --git a/monitor/system.hpp b/monitor/system.hpp
index 8c1bb44..df3e35f 100644
--- a/monitor/system.hpp
+++ b/monitor/system.hpp
@@ -58,8 +58,7 @@
* @param[in] bus - sdbusplus bus object
* @param[in] event - event loop reference
*/
- System(Mode mode, sdbusplus::bus::bus& bus,
- const sdeventplus::Event& event);
+ System(Mode mode, sdbusplus::bus_t& bus, const sdeventplus::Event& event);
/**
* @brief Callback function to handle receiving a HUP signal to reload the
@@ -130,7 +129,7 @@
*
* @param[in] msg - Service details.
*/
- void inventoryOnlineCb(sdbusplus::message::message& msg);
+ void inventoryOnlineCb(sdbusplus::message_t& msg);
/**
* @brief Create a BMC Dump
@@ -141,7 +140,7 @@
Mode _mode;
/* The sdbusplus bus object */
- sdbusplus::bus::bus& _bus;
+ sdbusplus::bus_t& _bus;
/* The event loop reference */
const sdeventplus::Event& _event;
@@ -150,7 +149,7 @@
std::unique_ptr<phosphor::fan::trust::Manager> _trust;
/* match object to detect Inventory service */
- std::unique_ptr<sdbusplus::bus::match::match> _inventoryMatch;
+ std::unique_ptr<sdbusplus::bus::match_t> _inventoryMatch;
/* List of fan objects to monitor */
std::vector<std::unique_ptr<Fan>> _fans;
@@ -192,7 +191,7 @@
/**
* @brief The tach sensors D-Bus match objects
*/
- std::vector<std::unique_ptr<sdbusplus::bus::match::match>> _sensorMatch;
+ std::vector<std::unique_ptr<sdbusplus::bus::match_t>> _sensorMatch;
/**
* @brief true if config files have been loaded
@@ -260,7 +259,7 @@
*
* @param[in] sensorMap - map providing sensor access for each service
*/
- void tachSignalOffline(sdbusplus::message::message& msg,
+ void tachSignalOffline(sdbusplus::message_t& msg,
const SensorMapType& sensorMap);
/**
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index ec89d5b..825faac 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -57,7 +57,7 @@
template <typename T>
static void
readProperty(const std::string& interface, const std::string& propertyName,
- const std::string& path, sdbusplus::bus::bus& bus, T& value)
+ const std::string& path, sdbusplus::bus_t& bus, T& value)
{
try
{
@@ -70,7 +70,7 @@
}
}
-TachSensor::TachSensor([[maybe_unused]] Mode mode, sdbusplus::bus::bus& bus,
+TachSensor::TachSensor([[maybe_unused]] Mode mode, sdbusplus::bus_t& bus,
Fan& fan, const std::string& id, bool hasTarget,
size_t funcDelay, const std::string& interface,
double factor, int64_t offset, size_t method,
@@ -261,7 +261,7 @@
}
}
-void TachSensor::handleTargetChange(sdbusplus::message::message& msg)
+void TachSensor::handleTargetChange(sdbusplus::message_t& msg)
{
readPropertyFromMessage(msg, _interface, FAN_TARGET_PROPERTY, _tachTarget);
@@ -277,7 +277,7 @@
}
}
-void TachSensor::handleTachChange(sdbusplus::message::message& msg)
+void TachSensor::handleTachChange(sdbusplus::message_t& msg)
{
readPropertyFromMessage(msg, util::FAN_SENSOR_VALUE_INTF,
FAN_VALUE_PROPERTY, _tachInput);
diff --git a/monitor/tach_sensor.hpp b/monitor/tach_sensor.hpp
index f3619be..30e9129 100644
--- a/monitor/tach_sensor.hpp
+++ b/monitor/tach_sensor.hpp
@@ -105,7 +105,7 @@
*
* @param[in] event - Event loop reference
*/
- TachSensor(Mode mode, sdbusplus::bus::bus& bus, Fan& fan,
+ TachSensor(Mode mode, sdbusplus::bus_t& bus, Fan& fan,
const std::string& id, bool hasTarget, size_t funcDelay,
const std::string& interface, double factor, int64_t offset,
size_t method, size_t threshold, bool ignoreAboveMax,
@@ -124,7 +124,7 @@
* @param[out] value - the value to store the property value in
*/
template <typename T>
- static void readPropertyFromMessage(sdbusplus::message::message& msg,
+ static void readPropertyFromMessage(sdbusplus::message_t& msg,
const std::string& interface,
const std::string& propertyName,
T& value)
@@ -394,7 +394,7 @@
*
* @param[in] msg - the dbus message
*/
- void handleTargetChange(sdbusplus::message::message& msg);
+ void handleTargetChange(sdbusplus::message_t& msg);
/**
* @brief Reads the Value property and stores in _tachInput.
@@ -402,7 +402,7 @@
*
* @param[in] msg - the dbus message
*/
- void handleTachChange(sdbusplus::message::message& msg);
+ void handleTachChange(sdbusplus::message_t& msg);
/**
* @brief Updates the Functional property in the inventory
@@ -416,7 +416,7 @@
/**
* @brief the dbus object
*/
- sdbusplus::bus::bus& _bus;
+ sdbusplus::bus_t& _bus;
/**
* @brief Reference to the parent Fan object
diff --git a/monitor/types.hpp b/monitor/types.hpp
index 1f4b84c..9c0d57f 100644
--- a/monitor/types.hpp
+++ b/monitor/types.hpp
@@ -21,7 +21,7 @@
{
template <typename... T>
-using ServerObject = typename sdbusplus::server::object::object<T...>;
+using ServerObject = typename sdbusplus::server::object_t<T...>;
using ObjectEnableInterface =
sdbusplus::xyz::openbmc_project::Object::server::Enable;
@@ -98,7 +98,7 @@
constexpr auto propValue = 1;
using PropertyState = std::pair<PropertyIdentity, PropertyValue>;
-using Condition = std::function<bool(sdbusplus::bus::bus&)>;
+using Condition = std::function<bool(sdbusplus::bus_t&)>;
using CreateGroupFunction = std::function<std::unique_ptr<trust::Group>()>;