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: Ie8ecdadfa03f1f7a4a369b6981a360009fe71420
diff --git a/bmc/general_systemd.cpp b/bmc/general_systemd.cpp
index 69b965b..ce16d14 100644
--- a/bmc/general_systemd.cpp
+++ b/bmc/general_systemd.cpp
@@ -44,14 +44,13 @@
try
{
- jobMonitor.emplace(
- bus,
- "type='signal',"
- "sender='org.freedesktop.systemd1',"
- "path='/org/freedesktop/systemd1',"
- "interface='org.freedesktop.systemd1.Manager',"
- "member='JobRemoved',",
- [&](sdbusplus::message::message& m) { this->match(m); });
+ jobMonitor.emplace(bus,
+ "type='signal',"
+ "sender='org.freedesktop.systemd1',"
+ "path='/org/freedesktop/systemd1',"
+ "interface='org.freedesktop.systemd1.Manager',"
+ "member='JobRemoved',",
+ [&](sdbusplus::message_t& m) { this->match(m); });
auto method = bus.new_method_call(systemdService, systemdRoot,
systemdInterface, "StartUnit");
@@ -93,7 +92,7 @@
std::fprintf(stderr, "Canceled %s: %s\n", triggerService.c_str(),
job->c_str());
}
- catch (const sdbusplus::exception::exception& ex)
+ catch (const sdbusplus::exception_t& ex)
{
std::fprintf(stderr, "Failed to cancel job %s %s: %s\n",
triggerService.c_str(), job->c_str(), ex.what());
@@ -110,7 +109,7 @@
return mode;
}
-void SystemdNoFile::match(sdbusplus::message::message& m)
+void SystemdNoFile::match(sdbusplus::message_t& m)
{
if (!job)
{
@@ -126,7 +125,7 @@
{
m.read(job_id, job_path, unit, result);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
std::fprintf(stderr, "Bad JobRemoved signal %s: %s\n",
triggerService.c_str(), e.what());
@@ -151,17 +150,15 @@
}
}
-std::unique_ptr<TriggerableActionInterface>
- SystemdNoFile::CreateSystemdNoFile(sdbusplus::bus::bus&& bus,
- const std::string& service,
- const std::string& mode)
+std::unique_ptr<TriggerableActionInterface> SystemdNoFile::CreateSystemdNoFile(
+ sdbusplus::bus_t&& bus, const std::string& service, const std::string& mode)
{
return std::make_unique<SystemdNoFile>(std::move(bus), service, mode);
}
std::unique_ptr<TriggerableActionInterface>
SystemdWithStatusFile::CreateSystemdWithStatusFile(
- sdbusplus::bus::bus&& bus, const std::string& path,
+ sdbusplus::bus_t&& bus, const std::string& path,
const std::string& service, const std::string& mode)
{
return std::make_unique<SystemdWithStatusFile>(std::move(bus), path,
diff --git a/bmc/general_systemd.hpp b/bmc/general_systemd.hpp
index 9b33460..4df4747 100644
--- a/bmc/general_systemd.hpp
+++ b/bmc/general_systemd.hpp
@@ -15,11 +15,10 @@
{
public:
static std::unique_ptr<TriggerableActionInterface>
- CreateSystemdNoFile(sdbusplus::bus::bus&& bus,
- const std::string& service,
+ CreateSystemdNoFile(sdbusplus::bus_t&& bus, const std::string& service,
const std::string& mode);
- SystemdNoFile(sdbusplus::bus::bus&& bus, const std::string& service,
+ SystemdNoFile(sdbusplus::bus_t&& bus, const std::string& service,
const std::string& mode) :
bus(std::move(bus)),
triggerService(service), mode(mode)
@@ -38,15 +37,15 @@
const std::string& getMode() const;
private:
- sdbusplus::bus::bus bus;
+ sdbusplus::bus_t bus;
const std::string triggerService;
const std::string mode;
- std::optional<sdbusplus::bus::match::match> jobMonitor;
+ std::optional<sdbusplus::bus::match_t> jobMonitor;
std::optional<std::string> job;
ActionStatus currentStatus = ActionStatus::unknown;
- void match(sdbusplus::message::message& m);
+ void match(sdbusplus::message_t& m);
};
/**
@@ -67,12 +66,12 @@
* @param[in] mode - the job-mode when starting the systemd Unit.
*/
static std::unique_ptr<TriggerableActionInterface>
- CreateSystemdWithStatusFile(sdbusplus::bus::bus&& bus,
+ CreateSystemdWithStatusFile(sdbusplus::bus_t&& bus,
const std::string& path,
const std::string& service,
const std::string& mode);
- SystemdWithStatusFile(sdbusplus::bus::bus&& bus, const std::string& path,
+ SystemdWithStatusFile(sdbusplus::bus_t&& bus, const std::string& path,
const std::string& service, const std::string& mode) :
SystemdNoFile(std::move(bus), service, mode),
checkPath(path)