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: I9541d521bf67882215a4a66dce020e38ac2df065
diff --git a/app.cpp b/app.cpp
index 94e00c4..a7e5f63 100644
--- a/app.cpp
+++ b/app.cpp
@@ -37,12 +37,12 @@
// Attach the bus to sd_event to service user requests
bus.attach_event(eventP.get(), SD_EVENT_PRIORITY_NORMAL);
- sdbusplus::server::manager::manager objManager(bus, OCC_CONTROL_ROOT);
+ sdbusplus::server::manager_t objManager(bus, OCC_CONTROL_ROOT);
#ifdef READ_OCC_SENSORS
- sdbusplus::server::manager::manager objManagerXyz(bus, OCC_SENSORS_ROOT);
+ sdbusplus::server::manager_t objManagerXyz(bus, OCC_SENSORS_ROOT);
#endif
#ifdef POWER10
- sdbusplus::server::manager::manager objManagerXyzControl(
+ sdbusplus::server::manager_t objManagerXyzControl(
bus, "/xyz/openbmc_project/control");
#endif
open_power::occ::Manager mgr(eventP);
diff --git a/occ_command.cpp b/occ_command.cpp
index aa5ecb6..39bcae6 100644
--- a/occ_command.cpp
+++ b/occ_command.cpp
@@ -280,7 +280,7 @@
}
// Called at OCC Status change signal
-void OccCommand::activeStatusEvent(sdbusplus::message::message& msg)
+void OccCommand::activeStatusEvent(sdbusplus::message_t& msg)
{
std::string statusInterface;
std::map<std::string, std::variant<bool>> msgData;
diff --git a/occ_command.hpp b/occ_command.hpp
index d632656..79beca0 100644
--- a/occ_command.hpp
+++ b/occ_command.hpp
@@ -166,7 +166,7 @@
*
* @param[in] msg - Data associated with subscribed signal
*/
- void activeStatusEvent(sdbusplus::message::message& msg);
+ void activeStatusEvent(sdbusplus::message_t& msg);
};
} // namespace occ
diff --git a/occ_dbus.hpp b/occ_dbus.hpp
index 8d88b80..90fc498 100644
--- a/occ_dbus.hpp
+++ b/occ_dbus.hpp
@@ -13,11 +13,11 @@
using ObjectPath = std::string;
-using SensorIntf = sdbusplus::server::object::object<
+using SensorIntf = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::Sensor::server::Value>;
using OperationalStatusIntf =
- sdbusplus::server::object::object<sdbusplus::xyz::openbmc_project::State::
- Decorator::server::OperationalStatus>;
+ sdbusplus::server::object_t<sdbusplus::xyz::openbmc_project::State::
+ Decorator::server::OperationalStatus>;
// Note: Not using object<> so the PropertiesVariant ctor is available.
using AssociationIntf =
diff --git a/occ_ffdc.cpp b/occ_ffdc.cpp
index 3ec42be..3f10dbe 100644
--- a/occ_ffdc.cpp
+++ b/occ_ffdc.cpp
@@ -77,7 +77,7 @@
response.read(reply);
plid = std::get<1>(reply);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>("Failed to create PEL");
}
@@ -119,7 +119,7 @@
method.append(path, level, additionalData);
bus.call(method);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
fmt::format("Failed to create PEL: {}", e.what()).c_str());
diff --git a/occ_manager.cpp b/occ_manager.cpp
index 22150c2..17cd403 100644
--- a/occ_manager.cpp
+++ b/occ_manager.cpp
@@ -253,7 +253,7 @@
return occs;
}
-int Manager::cpuCreated(sdbusplus::message::message& msg)
+int Manager::cpuCreated(sdbusplus::message_t& msg)
{
namespace fs = std::filesystem;
@@ -557,7 +557,7 @@
auto response = bus.call(method);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
constexpr auto ERROR_DUMP_DISABLED =
"xyz.openbmc_project.Dump.Create.Error.Disabled";
@@ -1116,7 +1116,7 @@
}
}
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
if (traceAltitudeErr)
{
@@ -1129,7 +1129,7 @@
}
// Callback function when ambient temperature changes
-void Manager::ambientCallback(sdbusplus::message::message& msg)
+void Manager::ambientCallback(sdbusplus::message_t& msg)
{
double currentTemp = 0;
uint8_t truncatedTemp = 0xFF;
diff --git a/occ_manager.hpp b/occ_manager.hpp
index d0b01b3..a713507 100644
--- a/occ_manager.hpp
+++ b/occ_manager.hpp
@@ -171,7 +171,7 @@
*
* @returns 0 to indicate success
*/
- int cpuCreated(sdbusplus::message::message& msg);
+ int cpuCreated(sdbusplus::message_t& msg);
/** @brief Create child OCC objects.
*
@@ -427,7 +427,7 @@
*
* @param[in] msg - Data associated with subscribed signal
*/
- void ambientCallback(sdbusplus::message::message& msg);
+ void ambientCallback(sdbusplus::message_t& msg);
/** @brief Confirm that a single OCC master was found and start presence
* monitoring
diff --git a/occ_pass_through.cpp b/occ_pass_through.cpp
index 6291828..afc9513 100644
--- a/occ_pass_through.cpp
+++ b/occ_pass_through.cpp
@@ -166,7 +166,7 @@
}
// Called at OCC Status change signal
-void PassThrough::activeStatusEvent(sdbusplus::message::message& msg)
+void PassThrough::activeStatusEvent(sdbusplus::message_t& msg)
{
std::string statusInterface;
std::map<std::string, std::variant<bool>> msgData;
diff --git a/occ_pass_through.hpp b/occ_pass_through.hpp
index 52a8f71..f11695c 100644
--- a/occ_pass_through.hpp
+++ b/occ_pass_through.hpp
@@ -18,7 +18,7 @@
namespace occ
{
-using Iface = sdbusplus::server::object::object<
+using Iface = sdbusplus::server::object_t<
sdbusplus::org::open_power::OCC::server::PassThrough>;
// For waiting on signals
@@ -107,7 +107,7 @@
*
* @param[in] msg - Data associated with subscribed signal
*/
- void activeStatusEvent(sdbusplus::message::message& msg);
+ void activeStatusEvent(sdbusplus::message_t& msg);
};
} // namespace occ
diff --git a/occ_status.cpp b/occ_status.cpp
index 14981c7..57c8057 100644
--- a/occ_status.cpp
+++ b/occ_status.cpp
@@ -172,7 +172,7 @@
// Handler called by Host control command handler to convey the
// status of the executed command
-void Status::hostControlEvent(sdbusplus::message::message& msg)
+void Status::hostControlEvent(sdbusplus::message_t& msg)
{
std::string cmdCompleted{};
std::string cmdStatus{};
diff --git a/occ_status.hpp b/occ_status.hpp
index 224a534..ce3df77 100644
--- a/occ_status.hpp
+++ b/occ_status.hpp
@@ -27,7 +27,7 @@
class Manager;
namespace Base = sdbusplus::org::open_power::OCC::server;
-using Interface = sdbusplus::server::object::object<Base::Status>;
+using Interface = sdbusplus::server::object_t<Base::Status>;
// IPMID's host control application
namespace Control = sdbusplus::org::open_power::Control::server;
@@ -295,7 +295,7 @@
*
* @param[in] msg - Data associated with subscribed signal
*/
- void hostControlEvent(sdbusplus::message::message& msg);
+ void hostControlEvent(sdbusplus::message_t& msg);
/** @brief Sends a message to host control command handler to reset OCC
*/
diff --git a/pldm.cpp b/pldm.cpp
index a924132..6921861 100644
--- a/pldm.cpp
+++ b/pldm.cpp
@@ -46,7 +46,7 @@
auto responseMsg = bus.call(method);
responseMsg.read(pdrs);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
if (!tracedError)
{
@@ -129,7 +129,7 @@
}
}
-void Interface::sensorEvent(sdbusplus::message::message& msg)
+void Interface::sensorEvent(sdbusplus::message_t& msg)
{
if (!isOCCSensorCacheValid())
{
@@ -237,7 +237,7 @@
}
}
-void Interface::hostStateEvent(sdbusplus::message::message& msg)
+void Interface::hostStateEvent(sdbusplus::message_t& msg)
{
std::map<std::string, std::variant<std::string>> properties{};
std::string interface;
@@ -317,7 +317,7 @@
auto responseMsg = bus.call(method);
responseMsg.read(pdrs);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>("pldm: Failed to fetch the state effecter PDRs",
entry("ERROR=%s", e.what()));
@@ -528,7 +528,7 @@
mctpInstance.value())
.c_str());
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
fmt::format("pldm: GetInstanceId failed: {}", e.what())
diff --git a/pldm.hpp b/pldm.hpp
index 3f0c844..1526bd4 100644
--- a/pldm.hpp
+++ b/pldm.hpp
@@ -257,7 +257,7 @@
*
* @param[in] msg - data associated with the subscribed signal
*/
- void sensorEvent(sdbusplus::message::message& msg);
+ void sensorEvent(sdbusplus::message_t& msg);
/** @brief When the host state changes and if the CurrentHostState is
* xyz.openbmc_project.State.Host.HostState.Off then
@@ -265,7 +265,7 @@
*
* @param[in] msg - data associated with the subscribed signal
*/
- void hostStateEvent(sdbusplus::message::message& msg);
+ void hostStateEvent(sdbusplus::message_t& msg);
/** @brief Called when it is determined that the Host is not running.
* The cache of OCC sensors and effecters mapping is cleared.
diff --git a/powercap.cpp b/powercap.cpp
index 20a8f47..6a9c67f 100644
--- a/powercap.cpp
+++ b/powercap.cpp
@@ -142,7 +142,7 @@
auto occInput = getOccInput(newCap, pcapEnabled);
writeOcc(occInput);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
fmt::format(
@@ -177,7 +177,7 @@
return std::get<uint32_t>(pcap);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>("Failed to get PowerCap property",
entry("ERROR=%s", e.what()),
@@ -197,7 +197,7 @@
return std::get<bool>(pcapEnabled);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>("Failed to get PowerCapEnable property",
entry("ERROR=%s", e.what()),
@@ -320,7 +320,7 @@
return userCap;
}
-void PowerCap::pcapChanged(sdbusplus::message::message& msg)
+void PowerCap::pcapChanged(sdbusplus::message_t& msg)
{
if (!occStatus.occActive())
{
@@ -413,7 +413,7 @@
utils::setProperty(PCAP_PATH, PCAP_INTERFACE, POWER_CAP_SOFT_MIN,
softMin);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
fmt::format(
@@ -428,7 +428,7 @@
utils::setProperty(PCAP_PATH, PCAP_INTERFACE, POWER_CAP_HARD_MIN,
hardMin);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
fmt::format(
@@ -442,7 +442,7 @@
{
utils::setProperty(PCAP_PATH, PCAP_INTERFACE, POWER_CAP_MAX, max);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
fmt::format(
@@ -468,7 +468,7 @@
utils::getProperty(PCAP_PATH, PCAP_INTERFACE, POWER_CAP_SOFT_MIN);
softMin = std::get<uint32_t>(prop);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
fmt::format("readDbusPcapLimits: Failed to get SOFT PCAP due to {}",
@@ -484,7 +484,7 @@
utils::getProperty(PCAP_PATH, PCAP_INTERFACE, POWER_CAP_HARD_MIN);
hardMin = std::get<uint32_t>(prop);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
fmt::format("readDbusPcapLimits: Failed to get HARD PCAP due to {}",
@@ -499,7 +499,7 @@
prop = utils::getProperty(PCAP_PATH, PCAP_INTERFACE, POWER_CAP_MAX);
max = std::get<uint32_t>(prop);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
fmt::format("readDbusPcapLimits: Failed to get MAX PCAP due to {}",
diff --git a/powercap.hpp b/powercap.hpp
index b52ebda..3ef09c9 100644
--- a/powercap.hpp
+++ b/powercap.hpp
@@ -74,7 +74,7 @@
* @param[in] msg - Data associated with pcap change signal
*
*/
- void pcapChanged(sdbusplus::message::message& msg);
+ void pcapChanged(sdbusplus::message_t& msg);
/** @brief Get the power cap property
*
diff --git a/powermode.cpp b/powermode.cpp
index e2f0837..589fb8f 100644
--- a/powermode.cpp
+++ b/powermode.cpp
@@ -63,7 +63,7 @@
};
// Called when DBus power mode gets changed
-void PowerMode::modeChanged(sdbusplus::message::message& msg)
+void PowerMode::modeChanged(sdbusplus::message_t& msg)
{
std::map<std::string, std::variant<std::string>> properties{};
std::string interface;
@@ -399,7 +399,7 @@
return status;
}
-void PowerMode::ipsChanged(sdbusplus::message::message& msg)
+void PowerMode::ipsChanged(sdbusplus::message_t& msg)
{
bool parmsChanged = false;
std::string interface;
@@ -718,7 +718,7 @@
}
// Called when PowerModeProperties defaults are available on DBus
-void PowerMode::defaultsReady(sdbusplus::message::message& msg)
+void PowerMode::defaultsReady(sdbusplus::message_t& msg)
{
std::map<std::string, std::variant<std::string>> properties{};
std::string interface;
@@ -773,7 +773,7 @@
return true;
}
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
fmt::format("Unable to read Default Power Mode: {}", e.what())
@@ -813,7 +813,7 @@
auto reply = bus.call(method);
reply.read(ipsProperties);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(
fmt::format(
diff --git a/powermode.hpp b/powermode.hpp
index 4cbbf15..1d686fe 100644
--- a/powermode.hpp
+++ b/powermode.hpp
@@ -28,8 +28,8 @@
namespace powermode
{
namespace Base = sdbusplus::xyz::openbmc_project::Control::Power::server;
-using ModeInterface = sdbusplus::server::object::object<Base::Mode>;
-using IpsInterface = sdbusplus::server::object::object<Base::IdlePowerSaver>;
+using ModeInterface = sdbusplus::server::object_t<Base::Mode>;
+using IpsInterface = sdbusplus::server::object_t<Base::IdlePowerSaver>;
using namespace std::literals::string_literals;
constexpr auto PMODE_PATH = "/xyz/openbmc_project/control/host0/power_mode";
@@ -422,7 +422,7 @@
* @param[in] msg - Data associated with pmode change signal
*
*/
- void modeChanged(sdbusplus::message::message& msg);
+ void modeChanged(sdbusplus::message_t& msg);
/** @brief Get the current power mode property
*
@@ -448,7 +448,7 @@
* @param[in] msg - Data associated with IPS change signal
*
*/
- void ipsChanged(sdbusplus::message::message& msg);
+ void ipsChanged(sdbusplus::message_t& msg);
/** @brief Get the Idle Power Saver properties
*
@@ -481,7 +481,7 @@
*
* Called when PowerModeProperties defaults are available
*/
- void defaultsReady(sdbusplus::message::message& msg);
+ void defaultsReady(sdbusplus::message_t& msg);
/** @brief Get the default power mode property for this system type
*
diff --git a/utils.cpp b/utils.cpp
index 78b4234..9c60443 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -214,7 +214,7 @@
stateVal = std::get<std::string>(propertyVal);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
log<level::ERR>(fmt::format("D-Bus call exception, OBJPATH({}), "
"INTERFACE({}), PROPERTY({}) EXCEPTION({})",
diff --git a/utils.hpp b/utils.hpp
index 3a6bad5..8cb8333 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -48,7 +48,7 @@
*
* @return The value of the property(type: variant)
*
- * @throw sdbusplus::exception::exception when it fails
+ * @throw sdbusplus::exception_t when it fails
*/
const PropertyValue getProperty(const std::string& objectPath,
const std::string& interface,
@@ -72,7 +72,7 @@
*
* @return The D-Bus paths from the GetSubTree method
*
- * @throw sdbusplus::exception::exception when it fails
+ * @throw sdbusplus::exception_t when it fails
*/
std::vector<std::string>
getSubtreePaths(const std::vector<std::string>& interfaces,