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/common_utility.cpp b/common_utility.cpp
index aeb7c1b..7b88b05 100644
--- a/common_utility.cpp
+++ b/common_utility.cpp
@@ -17,7 +17,7 @@
using namespace inventory;
using namespace phosphor::logging;
-std::string getService(sdbusplus::bus::bus& bus, const std::string& path,
+std::string getService(sdbusplus::bus_t& bus, const std::string& path,
const std::string& interface)
{
auto mapper = bus.new_method_call(mapperDestination, mapperObjectPath,
@@ -30,7 +30,7 @@
auto reply = bus.call(mapper);
reply.read(response);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>("D-Bus call exception",
entry("OBJPATH=%s", mapperObjectPath),
diff --git a/common_utility.hpp b/common_utility.hpp
index 15e2f2c..45c2230 100644
--- a/common_utility.hpp
+++ b/common_utility.hpp
@@ -16,7 +16,7 @@
* @param[in] interface - interface under the object path
* @return service name
*/
-std::string getService(sdbusplus::bus::bus& bus, const std::string& path,
+std::string getService(sdbusplus::bus_t& bus, const std::string& path,
const std::string& interface);
/** @brief Call inventory-manager to add objects
diff --git a/ibm_vpd_utils.cpp b/ibm_vpd_utils.cpp
index 11d0faf..b1d909d 100644
--- a/ibm_vpd_utils.cpp
+++ b/ibm_vpd_utils.cpp
@@ -70,7 +70,7 @@
response.read(result);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>("Error in mapper GetSubTree",
entry("ERROR=%s", e.what()));
@@ -180,7 +180,7 @@
method.append(errIntf, pelSeverity, additionalData);
auto resp = bus.call(method);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
throw std::runtime_error(
"Error in invoking D-Bus logging create interface to register PEL");
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())
{
diff --git a/vpd_tool_impl.cpp b/vpd_tool_impl.cpp
index 2d777e9..c52511f 100644
--- a/vpd_tool_impl.cpp
+++ b/vpd_tool_impl.cpp
@@ -131,7 +131,7 @@
kwVal.emplace(kw, printableVal);
}
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
if (string(e.name()) ==
string("org.freedesktop.DBus.Error.UnknownObject"))
@@ -166,7 +166,7 @@
output.emplace(kw, *str);
}
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
if (std::string(e.name()) ==
std::string("org.freedesktop.DBus.Error.UnknownObject"))