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: Ic0fe1ed7e19cf114b8666d49d4d670c7d9ec595d
diff --git a/power-sequencer/pgood_monitor.hpp b/power-sequencer/pgood_monitor.hpp
index 70a6f89..5575cbc 100644
--- a/power-sequencer/pgood_monitor.hpp
+++ b/power-sequencer/pgood_monitor.hpp
@@ -43,7 +43,7 @@
* @param[in] t - time to allow PGOOD to come up
*/
PGOODMonitor(std::unique_ptr<witherspoon::power::Device>&& d,
- sdbusplus::bus::bus& b, const sdeventplus::Event& e,
+ sdbusplus::bus_t& b, const sdeventplus::Event& e,
std::chrono::milliseconds& t) :
DeviceMonitor(std::move(d), e, t),
bus(b)
@@ -97,7 +97,7 @@
/**
* The D-Bus object
*/
- sdbusplus::bus::bus& bus;
+ sdbusplus::bus_t& bus;
/**
* The match object for the properties changed signal
diff --git a/power-sequencer/runtime_monitor.cpp b/power-sequencer/runtime_monitor.cpp
index fa9ecfe..2f78659 100644
--- a/power-sequencer/runtime_monitor.cpp
+++ b/power-sequencer/runtime_monitor.cpp
@@ -40,7 +40,7 @@
#endif
}
-void RuntimeMonitor::onPowerLost(sdbusplus::message::message&)
+void RuntimeMonitor::onPowerLost(sdbusplus::message_t&)
{
log<level::INFO>("PGOOD failure detected. Checking for faults.");
diff --git a/power-sequencer/runtime_monitor.hpp b/power-sequencer/runtime_monitor.hpp
index 93e398f..78f2c1d 100644
--- a/power-sequencer/runtime_monitor.hpp
+++ b/power-sequencer/runtime_monitor.hpp
@@ -49,7 +49,7 @@
* @param[in] i - poll interval
*/
RuntimeMonitor(std::unique_ptr<witherspoon::power::Device>&& d,
- sdbusplus::bus::bus& b, const sdeventplus::Event& e,
+ sdbusplus::bus_t& b, const sdeventplus::Event& e,
std::chrono::milliseconds& i) :
DeviceMonitor(std::move(d), e, i),
bus(b), match(bus, getMatchString(),
@@ -75,7 +75,7 @@
*
* @param[in] msg - D-Bus message for callback
*/
- void onPowerLost(sdbusplus::message::message& msg);
+ void onPowerLost(sdbusplus::message_t& msg);
/**
* Returns the match string for the PowerLost signal
@@ -94,7 +94,7 @@
/**
* The D-Bus object
*/
- sdbusplus::bus::bus& bus;
+ sdbusplus::bus_t& bus;
/**
* Match object for PowerLost signals
diff --git a/power-sequencer/ucd90160.cpp b/power-sequencer/ucd90160.cpp
index c060ebe..773b22c 100644
--- a/power-sequencer/ucd90160.cpp
+++ b/power-sequencer/ucd90160.cpp
@@ -50,7 +50,7 @@
namespace device_error = sdbusplus::xyz::openbmc_project::Common::Device::Error;
namespace power_error = sdbusplus::org::open_power::Witherspoon::Fault::Error;
-UCD90160::UCD90160(size_t instance, sdbusplus::bus::bus& bus) :
+UCD90160::UCD90160(size_t instance, sdbusplus::bus_t& bus) :
Device(DEVICE_NAME, instance),
interface(std::get<ucd90160::pathField>(deviceMap.find(instance)->second),
DRIVER_NAME, instance),
diff --git a/power-sequencer/ucd90160.hpp b/power-sequencer/ucd90160.hpp
index b66bb82..6ad85f2 100644
--- a/power-sequencer/ucd90160.hpp
+++ b/power-sequencer/ucd90160.hpp
@@ -43,7 +43,7 @@
* @param[in] instance - the device instance number
* @param[in] bus - D-Bus bus object
*/
- UCD90160(size_t instance, sdbusplus::bus::bus& bus);
+ UCD90160(size_t instance, sdbusplus::bus_t& bus);
/**
* Analyzes the device for errors when the device is
@@ -301,7 +301,7 @@
/**
* The D-Bus bus object
*/
- sdbusplus::bus::bus& bus;
+ sdbusplus::bus_t& bus;
/**
* Map of device instance to the instance specific data
diff --git a/power-supply/average.hpp b/power-supply/average.hpp
index cf54a7d..6b667f2 100644
--- a/power-supply/average.hpp
+++ b/power-supply/average.hpp
@@ -11,7 +11,7 @@
{
template <typename T>
-using ServerObject = typename sdbusplus::server::object::object<T>;
+using ServerObject = typename sdbusplus::server::object_t<T>;
using AverageInterface =
sdbusplus::org::open_power::Sensor::Aggregation::History::server::Average;
@@ -42,7 +42,7 @@
* @param[in] bus - D-Bus object
* @param[in] objectPath - the D-Bus object path
*/
- Average(sdbusplus::bus::bus& bus, const std::string& objectPath) :
+ Average(sdbusplus::bus_t& bus, const std::string& objectPath) :
ServerObject<AverageInterface>(bus, objectPath.c_str())
{
unit(Average::Unit::Watts);
diff --git a/power-supply/main.cpp b/power-supply/main.cpp
index 7c5fcad..0a6f965 100644
--- a/power-supply/main.cpp
+++ b/power-supply/main.cpp
@@ -127,7 +127,7 @@
psuDevice->enableHistory(basePath, numRecords, syncGPIOPath, gpioNum);
// Systemd object manager
- sdbusplus::server::manager::manager objManager{bus, basePath.c_str()};
+ sdbusplus::server::manager_t objManager{bus, basePath.c_str()};
std::string busName =
std::string{INPUT_HISTORY_BUSNAME_ROOT} + '.' + name;
diff --git a/power-supply/maximum.hpp b/power-supply/maximum.hpp
index d48f60f..2d3fa46 100644
--- a/power-supply/maximum.hpp
+++ b/power-supply/maximum.hpp
@@ -11,7 +11,7 @@
{
template <typename T>
-using ServerObject = typename sdbusplus::server::object::object<T>;
+using ServerObject = typename sdbusplus::server::object_t<T>;
using MaximumInterface =
sdbusplus::org::open_power::Sensor::Aggregation::History::server::Maximum;
@@ -42,7 +42,7 @@
* @param[in] bus - D-Bus object
* @param[in] objectPath - the D-Bus object path
*/
- Maximum(sdbusplus::bus::bus& bus, const std::string& objectPath) :
+ Maximum(sdbusplus::bus_t& bus, const std::string& objectPath) :
ServerObject<MaximumInterface>(bus, objectPath.c_str())
{
unit(Maximum::Unit::Watts);
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index d936d28..373da01 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -70,7 +70,7 @@
PowerSupply::PowerSupply(const std::string& name, size_t inst,
const std::string& objpath, const std::string& invpath,
- sdbusplus::bus::bus& bus, const sdeventplus::Event& e,
+ sdbusplus::bus_t& bus, const sdeventplus::Event& e,
std::chrono::seconds& t, std::chrono::seconds& p) :
Device(name, inst),
monitorPath(objpath), pmbusIntf(objpath),
@@ -188,7 +188,7 @@
return;
}
-void PowerSupply::inventoryChanged(sdbusplus::message::message& msg)
+void PowerSupply::inventoryChanged(sdbusplus::message_t& msg)
{
std::string msgSensor;
std::map<std::string, std::variant<uint32_t, bool>> msgData;
@@ -224,7 +224,7 @@
bus, this->present);
}
-void PowerSupply::powerStateChanged(sdbusplus::message::message& msg)
+void PowerSupply::powerStateChanged(sdbusplus::message_t& msg)
{
int32_t state = 0;
std::string msgSensor;
diff --git a/power-supply/power_supply.hpp b/power-supply/power_supply.hpp
index d997423..0ba0812 100644
--- a/power-supply/power_supply.hpp
+++ b/power-supply/power_supply.hpp
@@ -52,7 +52,7 @@
*/
PowerSupply(const std::string& name, size_t inst,
const std::string& objpath, const std::string& invpath,
- sdbusplus::bus::bus& bus, const sdeventplus::Event& e,
+ sdbusplus::bus_t& bus, const sdeventplus::Event& e,
std::chrono::seconds& t, std::chrono::seconds& p);
/**
@@ -115,7 +115,7 @@
std::string inventoryPath;
/** @brief Connection for sdbusplus bus */
- sdbusplus::bus::bus& bus;
+ sdbusplus::bus_t& bus;
/** @brief True if the power supply is present. */
bool present = false;
@@ -270,7 +270,7 @@
* @param[in] msg - Data associated with Present change signal
*
*/
- void inventoryChanged(sdbusplus::message::message& msg);
+ void inventoryChanged(sdbusplus::message_t& msg);
/**
* Updates the presence status by querying D-Bus
@@ -296,7 +296,7 @@
*
* @param[in] msg - Data associated with the power state signal
*/
- void powerStateChanged(sdbusplus::message::message& msg);
+ void powerStateChanged(sdbusplus::message_t& msg);
/**
* @brief Wrapper for PMBus::read() and adding metadata
diff --git a/utility.cpp b/utility.cpp
index 836bd33..bcfc35e 100644
--- a/utility.cpp
+++ b/utility.cpp
@@ -29,7 +29,7 @@
using namespace phosphor::logging;
std::string getService(const std::string& path, const std::string& interface,
- sdbusplus::bus::bus& bus)
+ sdbusplus::bus_t& bus)
{
auto method = bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH,
MAPPER_INTERFACE, "GetObject");
diff --git a/utility.hpp b/utility.hpp
index e2487f6..1311fcb 100644
--- a/utility.hpp
+++ b/utility.hpp
@@ -30,7 +30,7 @@
* @return The service name
*/
std::string getService(const std::string& path, const std::string& interface,
- sdbusplus::bus::bus& bus);
+ sdbusplus::bus_t& bus);
/**
* @brief Read a D-Bus property
@@ -45,7 +45,7 @@
template <typename T>
void getProperty(const std::string& interface, const std::string& propertyName,
const std::string& path, const std::string& service,
- sdbusplus::bus::bus& bus, T& value)
+ sdbusplus::bus_t& bus, T& value)
{
std::variant<T> property;
@@ -73,7 +73,7 @@
template <typename T>
void setProperty(const std::string& interface, const std::string& propertyName,
const std::string& path, const std::string& service,
- sdbusplus::bus::bus& bus, T& value)
+ sdbusplus::bus_t& bus, T& value)
{
std::variant<T> propertyValue(value);
@@ -92,7 +92,7 @@
* @param[in] bus - D-Bus object
*/
template <typename T>
-void powerOff(sdbusplus::bus::bus& bus)
+void powerOff(sdbusplus::bus_t& bus)
{
phosphor::logging::report<T>();