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: I0eb22958103519924e336a2260a4d48015848c3e
diff --git a/vpd-manager/bios_handler.cpp b/vpd-manager/bios_handler.cpp
index 2421277..417852e 100644
--- a/vpd-manager/bios_handler.cpp
+++ b/vpd-manager/bios_handler.cpp
@@ -27,12 +27,12 @@
{
// Setup a match on NameOwnerChanged to determine when PLDM is up. In
// the signal handler, call restoreBIOSAttribs
- static std::shared_ptr<sdbusplus::bus::match::match> nameOwnerMatch =
- std::make_shared<sdbusplus::bus::match::match>(
+ static std::shared_ptr<sdbusplus::bus::match_t> nameOwnerMatch =
+ std::make_shared<sdbusplus::bus::match_t>(
bus,
sdbusplus::bus::match::rules::nameOwnerChanged(
"xyz.openbmc_project.PLDM"),
- [this](sdbusplus::message::message& msg) {
+ [this](sdbusplus::message_t& msg) {
if (msg.is_method_error())
{
std::cerr << "Error in reading name owner signal "
@@ -84,18 +84,16 @@
void BiosHandler::listenBiosAttribs()
{
- static std::shared_ptr<sdbusplus::bus::match::match> biosMatcher =
- std::make_shared<sdbusplus::bus::match::match>(
+ static std::shared_ptr<sdbusplus::bus::match_t> biosMatcher =
+ std::make_shared<sdbusplus::bus::match_t>(
bus,
sdbusplus::bus::match::rules::propertiesChanged(
"/xyz/openbmc_project/bios_config/manager",
"xyz.openbmc_project.BIOSConfig.Manager"),
- [this](sdbusplus::message::message& msg) {
- biosAttribsCallback(msg);
- });
+ [this](sdbusplus::message_t& msg) { biosAttribsCallback(msg); });
}
-void BiosHandler::biosAttribsCallback(sdbusplus::message::message& msg)
+void BiosHandler::biosAttribsCallback(sdbusplus::message_t& msg)
{
if (msg.is_method_error())
{
diff --git a/vpd-manager/bios_handler.hpp b/vpd-manager/bios_handler.hpp
index 964fff5..0bc381a 100644
--- a/vpd-manager/bios_handler.hpp
+++ b/vpd-manager/bios_handler.hpp
@@ -55,7 +55,7 @@
BiosHandler& operator=(BiosHandler&&) = delete;
~BiosHandler() = default;
- BiosHandler(sdbusplus::bus::bus& bus, Manager& manager) :
+ BiosHandler(sdbusplus::bus_t& bus, Manager& manager) :
bus(bus), manager(manager)
{
checkAndListenPLDMService();
@@ -89,7 +89,7 @@
* yes, it will update the VPD with the new attribute value.
* @param[in] msg - The callback message.
*/
- void biosAttribsCallback(sdbusplus::message::message& msg);
+ void biosAttribsCallback(sdbusplus::message_t& msg);
/**
* @brief Persistently saves the Memory mirror mode
@@ -161,7 +161,7 @@
/**
* @brief Reference to the bus.
*/
- sdbusplus::bus::bus& bus;
+ sdbusplus::bus_t& bus;
/**
* @brief Reference to the manager.
diff --git a/vpd-manager/manager.cpp b/vpd-manager/manager.cpp
index 36e9753..9dfcdcf 100644
--- a/vpd-manager/manager.cpp
+++ b/vpd-manager/manager.cpp
@@ -33,7 +33,7 @@
{
namespace manager
{
-Manager::Manager(sdbusplus::bus::bus&& bus, const char* busName,
+Manager::Manager(sdbusplus::bus_t&& bus, const char* busName,
const char* objPath, const char* /*iFace*/) :
ServerObject<ManagerIface>(bus, objPath),
_bus(std::move(bus)), _manager(_bus, objPath)
@@ -162,18 +162,16 @@
void Manager::listenHostState()
{
- static std::shared_ptr<sdbusplus::bus::match::match> hostState =
- std::make_shared<sdbusplus::bus::match::match>(
+ static std::shared_ptr<sdbusplus::bus::match_t> hostState =
+ std::make_shared<sdbusplus::bus::match_t>(
_bus,
sdbusplus::bus::match::rules::propertiesChanged(
"/xyz/openbmc_project/state/host0",
"xyz.openbmc_project.State.Host"),
- [this](sdbusplus::message::message& msg) {
- hostStateCallBack(msg);
- });
+ [this](sdbusplus::message_t& msg) { hostStateCallBack(msg); });
}
-void Manager::hostStateCallBack(sdbusplus::message::message& msg)
+void Manager::hostStateCallBack(sdbusplus::message_t& msg)
{
if (msg.is_method_error())
{
@@ -204,18 +202,16 @@
void Manager::listenAssetTag()
{
- static std::shared_ptr<sdbusplus::bus::match::match> assetMatcher =
- std::make_shared<sdbusplus::bus::match::match>(
+ static std::shared_ptr<sdbusplus::bus::match_t> assetMatcher =
+ std::make_shared<sdbusplus::bus::match_t>(
_bus,
sdbusplus::bus::match::rules::propertiesChanged(
"/xyz/openbmc_project/inventory/system",
"xyz.openbmc_project.Inventory.Decorator.AssetTag"),
- [this](sdbusplus::message::message& msg) {
- assetTagCallback(msg);
- });
+ [this](sdbusplus::message_t& msg) { assetTagCallback(msg); });
}
-void Manager::assetTagCallback(sdbusplus::message::message& msg)
+void Manager::assetTagCallback(sdbusplus::message_t& msg)
{
if (msg.is_method_error())
{
diff --git a/vpd-manager/manager.hpp b/vpd-manager/manager.hpp
index e2a806b..6d8314b 100644
--- a/vpd-manager/manager.hpp
+++ b/vpd-manager/manager.hpp
@@ -57,7 +57,7 @@
* @param[in] objPath - Path to attach at.
* @param[in] iFace - interface to implement
*/
- Manager(sdbusplus::bus::bus&& bus, const char* busName, const char* objPath,
+ Manager(sdbusplus::bus_t&& bus, const char* busName, const char* objPath,
const char* iFace);
/** @brief Implementation for WriteKeyword
@@ -137,7 +137,7 @@
/** @brief Callback to listen for Host state change
* @param[in] msg - callback message.
*/
- void hostStateCallBack(sdbusplus::message::message& msg);
+ void hostStateCallBack(sdbusplus::message_t& msg);
/** @brief Api to register AssetTag property change.
* This api will register callback to listen for asset tag property change.
@@ -147,7 +147,7 @@
/** @brief Callback to listen for Asset tag change
* @param[in] msg - callback message.
*/
- void assetTagCallback(sdbusplus::message::message& msg);
+ void assetTagCallback(sdbusplus::message_t& msg);
/**
* @brief Restores and defaulted VPD on the system VPD EEPROM.
@@ -160,10 +160,10 @@
void restoreSystemVpd();
/** @brief Persistent sdbusplus DBus bus connection. */
- sdbusplus::bus::bus _bus;
+ sdbusplus::bus_t _bus;
/** @brief sdbusplus org.freedesktop.DBus.ObjectManager reference. */
- sdbusplus::server::manager::manager _manager;
+ sdbusplus::server::manager_t _manager;
// file to store parsed json
nlohmann::json jsonFile;
diff --git a/vpd-manager/server.cpp b/vpd-manager/server.cpp
index 8fd8476..14d2151 100644
--- a/vpd-manager/server.cpp
+++ b/vpd-manager/server.cpp
@@ -21,7 +21,7 @@
namespace server
{
-Manager::Manager(bus::bus& bus, const char* path) :
+Manager::Manager(bus_t& bus, const char* path) :
_com_ibm_VPD_Manager_interface(bus, path, interface, _vtable, this),
_intf(bus.getInterface())
{