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: I19e094a2a99893627dbb82b615f630b87ad90fdd
diff --git a/mainapp.cpp b/mainapp.cpp
index e8a1f00..9ae2ac4 100644
--- a/mainapp.cpp
+++ b/mainapp.cpp
@@ -25,7 +25,7 @@
int main(int /*argc*/, char** /*argv*/)
{
auto bus = sdbusplus::bus::new_default();
- sdbusplus::server::manager::manager objManager(bus, USER_MANAGER_ROOT);
+ sdbusplus::server::manager_t objManager(bus, USER_MANAGER_ROOT);
phosphor::user::UserMgr userMgr(bus, USER_MANAGER_ROOT);
diff --git a/phosphor-ldap-config/ldap_config.cpp b/phosphor-ldap-config/ldap_config.cpp
index e37faab..8f2e303 100644
--- a/phosphor-ldap-config/ldap_config.cpp
+++ b/phosphor-ldap-config/ldap_config.cpp
@@ -49,7 +49,7 @@
using Val = std::string;
using ConfigInfo = std::map<Key, Val>;
-Config::Config(sdbusplus::bus::bus& bus, const char* path, const char* filePath,
+Config::Config(sdbusplus::bus_t& bus, const char* path, const char* filePath,
const char* caCertFile, const char* certFile, bool secureLDAP,
std::string ldapServerURI, std::string ldapBindDN,
std::string ldapBaseDN, std::string&& ldapBindDNPassword,
@@ -106,7 +106,7 @@
parent.startOrStopService(nslcdService, enabled());
}
-Config::Config(sdbusplus::bus::bus& bus, const char* path, const char* filePath,
+Config::Config(sdbusplus::bus_t& bus, const char* path, const char* filePath,
const char* caCertFile, const char* certFile,
ConfigIface::Type ldapType, ConfigMgr& parent) :
Ifaces(bus, path, Ifaces::action::defer_emit),
@@ -137,7 +137,7 @@
configPersistPath += "/config";
}
-void Config::certificateInstalled(sdbusplus::message::message& /*msg*/)
+void Config::certificateInstalled(sdbusplus::message_t& /*msg*/)
{
try
{
@@ -158,7 +158,7 @@
}
}
-void Config::certificateChanged(sdbusplus::message::message& msg)
+void Config::certificateChanged(sdbusplus::message_t& msg)
{
std::string objectName;
std::map<std::string, std::variant<std::string>> msgData;
diff --git a/phosphor-ldap-config/ldap_config.hpp b/phosphor-ldap-config/ldap_config.hpp
index d0eb32e..94c0dd2 100644
--- a/phosphor-ldap-config/ldap_config.hpp
+++ b/phosphor-ldap-config/ldap_config.hpp
@@ -28,14 +28,14 @@
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
using ConfigIface = sdbusplus::xyz::openbmc_project::User::Ldap::server::Config;
using EnableIface = sdbusplus::xyz::openbmc_project::Object::server::Enable;
-using CreateIface = sdbusplus::server::object::object<
+using CreateIface = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::User::Ldap::server::Create>;
namespace fs = std::filesystem;
using MapperIface =
sdbusplus::xyz::openbmc_project::User::server::PrivilegeMapper;
using Ifaces =
- sdbusplus::server::object::object<ConfigIface, EnableIface, MapperIface>;
+ sdbusplus::server::object_t<ConfigIface, EnableIface, MapperIface>;
using ObjectPath = sdbusplus::message::object_path;
namespace sdbusRule = sdbusplus::bus::match::rules;
@@ -82,7 +82,7 @@
* @param[in] parent - parent of config object.
*/
- Config(sdbusplus::bus::bus& bus, const char* path, const char* filePath,
+ Config(sdbusplus::bus_t& bus, const char* path, const char* filePath,
const char* caCertFile, const char* certFile, bool secureLDAP,
std::string ldapServerURI, std::string ldapBindDN,
std::string ldapBaseDN, std::string&& ldapBindDNPassword,
@@ -98,7 +98,7 @@
* or openLDAP.
* @param[in] parent - parent of config object.
*/
- Config(sdbusplus::bus::bus& bus, const char* path, const char* filePath,
+ Config(sdbusplus::bus_t& bus, const char* path, const char* filePath,
const char* caCertFile, const char* certFile,
ConfigIface::Type ldapType, ConfigMgr& parent);
@@ -257,7 +257,7 @@
std::filesystem::path configPersistPath{};
/** @brief Persistent sdbusplus D-Bus bus connection. */
- sdbusplus::bus::bus& bus;
+ sdbusplus::bus_t& bus;
/** @brief Create a new LDAP config file.
*/
@@ -283,7 +283,7 @@
/** @brief React to InterfaceAdded signal
* @param[in] msg - sdbusplus message
*/
- void certificateInstalled(sdbusplus::message::message& msg);
+ void certificateInstalled(sdbusplus::message_t& msg);
sdbusplus::bus::match_t certificateInstalledSignal;
sdbusplus::bus::match_t cacertificateInstalledSignal;
@@ -291,7 +291,7 @@
/** @brief React to certificate changed signal
* @param[in] msg - sdbusplus message
*/
- void certificateChanged(sdbusplus::message::message& msg);
+ void certificateChanged(sdbusplus::message_t& msg);
sdbusplus::bus::match_t certificateChangedSignal;
friend class MockConfigMgr;
diff --git a/phosphor-ldap-config/ldap_config_mgr.cpp b/phosphor-ldap-config/ldap_config_mgr.cpp
index 1218d18..87791b8 100644
--- a/phosphor-ldap-config/ldap_config_mgr.cpp
+++ b/phosphor-ldap-config/ldap_config_mgr.cpp
@@ -50,7 +50,7 @@
method.append(service.c_str(), "replace");
bus.call_noreply(method);
}
- catch (const sdbusplus::exception::exception& ex)
+ catch (const sdbusplus::exception_t& ex)
{
log<level::ERR>("Failed to restart service",
entry("SERVICE=%s", service.c_str()),
@@ -67,7 +67,7 @@
method.append(service.c_str(), "replace");
bus.call_noreply(method);
}
- catch (const sdbusplus::exception::exception& ex)
+ catch (const sdbusplus::exception_t& ex)
{
log<level::ERR>("Failed to stop service",
entry("SERVICE=%s", service.c_str()),
diff --git a/phosphor-ldap-config/ldap_config_mgr.hpp b/phosphor-ldap-config/ldap_config_mgr.hpp
index 470e7f9..af3051c 100644
--- a/phosphor-ldap-config/ldap_config_mgr.hpp
+++ b/phosphor-ldap-config/ldap_config_mgr.hpp
@@ -27,7 +27,7 @@
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-using CreateIface = sdbusplus::server::object::object<
+using CreateIface = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::User::Ldap::server::Create>;
// class Config;
@@ -53,7 +53,7 @@
* @param[in] dbusPersistentPath - Persistent path for LDAP D-Bus property.
* @param[in] caCertFile - LDAP's CA certificate file.
*/
- ConfigMgr(sdbusplus::bus::bus& bus, const char* path, const char* filePath,
+ ConfigMgr(sdbusplus::bus_t& bus, const char* path, const char* filePath,
const char* dbusPersistentPath, const char* caCertFile,
const char* certFile) :
CreateIface(bus, path, CreateIface::action::defer_emit),
@@ -121,7 +121,7 @@
std::string tlsCertFile{};
/** @brief Persistent sdbusplus D-Bus bus connection. */
- sdbusplus::bus::bus& bus;
+ sdbusplus::bus_t& bus;
/* Below two config objects are default, which will always be there */
diff --git a/phosphor-ldap-config/ldap_mapper_entry.cpp b/phosphor-ldap-config/ldap_mapper_entry.cpp
index b9442e3..af57e2d 100644
--- a/phosphor-ldap-config/ldap_mapper_entry.cpp
+++ b/phosphor-ldap-config/ldap_mapper_entry.cpp
@@ -23,7 +23,7 @@
sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument;
using Argument = xyz::openbmc_project::Common::InvalidArgument;
-LDAPMapperEntry::LDAPMapperEntry(sdbusplus::bus::bus& bus, const char* path,
+LDAPMapperEntry::LDAPMapperEntry(sdbusplus::bus_t& bus, const char* path,
const char* filePath,
const std::string& groupName,
const std::string& privilege, Config& parent) :
@@ -36,7 +36,7 @@
Interfaces::emit_object_added();
}
-LDAPMapperEntry::LDAPMapperEntry(sdbusplus::bus::bus& bus, const char* path,
+LDAPMapperEntry::LDAPMapperEntry(sdbusplus::bus_t& bus, const char* path,
const char* filePath, Config& parent) :
Interfaces(bus, path, Interfaces::action::defer_emit),
id(std::stol(std::filesystem::path(path).filename())), manager(parent),
diff --git a/phosphor-ldap-config/ldap_mapper_entry.hpp b/phosphor-ldap-config/ldap_mapper_entry.hpp
index efafeae..1c0c87f 100644
--- a/phosphor-ldap-config/ldap_mapper_entry.hpp
+++ b/phosphor-ldap-config/ldap_mapper_entry.hpp
@@ -14,7 +14,7 @@
using Entry =
sdbusplus::xyz::openbmc_project::User::server::PrivilegeMapperEntry;
using Delete = sdbusplus::xyz::openbmc_project::Object::server::Delete;
-using Interfaces = sdbusplus::server::object::object<Entry, Delete>;
+using Interfaces = sdbusplus::server::object_t<Entry, Delete>;
// Forward declaration for Config
class Config;
@@ -44,7 +44,7 @@
* @param[in] privilege - the privilege for the group
* @param[in] parent - LDAP privilege mapper manager
*/
- LDAPMapperEntry(sdbusplus::bus::bus& bus, const char* path,
+ LDAPMapperEntry(sdbusplus::bus_t& bus, const char* path,
const char* filePath, const std::string& groupName,
const std::string& privilege, Config& parent);
@@ -55,7 +55,7 @@
* @param[in] filePath - serialization directory path
* @param[in] parent - LDAP privilege mapper manager
*/
- LDAPMapperEntry(sdbusplus::bus::bus& bus, const char* path,
+ LDAPMapperEntry(sdbusplus::bus_t& bus, const char* path,
const char* filePath, Config& parent);
/** @brief Delete privilege mapper entry object
diff --git a/phosphor-ldap-config/main.cpp b/phosphor-ldap-config/main.cpp
index bd65da4..e2bedaf 100644
--- a/phosphor-ldap-config/main.cpp
+++ b/phosphor-ldap-config/main.cpp
@@ -28,7 +28,7 @@
auto bus = sdbusplus::bus::new_default();
// Add sdbusplus ObjectManager for the 'root' path of the LDAP config.
- sdbusplus::server::manager::manager objManager(bus, LDAP_CONFIG_ROOT);
+ sdbusplus::server::manager_t objManager(bus, LDAP_CONFIG_ROOT);
phosphor::ldap::ConfigMgr mgr(bus, LDAP_CONFIG_ROOT, LDAP_CONFIG_FILE,
LDAP_CONF_PERSIST_PATH, TLS_CACERT_PATH,
diff --git a/test/ldap_config_test.cpp b/test/ldap_config_test.cpp
index 35fdaea..6f7d1f7 100644
--- a/test/ldap_config_test.cpp
+++ b/test/ldap_config_test.cpp
@@ -70,15 +70,15 @@
std::string tlsCacertFile;
std::string tlsCertFile;
std::string ldapconfFile;
- sdbusplus::bus::bus bus;
+ sdbusplus::bus_t bus;
};
class MockConfigMgr : public phosphor::ldap::ConfigMgr
{
public:
- MockConfigMgr(sdbusplus::bus::bus& bus, const char* path,
- const char* filePath, const char* dbusPersistentFile,
- const char* caCertFile, const char* certFile) :
+ MockConfigMgr(sdbusplus::bus_t& bus, const char* path, const char* filePath,
+ const char* dbusPersistentFile, const char* caCertFile,
+ const char* certFile) :
phosphor::ldap::ConfigMgr(bus, path, filePath, dbusPersistentFile,
caCertFile, certFile)
{}
diff --git a/test/mock_user_mgr.hpp b/test/mock_user_mgr.hpp
index 70d696c..9a0ecdd 100644
--- a/test/mock_user_mgr.hpp
+++ b/test/mock_user_mgr.hpp
@@ -12,7 +12,7 @@
class MockManager : public UserMgr
{
public:
- MockManager(sdbusplus::bus::bus& bus, const char* path) : UserMgr(bus, path)
+ MockManager(sdbusplus::bus_t& bus, const char* path) : UserMgr(bus, path)
{}
MOCK_METHOD1(getLdapGroupName, std::string(const std::string& userName));
diff --git a/test/user_mgr_test.cpp b/test/user_mgr_test.cpp
index 74ae930..3059ea3 100644
--- a/test/user_mgr_test.cpp
+++ b/test/user_mgr_test.cpp
@@ -22,7 +22,7 @@
{
public:
sdbusplus::SdBusMock sdbusMock;
- sdbusplus::bus::bus bus;
+ sdbusplus::bus_t bus;
MockManager mockManager;
TestUserMgr() :
diff --git a/user_mgr.cpp b/user_mgr.cpp
index a5ecb8f..131c805 100644
--- a/user_mgr.cpp
+++ b/user_mgr.cpp
@@ -919,7 +919,7 @@
entry("WHAT=%s", e.what()));
throw;
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
"Failed to excute method", entry("METHOD=%s", "GetManagedObjects"),
@@ -1181,7 +1181,7 @@
}
}
-UserMgr::UserMgr(sdbusplus::bus::bus& bus, const char* path) :
+UserMgr::UserMgr(sdbusplus::bus_t& bus, const char* path) :
Ifaces(bus, path, Ifaces::action::defer_emit), bus(bus), path(path)
{
UserMgrIface::allPrivileges(privMgr);
diff --git a/user_mgr.hpp b/user_mgr.hpp
index f5aac22..23278ed 100644
--- a/user_mgr.hpp
+++ b/user_mgr.hpp
@@ -35,8 +35,7 @@
using AccountPolicyIface =
sdbusplus::xyz::openbmc_project::User::server::AccountPolicy;
-using Ifaces =
- sdbusplus::server::object::object<UserMgrIface, AccountPolicyIface>;
+using Ifaces = sdbusplus::server::object_t<UserMgrIface, AccountPolicyIface>;
using Privilege = std::string;
using GroupList = std::vector<std::string>;
@@ -78,7 +77,7 @@
* @param[in] bus - sdbusplus handler
* @param[in] path - D-Bus path
*/
- UserMgr(sdbusplus::bus::bus& bus, const char* path);
+ UserMgr(sdbusplus::bus_t& bus, const char* path);
/** @brief create user method.
* This method creates a new user as requested
@@ -189,7 +188,7 @@
private:
/** @brief sdbusplus handler */
- sdbusplus::bus::bus& bus;
+ sdbusplus::bus_t& bus;
/** @brief object path */
const std::string path;
diff --git a/users.cpp b/users.cpp
index 239459a..8906769 100644
--- a/users.cpp
+++ b/users.cpp
@@ -58,7 +58,7 @@
* @param[in] enabled - user enabled state
* @param[in] parent - user manager - parent object
*/
-Users::Users(sdbusplus::bus::bus& bus, const char* path,
+Users::Users(sdbusplus::bus_t& bus, const char* path,
std::vector<std::string> groups, std::string priv, bool enabled,
UserMgr& parent) :
Interfaces(bus, path, Interfaces::action::defer_emit),
diff --git a/users.hpp b/users.hpp
index 6ff4dfb..a1fcc36 100644
--- a/users.hpp
+++ b/users.hpp
@@ -27,7 +27,7 @@
namespace Base = sdbusplus::xyz::openbmc_project;
using UsersIface = Base::User::server::Attributes;
using DeleteIface = Base::Object::server::Delete;
-using Interfaces = sdbusplus::server::object::object<UsersIface, DeleteIface>;
+using Interfaces = sdbusplus::server::object_t<UsersIface, DeleteIface>;
// Place where all user objects has to be created
constexpr auto usersObjPath = "/xyz/openbmc_project/user";
@@ -55,7 +55,7 @@
* @param[in] enabled - user enabled state
* @param[in] parent - user manager - parent object
*/
- Users(sdbusplus::bus::bus& bus, const char* path,
+ Users(sdbusplus::bus_t& bus, const char* path,
std::vector<std::string> groups, std::string priv, bool enabled,
UserMgr& parent);