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: Ibc25db433a6926f7ee43ea83312c3ac14f480c33
diff --git a/elog_block.hpp b/elog_block.hpp
index 1ae4215..2e2db44 100644
--- a/elog_block.hpp
+++ b/elog_block.hpp
@@ -13,7 +13,7 @@
namespace logging
{
-using BlockIface = sdbusplus::server::object::object<
+using BlockIface = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::Logging::server::ErrorBlocksTransition,
sdbusplus::xyz::openbmc_project::Association::server::Definitions>;
@@ -40,7 +40,7 @@
* @param[in] path - Path to attach at.
* @param[in] entryId - Distinct ID of the error.
*/
- Block(sdbusplus::bus::bus& bus, const std::string& path, uint32_t entryId) :
+ Block(sdbusplus::bus_t& bus, const std::string& path, uint32_t entryId) :
BlockIface(bus, path.c_str()), entryId(entryId)
{
std::string entryPath{std::string(OBJ_ENTRY) + '/' +
diff --git a/elog_entry.hpp b/elog_entry.hpp
index 609f905..87cc7ea 100644
--- a/elog_entry.hpp
+++ b/elog_entry.hpp
@@ -16,7 +16,7 @@
namespace logging
{
-using EntryIfaces = sdbusplus::server::object::object<
+using EntryIfaces = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::Logging::server::Entry,
sdbusplus::xyz::openbmc_project::Object::server::Delete,
sdbusplus::xyz::openbmc_project::Association::server::Definitions,
@@ -62,9 +62,9 @@
* @param[in] filePath - Serialization path
* @param[in] parent - The error's parent.
*/
- Entry(sdbusplus::bus::bus& bus, const std::string& objectPath,
- uint32_t idErr, uint64_t timestampErr, Level severityErr,
- std::string&& msgErr, std::vector<std::string>&& additionalDataErr,
+ Entry(sdbusplus::bus_t& bus, const std::string& objectPath, uint32_t idErr,
+ uint64_t timestampErr, Level severityErr, std::string&& msgErr,
+ std::vector<std::string>&& additionalDataErr,
AssociationList&& objects, const std::string& fwVersion,
const std::string& filePath, internal::Manager& parent) :
EntryIfaces(bus, objectPath.c_str(), EntryIfaces::action::defer_emit),
@@ -98,7 +98,7 @@
* @param[in] id - The error entry id.
* @param[in] parent - The error's parent.
*/
- Entry(sdbusplus::bus::bus& bus, const std::string& path, uint32_t entryId,
+ Entry(sdbusplus::bus_t& bus, const std::string& path, uint32_t entryId,
internal::Manager& parent) :
EntryIfaces(bus, path.c_str(), EntryIfaces::action::defer_emit),
parent(parent)
diff --git a/extensions/openpower-pels/data_interface.cpp b/extensions/openpower-pels/data_interface.cpp
index f49bcca..4fa802f 100644
--- a/extensions/openpower-pels/data_interface.cpp
+++ b/extensions/openpower-pels/data_interface.cpp
@@ -121,7 +121,7 @@
return {base, connector};
}
-DataInterface::DataInterface(sdbusplus::bus::bus& bus) : _bus(bus)
+DataInterface::DataInterface(sdbusplus::bus_t& bus) : _bus(bus)
{
readBMCFWVersion();
readServerFWVersion();
@@ -749,7 +749,7 @@
_bus.call_noreply(method, hwIsolationTimeout);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
std::string errName = e.name();
// SD_BUS_ERROR_TIMEOUT error is expected, due to PEL api dependency
diff --git a/extensions/openpower-pels/data_interface.hpp b/extensions/openpower-pels/data_interface.hpp
index c0e8c45..90f0aa2 100644
--- a/extensions/openpower-pels/data_interface.hpp
+++ b/extensions/openpower-pels/data_interface.hpp
@@ -573,7 +573,7 @@
*
* @param[in] bus - The sdbusplus bus object
*/
- explicit DataInterface(sdbusplus::bus::bus& bus);
+ explicit DataInterface(sdbusplus::bus_t& bus);
/**
* @brief Finds the D-Bus service name that hosts the
@@ -814,7 +814,7 @@
* When the motherboard is found, it then adds a PropertyWatcher
* for the motherboard CCIN.
*/
- void motherboardIfaceAdded(sdbusplus::message::message& msg);
+ void motherboardIfaceAdded(sdbusplus::message_t& msg);
/**
* @brief Adds the Ufcs- prefix to the location code passed in
@@ -839,7 +839,7 @@
/**
* @brief The sdbusplus bus object for making D-Bus calls.
*/
- sdbusplus::bus::bus& _bus;
+ sdbusplus::bus_t& _bus;
/**
* @brief The interfacesAdded match object used to wait for inventory
diff --git a/extensions/openpower-pels/dbus_watcher.hpp b/extensions/openpower-pels/dbus_watcher.hpp
index 54cf6d4..dcf2744 100644
--- a/extensions/openpower-pels/dbus_watcher.hpp
+++ b/extensions/openpower-pels/dbus_watcher.hpp
@@ -97,7 +97,7 @@
* @param[in] dataIface - The DataInterface object
* @param[in] func - The callback used any time the property is read
*/
- PropertyWatcher(sdbusplus::bus::bus& bus, const std::string& path,
+ PropertyWatcher(sdbusplus::bus_t& bus, const std::string& path,
const std::string& interface,
const std::string& propertyName, const std::string& service,
const DataIface& dataIface, PropertySetFunc func) :
@@ -119,7 +119,7 @@
{
read(dataIface, service);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
// Path doesn't exist now
}
@@ -142,7 +142,7 @@
* @param[in] dataIface - The DataInterface object
* @param[in] func - The callback used any time the property is read
*/
- PropertyWatcher(sdbusplus::bus::bus& bus, const std::string& path,
+ PropertyWatcher(sdbusplus::bus_t& bus, const std::string& path,
const std::string& interface,
const std::string& propertyName, const DataIface& dataIface,
PropertySetFunc func) :
@@ -183,7 +183,7 @@
*
* @param[in] msg - The sdbusplus message object
*/
- void propChanged(sdbusplus::message::message& msg)
+ void propChanged(sdbusplus::message_t& msg)
{
DBusInterface interface;
DBusPropertyMap properties;
@@ -204,7 +204,7 @@
*
* @param[in] msg - The sdbusplus message object
*/
- void interfaceAdded(sdbusplus::message::message& msg)
+ void interfaceAdded(sdbusplus::message_t& msg)
{
sdbusplus::message::object_path path;
DBusInterfaceMap interfaces;
@@ -278,7 +278,7 @@
* @param[in] dataIface - The DataInterface object
* @param[in] func - The callback used any time the property is read
*/
- InterfaceWatcher(sdbusplus::bus::bus& bus, const std::string& path,
+ InterfaceWatcher(sdbusplus::bus_t& bus, const std::string& path,
const std::string& interface, const DataIface& dataIface,
InterfaceSetFunc func) :
DBusWatcher(path, interface),
@@ -299,7 +299,7 @@
{
read(dataIface);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
// Path doesn't exist now
}
@@ -331,7 +331,7 @@
*
* @param[in] msg - The sdbusplus message object
*/
- void propChanged(sdbusplus::message::message& msg)
+ void propChanged(sdbusplus::message_t& msg)
{
DBusInterface interface;
DBusPropertyMap properties;
@@ -348,7 +348,7 @@
*
* @param[in] msg - The sdbusplus message object
*/
- void interfaceAdded(sdbusplus::message::message& msg)
+ void interfaceAdded(sdbusplus::message_t& msg)
{
sdbusplus::message::object_path path;
DBusInterfaceMap interfaces;
diff --git a/extensions/openpower-pels/manager.hpp b/extensions/openpower-pels/manager.hpp
index e6ae00f..44a9ec2 100644
--- a/extensions/openpower-pels/manager.hpp
+++ b/extensions/openpower-pels/manager.hpp
@@ -23,7 +23,7 @@
namespace pels
{
-using PELInterface = sdbusplus::server::object::object<
+using PELInterface = sdbusplus::server::object_t<
sdbusplus::org::open_power::Logging::server::PEL>;
/**
diff --git a/extensions/openpower-pels/pel_entry.hpp b/extensions/openpower-pels/pel_entry.hpp
index 4d1bd6c..be8360e 100644
--- a/extensions/openpower-pels/pel_entry.hpp
+++ b/extensions/openpower-pels/pel_entry.hpp
@@ -30,7 +30,7 @@
* attributes.
*/
- PELEntry(sdbusplus::bus::bus& bus, const std::string& path,
+ PELEntry(sdbusplus::bus_t& bus, const std::string& path,
const std::map<std::string, PropertiesVariant>& prop, uint32_t id,
Repository* repo) :
PELEntryIface(bus, path.c_str(), prop, true),
diff --git a/extensions/openpower-pels/src.cpp b/extensions/openpower-pels/src.cpp
index f0f530e..1a5acf7 100644
--- a/extensions/openpower-pels/src.cpp
+++ b/extensions/openpower-pels/src.cpp
@@ -887,7 +887,7 @@
callout =
std::make_unique<src::Callout>(p, locCode, fn, ccin, sn, mrus);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
std::string msg =
"No VPD found for " + inventoryPath + ": " + e.what();
@@ -898,7 +898,7 @@
CalloutPriority::high, locCode, fn, ccin, sn, mrus);
}
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
std::string msg = "Could not get location code for " + inventoryPath +
": " + e.what();
diff --git a/lib/include/phosphor-logging/elog.hpp b/lib/include/phosphor-logging/elog.hpp
index 83f35e7..cf2e507 100644
--- a/lib/include/phosphor-logging/elog.hpp
+++ b/lib/include/phosphor-logging/elog.hpp
@@ -129,8 +129,8 @@
uint32_t commit()
{
// Validate if the exception is derived from sdbusplus::exception.
- static_assert(std::is_base_of<sdbusplus::exception::exception, T>::value,
- "T must be a descendant of sdbusplus::exception::exception");
+ static_assert(std::is_base_of<sdbusplus::exception_t, T>::value,
+ "T must be a descendant of sdbusplus::exception_t");
return details::commit(T::errName);
}
@@ -145,8 +145,8 @@
uint32_t commit(Entry::Level level)
{
// Validate if the exception is derived from sdbusplus::exception.
- static_assert(std::is_base_of<sdbusplus::exception::exception, T>::value,
- "T must be a descendant of sdbusplus::exception::exception");
+ static_assert(std::is_base_of<sdbusplus::exception_t, T>::value,
+ "T must be a descendant of sdbusplus::exception_t");
return details::commit(T::errName, level);
}
@@ -160,8 +160,8 @@
[[noreturn]] void elog(Args... i_args)
{
// Validate if the exception is derived from sdbusplus::exception.
- static_assert(std::is_base_of<sdbusplus::exception::exception, T>::value,
- "T must be a descendant of sdbusplus::exception::exception");
+ static_assert(std::is_base_of<sdbusplus::exception_t, T>::value,
+ "T must be a descendant of sdbusplus::exception_t");
// Validate the caller passed in the required parameters
static_assert(
@@ -188,8 +188,8 @@
uint32_t report(Args... i_args)
{
// validate if the exception is derived from sdbusplus::exception.
- static_assert(std::is_base_of<sdbusplus::exception::exception, T>::value,
- "T must be a descendant of sdbusplus::exception::exception");
+ static_assert(std::is_base_of<sdbusplus::exception_t, T>::value,
+ "T must be a descendant of sdbusplus::exception_t");
// Validate the caller passed in the required parameters
static_assert(
@@ -217,8 +217,8 @@
uint32_t report(Entry::Level level, Args... i_args)
{
// validate if the exception is derived from sdbusplus::exception.
- static_assert(std::is_base_of<sdbusplus::exception::exception, T>::value,
- "T must be a descendant of sdbusplus::exception::exception");
+ static_assert(std::is_base_of<sdbusplus::exception_t, T>::value,
+ "T must be a descendant of sdbusplus::exception_t");
// Validate the caller passed in the required parameters
static_assert(
diff --git a/log_manager.cpp b/log_manager.cpp
index 75bab7d..af4524c 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -278,7 +278,7 @@
auto reply = this->busLog.call(method);
reply.read(property);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
lg2::error("Error reading QuiesceOnHwError property: {ERROR}", "ERROR",
e);
@@ -312,7 +312,7 @@
}
}
-void Manager::onEntryResolve(sdbusplus::message::message& msg)
+void Manager::onEntryResolve(sdbusplus::message_t& msg)
{
using Interface = std::string;
using Property = std::string;
@@ -352,7 +352,7 @@
auto reply = this->busLog.call(method);
reply.read(property);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
// Quiescing the host is a "best effort" type function. If unable to
// read the host state or it comes back empty, just return.
@@ -404,7 +404,7 @@
// Register call back if log is resolved
using namespace sdbusplus::bus::match::rules;
auto entryPath = std::string(OBJ_ENTRY) + '/' + std::to_string(entryId);
- auto callback = std::make_unique<sdbusplus::bus::match::match>(
+ auto callback = std::make_unique<sdbusplus::bus::match_t>(
this->busLog,
propertiesChanged(entryPath, "xyz.openbmc_project.Logging.Entry"),
std::bind(std::mem_fn(&Manager::onEntryResolve), this,
diff --git a/log_manager.hpp b/log_manager.hpp
index 4863ad5..7ae889e 100644
--- a/log_manager.hpp
+++ b/log_manager.hpp
@@ -26,7 +26,7 @@
namespace details
{
template <typename... T>
-using ServerObject = typename sdbusplus::server::object::object<T...>;
+using ServerObject = typename sdbusplus::server::object_t<T...>;
using ManagerIface =
sdbusplus::xyz::openbmc_project::Logging::Internal::server::Manager;
@@ -65,7 +65,7 @@
* @param[in] bus - Bus to attach to.
* @param[in] path - Path to attach at.
*/
- Manager(sdbusplus::bus::bus& bus, const char* objPath) :
+ Manager(sdbusplus::bus_t& bus, const char* objPath) :
details::ServerObject<details::ManagerIface>(bus, objPath), busLog(bus),
entryId(0), fwVersion(readFWVersion()){};
@@ -154,9 +154,9 @@
/**
* @brief Returns the sdbusplus bus object
*
- * @return sdbusplus::bus::bus&
+ * @return sdbusplus::bus_t&
*/
- sdbusplus::bus::bus& getBus()
+ sdbusplus::bus_t& getBus()
{
return busLog;
}
@@ -300,7 +300,7 @@
*
* @param[in] msg - sdbusplus dbusmessage
*/
- void onEntryResolve(sdbusplus::message::message& msg);
+ void onEntryResolve(sdbusplus::message_t& msg);
/** @brief Remove block objects for any resolved entries */
void findAndRemoveResolvedBlocks();
@@ -313,7 +313,7 @@
void checkAndQuiesceHost();
/** @brief Persistent sdbusplus DBus bus connection. */
- sdbusplus::bus::bus& busLog;
+ sdbusplus::bus_t& busLog;
/** @brief List of error ids for high severity errors */
std::list<uint32_t> realErrors;
@@ -331,7 +331,7 @@
std::vector<std::unique_ptr<Block>> blockingErrors;
/** @brief Map of entry id to call back object on properties changed */
- std::map<uint32_t, std::unique_ptr<sdbusplus::bus::match::match>>
+ std::map<uint32_t, std::unique_ptr<sdbusplus::bus::match_t>>
propChangedEntryCallback;
};
@@ -361,7 +361,7 @@
* @param[in] path - Path to attach at.
* @param[in] manager - Reference to internal manager object.
*/
- Manager(sdbusplus::bus::bus& bus, const std::string& path,
+ Manager(sdbusplus::bus_t& bus, const std::string& path,
internal::Manager& manager) :
details::ServerObject<DeleteAllIface, CreateIface>(
bus, path.c_str(),
diff --git a/log_manager_main.cpp b/log_manager_main.cpp
index 432d172..e17038c 100644
--- a/log_manager_main.cpp
+++ b/log_manager_main.cpp
@@ -20,7 +20,7 @@
bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
// Add sdbusplus ObjectManager for the 'root' path of the logging manager.
- sdbusplus::server::manager::manager objManager(bus, OBJ_LOGGING);
+ sdbusplus::server::manager_t objManager(bus, OBJ_LOGGING);
phosphor::logging::internal::Manager iMgr(bus, OBJ_INTERNAL);
diff --git a/phosphor-rsyslog-config/server-conf.hpp b/phosphor-rsyslog-config/server-conf.hpp
index 5b3c5a1..5a5781a 100644
--- a/phosphor-rsyslog-config/server-conf.hpp
+++ b/phosphor-rsyslog-config/server-conf.hpp
@@ -14,7 +14,7 @@
using namespace phosphor::logging;
using NetworkClient = sdbusplus::xyz::openbmc_project::Network::server::Client;
-using Iface = sdbusplus::server::object::object<NetworkClient>;
+using Iface = sdbusplus::server::object_t<NetworkClient>;
namespace sdbusRule = sdbusplus::bus::match::rules;
/** @class Server
@@ -38,7 +38,7 @@
* @param[in] path - Path to attach at.
* @param[in] filePath - rsyslog remote logging config file
*/
- Server(sdbusplus::bus::bus& bus, const std::string& path,
+ Server(sdbusplus::bus_t& bus, const std::string& path,
const char* filePath) :
Iface(bus, path.c_str(), Iface::action::defer_emit),
configFilePath(filePath),
@@ -106,7 +106,7 @@
/** @brief React to hostname change
* @param[in] msg - sdbusplus message
*/
- void hostnameChanged(sdbusplus::message::message& /*msg*/)
+ void hostnameChanged(sdbusplus::message_t& /*msg*/)
{
restart();
}
diff --git a/test/elog_errorwrap_test.hpp b/test/elog_errorwrap_test.hpp
index d5a4b33..553e2e8 100644
--- a/test/elog_errorwrap_test.hpp
+++ b/test/elog_errorwrap_test.hpp
@@ -68,7 +68,7 @@
class MockJournal : public Manager
{
public:
- MockJournal(sdbusplus::bus::bus& bus, const char* objPath) :
+ MockJournal(sdbusplus::bus_t& bus, const char* objPath) :
Manager(bus, objPath){};
MOCK_METHOD0(journalSync, void());
MOCK_METHOD2(sd_journal_open, int(sd_journal**, int));
@@ -80,7 +80,7 @@
class TestLogManager : public testing::Test
{
public:
- sdbusplus::bus::bus bus;
+ sdbusplus::bus_t bus;
MockJournal manager;
TestLogManager() :
bus(sdbusplus::bus::new_default()),
diff --git a/test/elog_quiesce_test.cpp b/test/elog_quiesce_test.cpp
index a80cb91..7416e4f 100644
--- a/test/elog_quiesce_test.cpp
+++ b/test/elog_quiesce_test.cpp
@@ -21,7 +21,7 @@
{
public:
sdbusplus::SdBusMock sdbusMock;
- sdbusplus::bus::bus mockedBus = sdbusplus::get_mocked_new(&sdbusMock);
+ sdbusplus::bus_t mockedBus = sdbusplus::get_mocked_new(&sdbusMock);
phosphor::logging::internal::Manager manager;
TestQuiesceOnError() : manager(mockedBus, OBJ_INTERNAL)
diff --git a/test/extensions_test.cpp b/test/extensions_test.cpp
index a3bd119..c54f376 100644
--- a/test/extensions_test.cpp
+++ b/test/extensions_test.cpp
@@ -60,7 +60,7 @@
TEST(ExtensionsTest, FunctionCallTest)
{
sdbusplus::SdBusMock sdbusMock;
- sdbusplus::bus::bus bus = sdbusplus::get_mocked_new(&sdbusMock);
+ sdbusplus::bus_t bus = sdbusplus::get_mocked_new(&sdbusMock);
internal::Manager manager(bus, "testpath");
EXPECT_EQ(Extensions::getStartupFunctions().size(), 2);
diff --git a/test/openpower-pels/pel_manager_test.cpp b/test/openpower-pels/pel_manager_test.cpp
index 41d6138..fc77a5e 100644
--- a/test/openpower-pels/pel_manager_test.cpp
+++ b/test/openpower-pels/pel_manager_test.cpp
@@ -63,7 +63,7 @@
}
NiceMock<sdbusplus::SdBusMock> sdbusInterface;
- sdbusplus::bus::bus bus;
+ sdbusplus::bus_t bus;
phosphor::logging::internal::Manager logManager;
sd_event* sdEvent;
TestLogger logger;
diff --git a/test/remote_logging_tests.hpp b/test/remote_logging_tests.hpp
index d56a539..9c7e3a2 100644
--- a/test/remote_logging_tests.hpp
+++ b/test/remote_logging_tests.hpp
@@ -24,7 +24,7 @@
class MockServer : public phosphor::rsyslog_config::Server
{
public:
- MockServer(sdbusplus::bus::bus& bus, const std::string& path,
+ MockServer(sdbusplus::bus_t& bus, const std::string& path,
const char* filePath) :
phosphor::rsyslog_config::Server(bus, path, filePath)
{
diff --git a/test/serialization_tests.hpp b/test/serialization_tests.hpp
index 902ddf3..c92237a 100644
--- a/test/serialization_tests.hpp
+++ b/test/serialization_tests.hpp
@@ -21,7 +21,7 @@
char tmplt[] = "/tmp/logging_test.XXXXXX";
sdbusplus::SdBusMock sdbusMock;
-sdbusplus::bus::bus bus = sdbusplus::get_mocked_new(&sdbusMock);
+sdbusplus::bus_t bus = sdbusplus::get_mocked_new(&sdbusMock);
phosphor::logging::internal::Manager manager(bus, OBJ_INTERNAL);
class TestSerialization : public testing::Test