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: Ib15ce49ac136da396084ab09972dd132f02beeea
diff --git a/snmp_client.cpp b/snmp_client.cpp
index c084ea4..4dc3d57 100644
--- a/snmp_client.cpp
+++ b/snmp_client.cpp
@@ -10,8 +10,8 @@
namespace snmp
{
-Client::Client(sdbusplus::bus::bus& bus, const char* objPath,
- ConfManager& parent, const std::string& address, uint16_t port) :
+Client::Client(sdbusplus::bus_t& bus, const char* objPath, ConfManager& parent,
+ const std::string& address, uint16_t port) :
Ifaces(bus, objPath, Ifaces::action::defer_emit),
id(std::stol(std::filesystem::path(objPath).filename())), parent(parent)
{
diff --git a/snmp_client.hpp b/snmp_client.hpp
index d6206ff..429c947 100644
--- a/snmp_client.hpp
+++ b/snmp_client.hpp
@@ -17,7 +17,7 @@
class ConfManager;
-using Ifaces = sdbusplus::server::object::object<
+using Ifaces = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::Network::server::Client,
sdbusplus::xyz::openbmc_project::Object::server::Delete>;
@@ -45,7 +45,7 @@
* @param[in] address - IPaddress/Hostname.
* @param[in] port - network port.
*/
- Client(sdbusplus::bus::bus& bus, const char* objPath, ConfManager& parent,
+ Client(sdbusplus::bus_t& bus, const char* objPath, ConfManager& parent,
const std::string& address, uint16_t port);
/** @brief Constructor to put object onto bus at a dbus path.
@@ -53,7 +53,7 @@
* @param[in] objPath - Path to attach at.
* @param[in] parent - Parent D-bus Object.
*/
- Client(sdbusplus::bus::bus& bus, const char* objPath, ConfManager& parent) :
+ Client(sdbusplus::bus_t& bus, const char* objPath, ConfManager& parent) :
Ifaces(bus, objPath, Ifaces::action::defer_emit),
id(std::stol(std::filesystem::path(objPath).filename())), parent(parent)
{}
diff --git a/snmp_conf_manager.cpp b/snmp_conf_manager.cpp
index 4ddace1..a606370 100644
--- a/snmp_conf_manager.cpp
+++ b/snmp_conf_manager.cpp
@@ -24,7 +24,7 @@
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
using Argument = xyz::openbmc_project::Common::InvalidArgument;
-ConfManager::ConfManager(sdbusplus::bus::bus& bus, const char* objPath) :
+ConfManager::ConfManager(sdbusplus::bus_t& bus, const char* objPath) :
details::CreateIface(bus, objPath,
details::CreateIface::action::defer_emit),
dbusPersistentLocation(SNMP_CONF_PERSIST_PATH), bus(bus),
diff --git a/snmp_conf_manager.hpp b/snmp_conf_manager.hpp
index afbfad8..d8823f3 100644
--- a/snmp_conf_manager.hpp
+++ b/snmp_conf_manager.hpp
@@ -20,7 +20,7 @@
namespace details
{
-using CreateIface = sdbusplus::server::object::object<
+using CreateIface = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::Network::Client::server::Create>;
} // namespace details
@@ -43,7 +43,7 @@
* @param[in] bus - Bus to attach to.
* @param[in] objPath - Path to attach at.
*/
- ConfManager(sdbusplus::bus::bus& bus, const char* objPath);
+ ConfManager(sdbusplus::bus_t& bus, const char* objPath);
/** @brief Function to create snmp manager details D-Bus object.
* @param[in] address- IP address/Hostname.
@@ -76,7 +76,7 @@
private:
/** @brief sdbusplus DBus bus object. */
- sdbusplus::bus::bus& bus;
+ sdbusplus::bus_t& bus;
/** @brief Path of Object. */
std::string objectPath;
diff --git a/snmp_main.cpp b/snmp_main.cpp
index be4bea1..29c18c3 100644
--- a/snmp_main.cpp
+++ b/snmp_main.cpp
@@ -38,7 +38,7 @@
bus.attach_event(eventPtr.get(), SD_EVENT_PRIORITY_NORMAL);
// Add sdbusplus Object Manager for the 'root' path of the snmp.
- sdbusplus::server::manager::manager objManager(bus, OBJ_NETWORK_SNMP);
+ sdbusplus::server::manager_t objManager(bus, OBJ_NETWORK_SNMP);
bus.request_name(BUSNAME_NETWORK_SNMP);
auto manager = std::make_unique<phosphor::network::snmp::ConfManager>(
diff --git a/snmp_util.cpp b/snmp_util.cpp
index 9516337..818bdc1 100644
--- a/snmp_util.cpp
+++ b/snmp_util.cpp
@@ -16,7 +16,7 @@
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-ObjectValueTree getManagedObjects(sdbusplus::bus::bus& bus,
+ObjectValueTree getManagedObjects(sdbusplus::bus_t& bus,
const std::string& service,
const std::string& objPath)
{
@@ -31,7 +31,7 @@
auto reply = bus.call(method);
reply.read(interfaces);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
lg2::error("Failed to get managed objects: {PATH}", "PATH", objPath);
elog<InternalFailure>();
diff --git a/snmp_util.hpp b/snmp_util.hpp
index 2ee7dac..be0c961 100644
--- a/snmp_util.hpp
+++ b/snmp_util.hpp
@@ -44,7 +44,7 @@
* @param[in] objPath - D-Bus object path.
* @return On success returns the map of name value pair.
*/
-ObjectValueTree getManagedObjects(sdbusplus::bus::bus& bus,
+ObjectValueTree getManagedObjects(sdbusplus::bus_t& bus,
const std::string& service,
const std::string& objPath);
diff --git a/test/test_snmp_client.cpp b/test/test_snmp_client.cpp
index 698c491..df4ac3f 100644
--- a/test/test_snmp_client.cpp
+++ b/test/test_snmp_client.cpp
@@ -20,7 +20,7 @@
class TestSNMPClient : public testing::Test
{
public:
- sdbusplus::bus::bus bus;
+ sdbusplus::bus_t bus;
ConfManager manager;
TestSNMPClient() :
bus(sdbusplus::bus::new_default()), manager(bus, mgrObjPath)
diff --git a/test/test_snmp_conf_manager.cpp b/test/test_snmp_conf_manager.cpp
index 13739b5..c5d3277 100644
--- a/test/test_snmp_conf_manager.cpp
+++ b/test/test_snmp_conf_manager.cpp
@@ -19,7 +19,7 @@
class TestSNMPConfManager : public testing::Test
{
public:
- sdbusplus::bus::bus bus;
+ sdbusplus::bus_t bus;
ConfManager manager;
// confDir could have been created locally in the
// TestSNMPConfManager but somehow that is leading
diff --git a/test/test_snmp_serialize.cpp b/test/test_snmp_serialize.cpp
index 627045b..d291aae 100644
--- a/test/test_snmp_serialize.cpp
+++ b/test/test_snmp_serialize.cpp
@@ -22,7 +22,7 @@
class TestSerialize : public testing::Test
{
public:
- sdbusplus::bus::bus bus;
+ sdbusplus::bus_t bus;
ConfManager manager;
TestSerialize() :
bus(sdbusplus::bus::new_default()),