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: Ie85ba085aedffd41bcb6310ee57adb86cb68273d
diff --git a/example.cpp b/example.cpp
index 917c12e..b3549d0 100644
--- a/example.cpp
+++ b/example.cpp
@@ -31,10 +31,10 @@
/*
* One can also specify custom handler that operates on
- * sdbusplus::message::message type and pass them to constructor.
+ * sdbusplus::message_t type and pass them to constructor.
* e.g.
*
- * static void PrintMessageMap(sdbusplus::message::message& m)
+ * static void PrintMessageMap(sdbusplus::message_t& m)
* {
* std::string messageBusName;
* std::map<std::string, std::variant<uint64_t>> messageData;
diff --git a/ipmisnoop/ipmisnoop.hpp b/ipmisnoop/ipmisnoop.hpp
index efc5378..39a35e9 100644
--- a/ipmisnoop/ipmisnoop.hpp
+++ b/ipmisnoop/ipmisnoop.hpp
@@ -37,7 +37,7 @@
const std::string rawIface = "xyz.openbmc_project.State.Boot.Raw";
const std::string rawService = "xyz.openbmc_project.State.Boot.Raw";
-uint32_t getSelectorPosition(sdbusplus::bus::bus& bus)
+uint32_t getSelectorPosition(sdbusplus::bus_t& bus)
{
const std::string propertyName = "Position";
@@ -53,7 +53,7 @@
reply.read(value);
return std::get<uint32_t>(value);
}
- catch (const sdbusplus::exception::exception& ex)
+ catch (const sdbusplus::exception_t& ex)
{
std::cerr << "GetProperty call failed ";
throw std::runtime_error("GetProperty call failed");
@@ -62,13 +62,13 @@
struct IpmiPostReporter : PostObject
{
- IpmiPostReporter(sdbusplus::bus::bus& bus, const char* objPath) :
+ IpmiPostReporter(sdbusplus::bus_t& bus, const char* objPath) :
PostObject(bus, objPath), bus(bus),
propertiesChangedSignalRaw(
bus,
sdbusplus::bus::match::rules::propertiesChanged(objPath, rawIface),
- [this, &bus](sdbusplus::message::message& msg) {
+ [this, &bus](sdbusplus::message_t& msg) {
using primarycode_t = uint64_t;
using secondarycode_t = std::vector<uint8_t>;
using postcode_t = std::tuple<primarycode_t, secondarycode_t>;
@@ -130,10 +130,10 @@
{
}
- sdbusplus::bus::bus& bus;
+ sdbusplus::bus_t& bus;
sdbusplus::bus::match_t propertiesChangedSignalRaw;
int postCodeDisplay(uint8_t);
- void getSelectorPositionSignal(sdbusplus::bus::bus& bus);
+ void getSelectorPositionSignal(sdbusplus::bus_t& bus);
};
// Configure the seven segment display connected GPIOs direction
diff --git a/lpcsnoop/snoop.hpp b/lpcsnoop/snoop.hpp
index dab3334..dfa11de 100644
--- a/lpcsnoop/snoop.hpp
+++ b/lpcsnoop/snoop.hpp
@@ -10,7 +10,7 @@
constexpr char snoopDbus[] = "xyz.openbmc_project.State.Boot.Raw";
template <typename... T>
-using ServerObject = typename sdbusplus::server::object::object<T...>;
+using ServerObject = typename sdbusplus::server::object_t<T...>;
using PostInterface = sdbusplus::xyz::openbmc_project::State::Boot::server::Raw;
using PostObject = ServerObject<PostInterface>;
using primary_post_code_t = uint64_t;
@@ -20,7 +20,7 @@
class PostReporter : public PostObject
{
public:
- PostReporter(sdbusplus::bus::bus& bus, const char* objPath, bool defer) :
+ PostReporter(sdbusplus::bus_t& bus, const char* objPath, bool defer) :
PostObject(bus, objPath,
defer ? PostObject::action::defer_emit
: PostObject::action::emit_object_added)
diff --git a/lpcsnoop/snoop_listen.hpp b/lpcsnoop/snoop_listen.hpp
index 292745b..3a3682b 100644
--- a/lpcsnoop/snoop_listen.hpp
+++ b/lpcsnoop/snoop_listen.hpp
@@ -35,21 +35,21 @@
class SnoopListen
{
- using message_handler_t = std::function<void(sdbusplus::message::message&)>;
+ using message_handler_t = std::function<void(sdbusplus::message_t&)>;
using postcode_handler_t = std::function<void(FILE*, postcode_t)>;
public:
- SnoopListen(sdbusplus::bus::bus& busIn, sd_bus_message_handler_t handler) :
+ SnoopListen(sdbusplus::bus_t& busIn, sd_bus_message_handler_t handler) :
signal(busIn, GetMatchRule().c_str(), handler, this)
{
}
- SnoopListen(sdbusplus::bus::bus& busIn, message_handler_t handler) :
+ SnoopListen(sdbusplus::bus_t& busIn, message_handler_t handler) :
signal(busIn, GetMatchRule(), handler)
{
}
- SnoopListen(sdbusplus::bus::bus& busIn, postcode_handler_t handler,
+ SnoopListen(sdbusplus::bus_t& busIn, postcode_handler_t handler,
FILE* f = NULL) :
SnoopListen(busIn, std::bind(defaultMessageHandler, handler, f,
std::placeholders::_1))
@@ -71,7 +71,7 @@
* DBus path, and calls the given postcode_handler on each value received.
*/
static void defaultMessageHandler(postcode_handler_t& handler, FILE* f,
- sdbusplus::message::message& m)
+ sdbusplus::message_t& m)
{
std::string messageBusName;
std::map<std::string, std::variant<postcode_t>> messageData;
diff --git a/main.cpp b/main.cpp
index fd8f4b6..94603d1 100644
--- a/main.cpp
+++ b/main.cpp
@@ -56,7 +56,7 @@
#endif
#ifdef ENABLE_IPMI_SNOOP
-void IpmiPostReporter::getSelectorPositionSignal(sdbusplus::bus::bus& bus)
+void IpmiPostReporter::getSelectorPositionSignal(sdbusplus::bus_t& bus)
{
size_t posVal = 0;
@@ -64,7 +64,7 @@
bus,
sdbusplus::bus::match::rules::propertiesChanged(selectorObject,
selectorIface),
- [&](sdbusplus::message::message& msg) {
+ [&](sdbusplus::message_t& msg) {
std::string objectName;
std::map<std::string, Selector::PropertiesVariant> msgData;
msg.read(objectName, msgData);
@@ -155,7 +155,7 @@
#ifdef ENABLE_IPMI_SNOOP
// handle muti-host D-bus
int postCodeIpmiHandler(const std::string& snoopObject,
- const std::string& snoopDbus, sdbusplus::bus::bus& bus,
+ const std::string& snoopDbus, sdbusplus::bus_t& bus,
std::span<std::string> host)
{
int ret = 0;
@@ -312,7 +312,7 @@
bool deferSignals = true;
// Add systemd object manager.
- sdbusplus::server::manager::manager snoopdManager(bus, snoopObject);
+ sdbusplus::server::manager_t snoopdManager(bus, snoopObject);
PostReporter reporter(bus, snoopObject, deferSignals);
reporter.emit_object_added();
diff --git a/test/post_reporter_test.cpp b/test/post_reporter_test.cpp
index 0a13769..8f7f503 100644
--- a/test/post_reporter_test.cpp
+++ b/test/post_reporter_test.cpp
@@ -28,7 +28,7 @@
}
NiceMock<sdbusplus::SdBusMock> bus_mock;
- sdbusplus::bus::bus bus;
+ sdbusplus::bus_t bus;
};
TEST_F(PostReporterTest, EmitsObjectsOnExpectedDbusPath)