diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2018-09-14 14:50:03 -0500 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-10-18 16:43:22 -0400 |
commit | 94df8c9015798764d40665bb363bdbf27510f285 (patch) | |
tree | ce26611a482f2f03a582838faec29eeb065a6c47 /occ_finder.cpp | |
parent | 7db89e36d7c5649b826b607cb2d90e38bb02ab86 (diff) | |
download | openpower-occ-control-94df8c9015798764d40665bb363bdbf27510f285.tar.gz openpower-occ-control-94df8c9015798764d40665bb363bdbf27510f285.zip |
clang-format: Update to match docs repo
Update the .clang-format file and run clang-format-6.0.
This .clang-format matches the example one in
https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#clang-formatting
Change-Id: Id6760866dedbaeafd83ea8ef2e0303e30b8955aa
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'occ_finder.cpp')
-rw-r--r-- | occ_finder.cpp | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/occ_finder.cpp b/occ_finder.cpp index 0c02c35..a9f98d6 100644 --- a/occ_finder.cpp +++ b/occ_finder.cpp @@ -1,12 +1,14 @@ +#include "config.h" + +#include "occ_finder.hpp" + #include <algorithm> -#include <iterator> #include <experimental/filesystem> -#include <sdbusplus/server.hpp> +#include <iterator> #include <phosphor-logging/elog-errors.hpp> #include <phosphor-logging/log.hpp> +#include <sdbusplus/server.hpp> #include <xyz/openbmc_project/Common/error.hpp> -#include "occ_finder.hpp" -#include "config.h" namespace open_power { namespace occ @@ -23,27 +25,22 @@ constexpr auto toChar(size_t c) } template <typename T> -T getDbusProperty(sdbusplus::bus::bus& bus, - const std::string& service, - const std::string& objPath, - const std::string& interface, +T getDbusProperty(sdbusplus::bus::bus& bus, const std::string& service, + const std::string& objPath, const std::string& interface, const std::string& property) { using namespace sdbusplus::xyz::openbmc_project::Common::Error; constexpr auto PROPERTY_INTF = "org.freedesktop.DBus.Properties"; - auto method = bus.new_method_call( - service.c_str(), - objPath.c_str(), - PROPERTY_INTF, - "Get"); + auto method = bus.new_method_call(service.c_str(), objPath.c_str(), + PROPERTY_INTF, "Get"); method.append(interface, property); auto reply = bus.call(method); if (reply.is_method_error()) { - log<level::ERR>("Failed to get property", + log<level::ERR>("Failed to get property", entry("PROPERTY=%s", property.c_str()), entry("PATH=%s", objPath.c_str()), entry("INTERFACE=%s", interface.c_str())); @@ -65,19 +62,15 @@ std::vector<std::string> get(sdbusplus::bus::bus& bus) using Interfaces = std::vector<Interface>; auto mapper = - bus.new_method_call( - "xyz.openbmc_project.ObjectMapper", - "/xyz/openbmc_project/object_mapper", - "xyz.openbmc_project.ObjectMapper", - "GetSubTree"); + bus.new_method_call("xyz.openbmc_project.ObjectMapper", + "/xyz/openbmc_project/object_mapper", + "xyz.openbmc_project.ObjectMapper", "GetSubTree"); auto depth = 0; Path path = CPU_SUBPATH; - Interfaces interfaces - { + Interfaces interfaces{ "xyz.openbmc_project.Inventory.Item", - "xyz.openbmc_project.State.Decorator.OperationalStatus" - }; + "xyz.openbmc_project.State.Decorator.OperationalStatus"}; mapper.append(path); mapper.append(depth); @@ -110,9 +103,7 @@ std::vector<std::string> get(sdbusplus::bus::bus& bus) { Criteria match{}; match.emplace_back(std::make_tuple( - "xyz.openbmc_project.Inventory.Item", - "Present", - true)); + "xyz.openbmc_project.Inventory.Item", "Present", true)); // Select only if the CPU is marked 'Present'. // Local variable to make it readable @@ -120,8 +111,7 @@ std::vector<std::string> get(sdbusplus::bus::bus& bus) auto service = entry->second.begin()->first; if (matchCriteria(bus, path, service, match)) { - occs.emplace_back(std::string(OCC_NAME) + - toChar(count)); + occs.emplace_back(std::string(OCC_NAME) + toChar(count)); } } } @@ -129,16 +119,13 @@ std::vector<std::string> get(sdbusplus::bus::bus& bus) return occs; } -bool matchCriteria(sdbusplus::bus::bus& bus, - const std::string& path, - const std::string& service, - const Criteria& match) +bool matchCriteria(sdbusplus::bus::bus& bus, const std::string& path, + const std::string& service, const Criteria& match) { - for (const auto& iter: match) + for (const auto& iter : match) { - auto result = getDbusProperty<bool>(bus, service, path, - std::get<0>(iter), - std::get<1>(iter)); + auto result = getDbusProperty<bool>( + bus, service, path, std::get<0>(iter), std::get<1>(iter)); if (result != std::get<2>(iter)) { return false; |