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 * object_path Change-Id: Ief97859630d6532ffe669ce65d07296c12195e30 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/common/test/mocked_utils.hpp b/common/test/mocked_utils.hpp index 4cce83e..ebb1ad9 100644 --- a/common/test/mocked_utils.hpp +++ b/common/test/mocked_utils.hpp
@@ -39,7 +39,7 @@ const char* /*path*/) { return pldm::utils::ObjectValueTree{ - {sdbusplus::message::object_path("/foo/bar"), + {sdbusplus::object_path("/foo/bar"), {{"foo.bar", {{"Functional", true}, {"Enabled", true}, @@ -74,9 +74,8 @@ (const override)); MOCK_METHOD(pldm::utils::GetAssociatedSubTreeResponse, getAssociatedSubTree, - (const sdbusplus::message::object_path&, - const sdbusplus::message::object_path&, int, - const std::vector<std::string>&), + (const sdbusplus::object_path&, const sdbusplus::object_path&, + int, const std::vector<std::string>&), (const override)); MOCK_METHOD(pldm::utils::PropertyMap, getDbusPropertiesVariant,
diff --git a/common/types.hpp b/common/types.hpp index b61184f..874dfd4 100644 --- a/common/types.hpp +++ b/common/types.hpp
@@ -92,7 +92,7 @@ using PropertyMap = std::map<Property, Value>; using InterfaceMap = std::map<Interface, PropertyMap>; -using ObjectValueTree = std::map<sdbusplus::message::object_path, InterfaceMap>; +using ObjectValueTree = std::map<sdbusplus::object_path, InterfaceMap>; } // namespace dbus
diff --git a/common/utils.cpp b/common/utils.cpp index 3dd6e6e..a73d2df 100644 --- a/common/utils.cpp +++ b/common/utils.cpp
@@ -422,8 +422,8 @@ } GetAssociatedSubTreeResponse DBusHandler::getAssociatedSubTree( - const sdbusplus::message::object_path& objectPath, - const sdbusplus::message::object_path& subtree, int depth, + const sdbusplus::object_path& objectPath, + const sdbusplus::object_path& subtree, int depth, const std::vector<std::string>& ifaceList) const { auto& bus = DBusHandler::getBus();
diff --git a/common/utils.hpp b/common/utils.hpp index 10d5ff2..1ba72b1 100644 --- a/common/utils.hpp +++ b/common/utils.hpp
@@ -204,7 +204,7 @@ std::vector<std::pair<ObjectPath, MapperServiceMap>>; using PropertyMap = std::map<std::string, PropertyValue>; using InterfaceMap = std::map<std::string, PropertyMap>; -using ObjectValueTree = std::map<sdbusplus::message::object_path, InterfaceMap>; +using ObjectValueTree = std::map<sdbusplus::object_path, InterfaceMap>; using AttributeName = std::string; using AttributeType = std::string; using AttributeValue = std::variant<std::string, int64_t>; @@ -253,8 +253,8 @@ const char* dbusInterface) const = 0; virtual GetAssociatedSubTreeResponse getAssociatedSubTree( - const sdbusplus::message::object_path& objectPath, - const sdbusplus::message::object_path& subtree, int depth, + const sdbusplus::object_path& objectPath, + const sdbusplus::object_path& subtree, int depth, const std::vector<std::string>& ifaceList) const = 0; }; @@ -395,8 +395,8 @@ * @return GetAssociatedSubtreeResponse - The associated subtree */ GetAssociatedSubTreeResponse getAssociatedSubTree( - const sdbusplus::message::object_path& objectPath, - const sdbusplus::message::object_path& subtree, int depth, + const sdbusplus::object_path& objectPath, + const sdbusplus::object_path& subtree, int depth, const std::vector<std::string>& ifaceList) const override; /** @brief Set Dbus property
diff --git a/fw-update/update.cpp b/fw-update/update.cpp index 5423cf8..91759a6 100644 --- a/fw-update/update.cpp +++ b/fw-update/update.cpp
@@ -7,7 +7,7 @@ namespace fw_update { -sdbusplus::message::object_path Update::startUpdate( +sdbusplus::object_path Update::startUpdate( sdbusplus::message::unix_fd image, ApplyTimeIntf::RequestedApplyTimes applyTime [[maybe_unused]]) { @@ -42,7 +42,7 @@ throw std::runtime_error("Failed to read image file descriptor"); } - return sdbusplus::message::object_path(updateManager->processStreamDefer( + return sdbusplus::object_path(updateManager->processStreamDefer( imageStream, imageStream.str().size())); }
diff --git a/fw-update/update.hpp b/fw-update/update.hpp index e01249f..5cefdcc 100644 --- a/fw-update/update.hpp +++ b/fw-update/update.hpp
@@ -38,7 +38,7 @@ objPath(path) {} - virtual sdbusplus::message::object_path startUpdate( + virtual sdbusplus::object_path startUpdate( sdbusplus::message::unix_fd image, ApplyTimeIntf::RequestedApplyTimes applyTime) override;
diff --git a/libpldmresponder/bios_config.hpp b/libpldmresponder/bios_config.hpp index db8b303..2109592 100644 --- a/libpldmresponder/bios_config.hpp +++ b/libpldmresponder/bios_config.hpp
@@ -235,7 +235,7 @@ interfacesAdded() + argNpath(0, dBusMap->objectPath), [this, biosAttrIndex, interface = dBusMap->interface]( sdbusplus::message_t& msg) { - sdbusplus::message::object_path path; + sdbusplus::object_path path; DbusIfacesAdded interfaces; msg.read(path, interfaces);
diff --git a/libpldmresponder/fru.hpp b/libpldmresponder/fru.hpp index 8e7efdd..056a191 100644 --- a/libpldmresponder/fru.hpp +++ b/libpldmresponder/fru.hpp
@@ -34,7 +34,7 @@ std::vector<uint64_t>, std::vector<std::string>>; using PropertyMap = std::map<Property, Value>; using InterfaceMap = std::map<Interface, PropertyMap>; -using ObjectValueTree = std::map<sdbusplus::message::object_path, InterfaceMap>; +using ObjectValueTree = std::map<sdbusplus::object_path, InterfaceMap>; using ObjectPath = std::string; using AssociatedEntityMap = std::map<ObjectPath, pldm_entity>; using ObjectPathToRSIMap = std::map<ObjectPath, uint16_t>;
diff --git a/libpldmresponder/platform_config.cpp b/libpldmresponder/platform_config.cpp index cd14ef4..d2b6925 100644 --- a/libpldmresponder/platform_config.cpp +++ b/libpldmresponder/platform_config.cpp
@@ -22,7 +22,7 @@ */ void Handler::systemCompatibleCallback(sdbusplus::message_t& msg) { - sdbusplus::message::object_path path; + sdbusplus::object_path path; pldm::utils::InterfaceMap interfaceMap;
diff --git a/libpldmresponder/test/libpldmresponder_fru_test.cpp b/libpldmresponder/test/libpldmresponder_fru_test.cpp index 8eba53d..4b4741e 100644 --- a/libpldmresponder/test/libpldmresponder_fru_test.cpp +++ b/libpldmresponder/test/libpldmresponder_fru_test.cpp
@@ -95,13 +95,12 @@ pldm_entity_association_tree_destroy); ObjectValueTree objects{ - {sdbusplus::message::object_path( - "/xyz/openbmc_project/inventory/system"), + {sdbusplus::object_path("/xyz/openbmc_project/inventory/system"), {{"xyz.openbmc_project.Inventory.Item.System", {}}}}, - {sdbusplus::message::object_path( + {sdbusplus::object_path( "/xyz/openbmc_project/inventory/system/chassis"), {{"xyz.openbmc_project.Inventory.Item.Chassis", {}}}}, - {sdbusplus::message::object_path( + {sdbusplus::object_path( "/xyz/openbmc_project/inventory/system/chassis/motherboard"), {{"xyz.openbmc_project.Inventory.Item.Board.Motherboard", {}}}}};
diff --git a/oem/ibm/libpldmresponder/collect_slot_vpd.cpp b/oem/ibm/libpldmresponder/collect_slot_vpd.cpp index 3a69e00..1095271 100644 --- a/oem/ibm/libpldmresponder/collect_slot_vpd.cpp +++ b/oem/ibm/libpldmresponder/collect_slot_vpd.cpp
@@ -109,8 +109,7 @@ { auto method = bus.new_method_call(service.c_str(), VPDObjPath, VPDInterface, "CollectFRUVPD"); - method.append( - static_cast<sdbusplus::message::object_path>(adapterObjPath)); + method.append(static_cast<sdbusplus::object_path>(adapterObjPath)); bus.call_noreply(method, dbusTimeout); } else if (stateFieldValue == PLDM_OEM_IBM_PCIE_SLOT_EFFECTER_REMOVE || @@ -118,8 +117,7 @@ { auto method = bus.new_method_call(service.c_str(), VPDObjPath, VPDInterface, "deleteFRUVPD"); - method.append( - static_cast<sdbusplus::message::object_path>(adapterObjPath)); + method.append(static_cast<sdbusplus::object_path>(adapterObjPath)); bus.call_noreply(method, dbusTimeout); } }
diff --git a/oem/ibm/libpldmresponder/file_io.hpp b/oem/ibm/libpldmresponder/file_io.hpp index 2ad11c7..fcc0fc5 100644 --- a/oem/ibm/libpldmresponder/file_io.hpp +++ b/oem/ibm/libpldmresponder/file_io.hpp
@@ -253,7 +253,7 @@ std::string, std::map<std::string, std::variant<std::string, uint32_t>>> interfaces; - sdbusplus::message::object_path path; + sdbusplus::object_path path; msg.read(path, interfaces); std::string vspstring; std::string password; @@ -296,7 +296,7 @@ std::string, std::map<std::string, std::variant<std::string, uint32_t>>> interfaces; - sdbusplus::message::object_path path; + sdbusplus::object_path path; msg.read(path, interfaces); std::string csr; @@ -310,8 +310,7 @@ { csr = std::get<std::string>(property.second); auto fileHandle = - sdbusplus::message::object_path(path) - .filename(); + sdbusplus::object_path(path).filename(); dbusToFileHandlers .emplace_back(std::make_unique<
diff --git a/oem/ibm/libpldmresponder/fru_oem_ibm.cpp b/oem/ibm/libpldmresponder/fru_oem_ibm.cpp index 37bb645..4091705 100644 --- a/oem/ibm/libpldmresponder/fru_oem_ibm.cpp +++ b/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
@@ -183,8 +183,8 @@ uakObjPath, VPDManager::interface); auto method = bus.new_method_call( service.c_str(), uakObjPath, VPDManager::interface, "WriteKeyword"); - method.append(static_cast<sdbusplus::message::object_path>(fruPath), - "UTIL", "D8", data); + method.append(static_cast<sdbusplus::object_path>(fruPath), "UTIL", + "D8", data); bus.call_noreply(method, dbusTimeout); } catch (const std::exception& e)
diff --git a/oem/ibm/libpldmresponder/inband_code_update.cpp b/oem/ibm/libpldmresponder/inband_code_update.cpp index e46ddcd..0df46c3 100644 --- a/oem/ibm/libpldmresponder/inband_code_update.cpp +++ b/oem/ibm/libpldmresponder/inband_code_update.cpp
@@ -349,7 +349,7 @@ "member='InterfacesAdded',path='/xyz/openbmc_project/software'", [this](sdbusplus::message_t& msg) { DBusInterfaceAdded interfaces; - sdbusplus::message::object_path path; + sdbusplus::object_path path; msg.read(path, interfaces); for (auto& interface : interfaces)
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp index 895e9eb..6b6def5 100644 --- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp +++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -909,7 +909,7 @@ int pldm::responder::oem_ibm_platform::Handler::checkBMCState() { using BMC = sdbusplus::client::xyz::openbmc_project::state::BMC<>; - auto bmcPath = sdbusplus::message::object_path(BMC::namespace_path::value) / + auto bmcPath = sdbusplus::object_path(BMC::namespace_path::value) / BMC::namespace_path::bmc; try {
diff --git a/oem/ibm/requester/dbus_to_file_handler.cpp b/oem/ibm/requester/dbus_to_file_handler.cpp index 193054b..336b32f 100644 --- a/oem/ibm/requester/dbus_to_file_handler.cpp +++ b/oem/ibm/requester/dbus_to_file_handler.cpp
@@ -24,7 +24,7 @@ DbusToFileHandler::DbusToFileHandler( int /* mctp_fd */, uint8_t mctp_eid, pldm::InstanceIdDb* instanceIdDb, - sdbusplus::message::object_path resDumpCurrentObjPath, + sdbusplus::object_path resDumpCurrentObjPath, pldm::requester::Handler<pldm::requester::Request>* handler) : mctp_eid(mctp_eid), instanceIdDb(instanceIdDb), resDumpCurrentObjPath(resDumpCurrentObjPath), handler(handler)
diff --git a/oem/ibm/requester/dbus_to_file_handler.hpp b/oem/ibm/requester/dbus_to_file_handler.hpp index 7a0e7fe..5c9b351 100644 --- a/oem/ibm/requester/dbus_to_file_handler.hpp +++ b/oem/ibm/requester/dbus_to_file_handler.hpp
@@ -40,7 +40,7 @@ */ DbusToFileHandler( int mctp_fd, uint8_t mctp_eid, pldm::InstanceIdDb* instanceIdDb, - sdbusplus::message::object_path resDumpCurrentObjPath, + sdbusplus::object_path resDumpCurrentObjPath, pldm::requester::Handler<pldm::requester::Request>* handler); /** @brief Process the new resource dump request @@ -87,7 +87,7 @@ pldm::InstanceIdDb* instanceIdDb; /** @brief Hold the current resource dump object path */ - sdbusplus::message::object_path resDumpCurrentObjPath; + sdbusplus::object_path resDumpCurrentObjPath; /** @brief PLDM request handler */ pldm::requester::Handler<pldm::requester::Request>* handler;
diff --git a/platform-mc/numeric_sensor.cpp b/platform-mc/numeric_sensor.cpp index 65441b2..75070e6 100644 --- a/platform-mc/numeric_sensor.cpp +++ b/platform-mc/numeric_sensor.cpp
@@ -963,7 +963,7 @@ } void NumericSensor::clearThresholdLog( - std::optional<sdbusplus::message::object_path>& log) + std::optional<sdbusplus::object_path>& log) { if (!log) { @@ -1002,7 +1002,7 @@ template <typename errorObj> auto logThresholdHelper(const std::string& sensorObjPath, double value, SensorUnit sensorUnit, double threshold) - -> std::optional<sdbusplus::message::object_path> + -> std::optional<sdbusplus::object_path> { return lg2::commit( errorObj("SENSOR_NAME", sensorObjPath, "READING_VALUE", value, "UNITS", @@ -1018,7 +1018,7 @@ * logThresholdHelper with the required error object class */ static const std::map< std::tuple<pldm::utils::Level, pldm::utils::Direction>, - std::function<std::optional<sdbusplus::message::object_path>( + std::function<std::optional<sdbusplus::object_path>( const std::string&, double, SensorUnit, double)>> thresholdEventMap = { {{pldm::utils::Level::WARNING, pldm::utils::Direction::HIGH},
diff --git a/platform-mc/numeric_sensor.hpp b/platform-mc/numeric_sensor.hpp index d481d68..f042dbb 100644 --- a/platform-mc/numeric_sensor.hpp +++ b/platform-mc/numeric_sensor.hpp
@@ -397,7 +397,7 @@ * @param[in/out] log - dbus path to log entry. The log will be resolve * and the optional reset. */ - void clearThresholdLog(std::optional<sdbusplus::message::object_path>& log); + void clearThresholdLog(std::optional<sdbusplus::object_path>& log); /** @brief create a log entry that all sensor alarms have cleared and is now * operating in the normal operating range. @@ -471,7 +471,7 @@ /** @brief An internal mapping of thresholds and its associated log * entry. */ std::map<std::tuple<pldm::utils::Level, pldm::utils::Direction>, - std::optional<sdbusplus::message::object_path>> + std::optional<sdbusplus::object_path>> assertedLog; }; } // namespace platform_mc
diff --git a/requester/mctp_endpoint_discovery.cpp b/requester/mctp_endpoint_discovery.cpp index 00527ee..e660663 100644 --- a/requester/mctp_endpoint_discovery.cpp +++ b/requester/mctp_endpoint_discovery.cpp
@@ -177,7 +177,7 @@ void MctpDiscovery::getAddedMctpInfos(sdbusplus::message_t& msg, MctpInfos& mctpInfos) { - using ObjectPath = sdbusplus::message::object_path; + using ObjectPath = sdbusplus::object_path; ObjectPath objPath; using Property = std::string; using PropertyMap = std::map<Property, dbus::Value>; @@ -451,8 +451,7 @@ std::string associatedObjPath; std::string associatedService; std::string associatedInterface; - sdbusplus::message::object_path inventorySubtreePath( - inventorySubtreePathStr); + sdbusplus::object_path inventorySubtreePath(inventorySubtreePathStr); //"/{board or chassis type}/{board or chassis}/{device}" auto constexpr subTreeDepth = 3;