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: I5bc54a17954f74651bff4fbdd7f7dd7e7cfb084e
diff --git a/src/cmd.cpp b/src/cmd.cpp
index aa8bbae..a51bc22 100644
--- a/src/cmd.cpp
+++ b/src/cmd.cpp
@@ -21,11 +21,11 @@
namespace kcsbridge
{
-using sdbusplus::bus::bus;
-using sdbusplus::message::message;
-using sdbusplus::slot::slot;
+using sdbusplus::bus_t;
+using sdbusplus::message_t;
+using sdbusplus::slot_t;
-void write(stdplus::Fd& kcs, message&& m)
+void write(stdplus::Fd& kcs, message_t&& m)
{
std::array<uint8_t, 1024> buffer;
std::span<uint8_t> out(buffer.begin(), 3);
@@ -64,7 +64,7 @@
stdplus::fd::writeExact(kcs, out);
}
-void read(stdplus::Fd& kcs, bus& bus, slot& outstanding)
+void read(stdplus::Fd& kcs, bus_t& bus, slot_t& outstanding)
{
std::array<uint8_t, 1024> buffer;
auto in = stdplus::fd::read(kcs, buffer);
@@ -75,7 +75,7 @@
if (outstanding)
{
fmt::print(stderr, "Canceling outstanding request\n");
- outstanding = slot(nullptr);
+ outstanding = slot_t(nullptr);
}
if (in.size() < 2)
{
@@ -90,8 +90,8 @@
uint8_t netfn = in[0] >> 2, lun = in[0] & 3, cmd = in[1];
m.append(netfn, lun, cmd, in.subspan(2), options);
outstanding = m.call_async(
- stdplus::exception::ignore([&outstanding, &kcs](message&& m) {
- outstanding = slot(nullptr);
+ stdplus::exception::ignore([&outstanding, &kcs](message_t&& m) {
+ outstanding = slot_t(nullptr);
write(kcs, std::move(m));
}));
}
diff --git a/src/cmd.hpp b/src/cmd.hpp
index a6a6fa3..33f3c0e 100644
--- a/src/cmd.hpp
+++ b/src/cmd.hpp
@@ -7,8 +7,8 @@
namespace kcsbridge
{
-void write(stdplus::Fd& kcs, sdbusplus::message::message&& m);
-void read(stdplus::Fd& kcs, sdbusplus::bus::bus& bus,
- sdbusplus::slot::slot& outstanding);
+void write(stdplus::Fd& kcs, sdbusplus::message_t&& m);
+void read(stdplus::Fd& kcs, sdbusplus::bus_t& bus,
+ sdbusplus::slot_t& outstanding);
} // namespace kcsbridge
diff --git a/src/main.cpp b/src/main.cpp
index e8863e8..6abd949 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -48,7 +48,7 @@
stdplus::ManagedFd kcs = stdplus::fd::open(
fmt::format("/dev/{}", channel),
OpenFlags(OpenAccess::ReadWrite).set(OpenFlag::NonBlock));
- sdbusplus::slot::slot slot(nullptr);
+ sdbusplus::slot_t slot(nullptr);
// Add a reader to the bus for handling inbound IPMI
IO ioSource(
diff --git a/src/server.cpp b/src/server.cpp
index 836ac43..5b41c05 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -13,19 +13,19 @@
namespace kcsbridge
{
-void setAttention(sdbusplus::message::message& m, stdplus::Fd& kcs)
+void setAttention(sdbusplus::message_t& m, stdplus::Fd& kcs)
{
stdplus::fd::ioctl(kcs, IPMI_BMC_IOCTL_SET_SMS_ATN, nullptr);
m.new_method_return().method_return();
}
-void clearAttention(sdbusplus::message::message& m, stdplus::Fd& kcs)
+void clearAttention(sdbusplus::message_t& m, stdplus::Fd& kcs)
{
stdplus::fd::ioctl(kcs, IPMI_BMC_IOCTL_CLEAR_SMS_ATN, nullptr);
m.new_method_return().method_return();
}
-void forceAbort(sdbusplus::message::message& m, stdplus::Fd& kcs)
+void forceAbort(sdbusplus::message_t& m, stdplus::Fd& kcs)
{
stdplus::fd::ioctl(kcs, IPMI_BMC_IOCTL_FORCE_ABORT, nullptr);
m.new_method_return().method_return();
@@ -34,7 +34,7 @@
template <auto func, typename Data>
int methodRsp(sd_bus_message* mptr, void* dataptr, sd_bus_error* error) noexcept
{
- sdbusplus::message::message m(mptr);
+ sdbusplus::message_t m(mptr);
try
{
func(m, *reinterpret_cast<Data*>(dataptr));
@@ -61,8 +61,9 @@
sdbusplus::vtable::end(),
};
-sdbusplus::server::interface::interface createSMSHandler(
- sdbusplus::bus::bus& bus, const char* obj, stdplus::Fd& kcs)
+sdbusplus::server::interface::interface createSMSHandler(sdbusplus::bus_t& bus,
+ const char* obj,
+ stdplus::Fd& kcs)
{
return sdbusplus::server::interface::interface(
bus, obj, "xyz.openbmc_project.Ipmi.Channel.SMS",
diff --git a/src/server.hpp b/src/server.hpp
index 6a5f1fe..1dfb084 100644
--- a/src/server.hpp
+++ b/src/server.hpp
@@ -6,7 +6,8 @@
namespace kcsbridge
{
-sdbusplus::server::interface::interface createSMSHandler(
- sdbusplus::bus::bus& bus, const char* obj, stdplus::Fd& kcs);
+sdbusplus::server::interface::interface createSMSHandler(sdbusplus::bus_t& bus,
+ const char* obj,
+ stdplus::Fd& kcs);
}