From d1eac88d18ae7dd11033dba87b6aebb220da9064 Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Thu, 29 Mar 2018 10:34:05 -0400 Subject: Enable clang-format Fix up errors and enable clang-format during CI builds. Change-Id: I4176b81f8b85a287af9354165e09ff66aeb9fb29 Signed-off-by: Brad Bishop --- mslverify/util.hpp | 182 +++++++++++++++++------------------------------------ 1 file changed, 58 insertions(+), 124 deletions(-) (limited to 'mslverify/util.hpp') diff --git a/mslverify/util.hpp b/mslverify/util.hpp index 2c26fc2..f487cee 100644 --- a/mslverify/util.hpp +++ b/mslverify/util.hpp @@ -15,7 +15,7 @@ namespace errors = sdbusplus::xyz::openbmc_project::Common::Error; } // namespace detail /** @brief Alias for PropertiesChanged signal callbacks. */ -template +template using Properties = std::map>; namespace sdbusplus @@ -30,31 +30,23 @@ static auto& getBus() } /** @brief Invoke a method. */ -template -static auto callMethod( - ::sdbusplus::bus::bus& bus, - const std::string& busName, - const std::string& path, - const std::string& interface, - const std::string& method, - Args&& ... args) +template +static auto callMethod(::sdbusplus::bus::bus& bus, const std::string& busName, + const std::string& path, const std::string& interface, + const std::string& method, Args&&... args) { - auto reqMsg = bus.new_method_call( - busName.c_str(), - path.c_str(), - interface.c_str(), - method.c_str()); + auto reqMsg = bus.new_method_call(busName.c_str(), path.c_str(), + interface.c_str(), method.c_str()); reqMsg.append(std::forward(args)...); auto respMsg = bus.call(reqMsg); if (respMsg.is_method_error()) { phosphor::logging::log( - "Failed to invoke DBus method.", - phosphor::logging::entry("PATH=%s", path.c_str()), - phosphor::logging::entry( - "INTERFACE=%s", interface.c_str()), - phosphor::logging::entry("METHOD=%s", method.c_str())); + "Failed to invoke DBus method.", + phosphor::logging::entry("PATH=%s", path.c_str()), + phosphor::logging::entry("INTERFACE=%s", interface.c_str()), + phosphor::logging::entry("METHOD=%s", method.c_str())); phosphor::logging::elog(); } @@ -62,90 +54,59 @@ static auto callMethod( } /** @brief Invoke a method. */ -template -static auto callMethod( - const std::string& busName, - const std::string& path, - const std::string& interface, - const std::string& method, - Args&& ... args) +template +static auto callMethod(const std::string& busName, const std::string& path, + const std::string& interface, const std::string& method, + Args&&... args) { - return callMethod( - getBus(), - busName, - path, - interface, - method, - std::forward(args)...); + return callMethod(getBus(), busName, path, interface, method, + std::forward(args)...); } /** @brief Invoke a method and read the response. */ -template -static auto callMethodAndRead( - ::sdbusplus::bus::bus& bus, - const std::string& busName, - const std::string& path, - const std::string& interface, - const std::string& method, - Args&& ... args) +template +static auto + callMethodAndRead(::sdbusplus::bus::bus& bus, const std::string& busName, + const std::string& path, const std::string& interface, + const std::string& method, Args&&... args) { - ::sdbusplus::message::message respMsg = - callMethod( - bus, - busName, - path, - interface, - method, - std::forward(args)...); + ::sdbusplus::message::message respMsg = callMethod( + bus, busName, path, interface, method, std::forward(args)...); Ret resp; respMsg.read(resp); return resp; } /** @brief Invoke a method and read the response. */ - template -static auto callMethodAndRead( - const std::string& busName, - const std::string& path, - const std::string& interface, - const std::string& method, - Args&& ... args) +template +static auto callMethodAndRead(const std::string& busName, + const std::string& path, + const std::string& interface, + const std::string& method, Args&&... args) { - return callMethodAndRead( - getBus(), - busName, - path, - interface, - method, - std::forward(args)...); + return callMethodAndRead(getBus(), busName, path, interface, method, + std::forward(args)...); } - /** @brief Get service from the mapper. */ -static auto getService( - ::sdbusplus::bus::bus& bus, - const std::string& path, - const std::string& interface) +static auto getService(::sdbusplus::bus::bus& bus, const std::string& path, + const std::string& interface) { using namespace std::literals::string_literals; using GetObject = std::map>; auto mapperResp = callMethodAndRead( - bus, - "xyz.openbmc_project.ObjectMapper"s, - "/xyz/openbmc_project/object_mapper"s, - "xyz.openbmc_project.ObjectMapper"s, - "GetObject"s, - path, - GetObject::mapped_type{interface}); + bus, "xyz.openbmc_project.ObjectMapper"s, + "/xyz/openbmc_project/object_mapper"s, + "xyz.openbmc_project.ObjectMapper"s, "GetObject"s, path, + GetObject::mapped_type{interface}); if (mapperResp.empty()) { phosphor::logging::log( - "Object not found.", - phosphor::logging::entry("PATH=%s", path.c_str()), - phosphor::logging::entry( - "INTERFACE=%s", interface.c_str())); + "Object not found.", + phosphor::logging::entry("PATH=%s", path.c_str()), + phosphor::logging::entry("INTERFACE=%s", interface.c_str())); phosphor::logging::elog(); } return mapperResp.begin()->first; @@ -153,23 +114,15 @@ static auto getService( /** @brief Get a property without mapper lookup. */ template -static auto getProperty( - ::sdbusplus::bus::bus& bus, - const std::string& busName, - const std::string& path, - const std::string& interface, - const std::string& property) +static auto getProperty(::sdbusplus::bus::bus& bus, const std::string& busName, + const std::string& path, const std::string& interface, + const std::string& property) { using namespace std::literals::string_literals; - auto msg = callMethod( - bus, - busName, - path, - "org.freedesktop.DBus.Properties"s, - "Get"s, - interface, - property); + auto msg = + callMethod(bus, busName, path, "org.freedesktop.DBus.Properties"s, + "Get"s, interface, property); ::sdbusplus::message::variant value; msg.read(value); return value.template get(); @@ -177,48 +130,29 @@ static auto getProperty( /** @brief Get a property without mapper lookup. */ template -static auto getProperty( - const std::string& busName, - const std::string& path, - const std::string& interface, - const std::string& property) +static auto getProperty(const std::string& busName, const std::string& path, + const std::string& interface, + const std::string& property) { - return getProperty( - getBus(), - busName, - path, - interface, - property); + return getProperty(getBus(), busName, path, interface, property); } /** @brief Get a property with mapper lookup. */ template -static auto getProperty( - ::sdbusplus::bus::bus& bus, - const std::string& path, - const std::string& interface, - const std::string& property) +static auto getProperty(::sdbusplus::bus::bus& bus, const std::string& path, + const std::string& interface, + const std::string& property) { - return getProperty( - bus, - getService(bus, path, interface), - path, - interface, - property); + return getProperty(bus, getService(bus, path, interface), path, + interface, property); } /** @brief Get a property with mapper lookup. */ template -static auto getProperty( - const std::string& path, - const std::string& interface, - const std::string& property) +static auto getProperty(const std::string& path, const std::string& interface, + const std::string& property) { - return getProperty( - getBus(), - path, - interface, - property); + return getProperty(getBus(), path, interface, property); } } // namespace sdbusplus -- cgit v1.2.1