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_errors.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_errors.cpp')
-rw-r--r-- | occ_errors.cpp | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/occ_errors.cpp b/occ_errors.cpp index f4a5f69..ae66a62 100644 --- a/occ_errors.cpp +++ b/occ_errors.cpp @@ -1,13 +1,16 @@ +#include "occ_errors.hpp" + +#include "elog-errors.hpp" + +#include <errno.h> #include <fcntl.h> -#include <unistd.h> #include <sys/ioctl.h> -#include <errno.h> -#include <phosphor-logging/log.hpp> +#include <unistd.h> + +#include <org/open_power/OCC/Device/error.hpp> #include <phosphor-logging/elog.hpp> +#include <phosphor-logging/log.hpp> #include <xyz/openbmc_project/Common/error.hpp> -#include <org/open_power/OCC/Device/error.hpp> -#include "occ_errors.hpp" -#include "elog-errors.hpp" namespace open_power { namespace occ @@ -18,8 +21,8 @@ constexpr auto NO_ERROR = '0'; using namespace phosphor::logging; using namespace sdbusplus::org::open_power::OCC::Device::Error; -using InternalFailure = sdbusplus::xyz::openbmc_project::Common:: - Error::InternalFailure; +using InternalFailure = + sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; // Populate the file descriptor on the error file void Error::openFile() @@ -29,11 +32,10 @@ void Error::openFile() fd = open(file.c_str(), O_RDONLY | O_NONBLOCK); if (fd < 0) { - elog<OpenFailure>( - phosphor::logging::org::open_power::OCC::Device:: - OpenFailure::CALLOUT_ERRNO(errno), - phosphor::logging::org::open_power::OCC::Device:: - OpenFailure::CALLOUT_DEVICE_PATH(file.c_str())); + elog<OpenFailure>(phosphor::logging::org::open_power::OCC::Device:: + OpenFailure::CALLOUT_ERRNO(errno), + phosphor::logging::org::open_power::OCC::Device:: + OpenFailure::CALLOUT_DEVICE_PATH(file.c_str())); } } @@ -41,14 +43,14 @@ void Error::openFile() void Error::registerCallBack() { decltype(eventSource.get()) sourcePtr = nullptr; - auto r = sd_event_add_io(event.get(), &sourcePtr, fd, - EPOLLPRI | EPOLLERR, processEvents, this); + auto r = sd_event_add_io(event.get(), &sourcePtr, fd, EPOLLPRI | EPOLLERR, + processEvents, this); eventSource.reset(sourcePtr); if (r < 0) { log<level::ERR>("Failed to register callback handler", - entry("ERROR=%s", strerror(-r))); + entry("ERROR=%s", strerror(-r))); elog<InternalFailure>(); } } @@ -90,8 +92,8 @@ void Error::removeWatch() } // Callback handler when there is an activity on the FD -int Error::processEvents(sd_event_source* es, int fd, - uint32_t revents, void* userData) +int Error::processEvents(sd_event_source* es, int fd, uint32_t revents, + void* userData) { auto error = static_cast<Error*>(userData); @@ -108,10 +110,10 @@ void Error::analyzeEvent() if (r < 0) { elog<ConfigFailure>( - phosphor::logging::org::open_power::OCC::Device:: - ConfigFailure::CALLOUT_ERRNO(errno), - phosphor::logging::org::open_power::OCC::Device:: - ConfigFailure::CALLOUT_DEVICE_PATH(file.c_str())); + phosphor::logging::org::open_power::OCC::Device::ConfigFailure:: + CALLOUT_ERRNO(errno), + phosphor::logging::org::open_power::OCC::Device::ConfigFailure:: + CALLOUT_DEVICE_PATH(file.c_str())); } // A non-zero data indicates an error condition @@ -128,7 +130,7 @@ void Error::analyzeEvent() // Reads so many bytes as passed in std::string Error::readFile(int len) const { - auto data = std::make_unique<char[]>(len+1); + auto data = std::make_unique<char[]>(len + 1); auto retries = 3; auto delay = std::chrono::milliseconds{100}; @@ -164,10 +166,10 @@ std::string Error::readFile(int len) const { log<level::ERR>("Failure seeking error file to START"); elog<ConfigFailure>( - phosphor::logging::org::open_power::OCC::Device:: - ConfigFailure::CALLOUT_ERRNO(errno), - phosphor::logging::org::open_power::OCC::Device:: - ConfigFailure::CALLOUT_DEVICE_PATH(file.c_str())); + phosphor::logging::org::open_power::OCC::Device::ConfigFailure:: + CALLOUT_ERRNO(errno), + phosphor::logging::org::open_power::OCC::Device::ConfigFailure:: + CALLOUT_DEVICE_PATH(file.c_str())); } return std::string(data.get()); } |