summaryrefslogtreecommitdiffstats
path: root/occ_pass_through.cpp
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2018-09-14 14:50:03 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-10-18 16:43:22 -0400
commit94df8c9015798764d40665bb363bdbf27510f285 (patch)
treece26611a482f2f03a582838faec29eeb065a6c47 /occ_pass_through.cpp
parent7db89e36d7c5649b826b607cb2d90e38bb02ab86 (diff)
downloadopenpower-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_pass_through.cpp')
-rw-r--r--occ_pass_through.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/occ_pass_through.cpp b/occ_pass_through.cpp
index 424cc22..a92d824 100644
--- a/occ_pass_through.cpp
+++ b/occ_pass_through.cpp
@@ -1,31 +1,31 @@
-#include <memory>
-#include <algorithm>
-#include <fcntl.h>
+#include "config.h"
+
+#include "occ_pass_through.hpp"
+
+#include "elog-errors.hpp"
+
#include <errno.h>
-#include <string>
+#include <fcntl.h>
#include <unistd.h>
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog.hpp>
+
+#include <algorithm>
+#include <memory>
#include <org/open_power/OCC/Device/error.hpp>
-#include "occ_pass_through.hpp"
-#include "elog-errors.hpp"
-#include "config.h"
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <string>
namespace open_power
{
namespace occ
{
-PassThrough::PassThrough(
- sdbusplus::bus::bus& bus,
- const char* path) :
- Iface(bus, path),
- path(path),
+PassThrough::PassThrough(sdbusplus::bus::bus& bus, const char* path) :
+ Iface(bus, path), path(path),
devicePath(OCC_DEV_PATH + std::to_string((this->path.back() - '0') + 1)),
activeStatusSignal(
- bus,
- sdbusRule::propertiesChanged(path, "org.open_power.OCC.Status"),
- std::bind(std::mem_fn(&PassThrough::activeStatusEvent),
- this, std::placeholders::_1))
+ bus, sdbusRule::propertiesChanged(path, "org.open_power.OCC.Status"),
+ std::bind(std::mem_fn(&PassThrough::activeStatusEvent), this,
+ std::placeholders::_1))
{
// Nothing to do.
}
@@ -37,8 +37,8 @@ void PassThrough::openDevice()
if (!occActive)
{
- log<level::INFO>("OCC is inactive; cannot perform pass-through");
- return;
+ log<level::INFO>("OCC is inactive; cannot perform pass-through");
+ return;
}
fd = open(devicePath.c_str(), O_RDWR | O_NONBLOCK);
@@ -46,10 +46,10 @@ void PassThrough::openDevice()
{
// This would log and terminate since its not handled.
elog<OpenFailure>(
- phosphor::logging::org::open_power::OCC::Device::
- OpenFailure::CALLOUT_ERRNO(errno),
- phosphor::logging::org::open_power::OCC::Device::
- OpenFailure::CALLOUT_DEVICE_PATH(devicePath.c_str()));
+ phosphor::logging::org::open_power::OCC::Device::OpenFailure::
+ CALLOUT_ERRNO(errno),
+ phosphor::logging::org::open_power::OCC::Device::OpenFailure::
+ CALLOUT_DEVICE_PATH(devicePath.c_str()));
}
return;
}
@@ -68,7 +68,7 @@ std::vector<int32_t> PassThrough::send(std::vector<int32_t> command)
using namespace phosphor::logging;
using namespace sdbusplus::org::open_power::OCC::Device::Error;
- std::vector<int32_t> response {};
+ std::vector<int32_t> response{};
openDevice();
@@ -85,7 +85,7 @@ std::vector<int32_t> PassThrough::send(std::vector<int32_t> command)
// Populate uint8_t version of vector.
std::transform(command.begin(), command.end(), cmdInBytes.begin(),
- [](decltype(cmdInBytes)::value_type x){return x;});
+ [](decltype(cmdInBytes)::value_type x) { return x; });
ssize_t size = cmdInBytes.size() * sizeof(decltype(cmdInBytes)::value_type);
auto rc = write(fd, cmdInBytes.data(), size);
@@ -93,16 +93,16 @@ std::vector<int32_t> PassThrough::send(std::vector<int32_t> command)
{
// This would log and terminate since its not handled.
elog<WriteFailure>(
- phosphor::logging::org::open_power::OCC::Device::
- WriteFailure::CALLOUT_ERRNO(errno),
- phosphor::logging::org::open_power::OCC::Device::
- WriteFailure::CALLOUT_DEVICE_PATH(devicePath.c_str()));
+ phosphor::logging::org::open_power::OCC::Device::WriteFailure::
+ CALLOUT_ERRNO(errno),
+ phosphor::logging::org::open_power::OCC::Device::WriteFailure::
+ CALLOUT_DEVICE_PATH(devicePath.c_str()));
}
// Now read the response. This would be the content of occ-sram
- while(1)
+ while (1)
{
- uint8_t data {};
+ uint8_t data{};
auto len = read(fd, &data, sizeof(data));
if (len > 0)
{
@@ -123,10 +123,10 @@ std::vector<int32_t> PassThrough::send(std::vector<int32_t> command)
{
// This would log and terminate since its not handled.
elog<ReadFailure>(
- phosphor::logging::org::open_power::OCC::Device::
- ReadFailure::CALLOUT_ERRNO(errno),
- phosphor::logging::org::open_power::OCC::Device::
- ReadFailure::CALLOUT_DEVICE_PATH(devicePath.c_str()));
+ phosphor::logging::org::open_power::OCC::Device::ReadFailure::
+ CALLOUT_ERRNO(errno),
+ phosphor::logging::org::open_power::OCC::Device::ReadFailure::
+ CALLOUT_DEVICE_PATH(devicePath.c_str()));
}
}
OpenPOWER on IntegriCloud