add .clang-format
Change-Id: I6627b5569c2e0f730be7331403218b823a2c622f
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/ipmi/manualcmds.cpp b/ipmi/manualcmds.cpp
index f86db9e..eabcd0a 100644
--- a/ipmi/manualcmds.cpp
+++ b/ipmi/manualcmds.cpp
@@ -16,16 +16,16 @@
//#include <stdint.h>
+#include "host-ipmid/oemopenbmc.hpp"
+#include "host-ipmid/oemrouter.hpp"
+
#include <map>
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/message.hpp>
#include <string>
#include <tuple>
-#include <sdbusplus/bus.hpp>
-#include <sdbusplus/message.hpp>
-
#include "host-ipmid/ipmid-api.h"
-#include "host-ipmid/oemopenbmc.hpp"
-#include "host-ipmid/oemrouter.hpp"
enum ManualSubCmd
{
@@ -34,12 +34,14 @@
GET_FAILSAFE_STATE = 2,
};
-struct FanCtrlRequest {
+struct FanCtrlRequest
+{
uint8_t command;
uint8_t zone;
} __attribute__((packed));
-struct FanCtrlRequestSet {
+struct FanCtrlRequestSet
+{
uint8_t command;
uint8_t zone;
uint8_t value;
@@ -72,16 +74,14 @@
* a{sv} 2 "Manual" b false "FailSafe" b false
*/
-static ipmi_ret_t
-GetFanCtrlProperty(uint8_t zoneId, bool *value, const std::string &property)
+static ipmi_ret_t GetFanCtrlProperty(uint8_t zoneId, bool* value,
+ const std::string& property)
{
std::string path = GetControlPath(zoneId);
auto propertyReadBus = sdbusplus::bus::new_default();
- auto pimMsg = propertyReadBus.new_method_call(busName,
- path.c_str(),
- propertiesintf,
- "GetAll");
+ auto pimMsg = propertyReadBus.new_method_call(busName, path.c_str(),
+ propertiesintf, "GetAll");
pimMsg.append(intf);
auto valueResponseMsg = propertyReadBus.call(pimMsg);
@@ -103,8 +103,8 @@
return IPMI_CC_OK;
}
-static ipmi_ret_t
-GetFailsafeModeState(const uint8_t* reqBuf, uint8_t* replyBuf, size_t* dataLen)
+static ipmi_ret_t GetFailsafeModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
+ size_t* dataLen)
{
ipmi_ret_t rc = IPMI_CC_OK;
bool current;
@@ -115,7 +115,7 @@
}
const auto request =
- reinterpret_cast<const struct FanCtrlRequest*>(&reqBuf[0]);
+ reinterpret_cast<const struct FanCtrlRequest*>(&reqBuf[0]);
rc = GetFanCtrlProperty(request->zone, ¤t, failsafeProperty);
if (rc)
@@ -134,8 +134,8 @@
* <arg name="properties" direction="out" type="a{sv}"/>
* </method>
*/
-static ipmi_ret_t
-GetManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf, size_t* dataLen)
+static ipmi_ret_t GetManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
+ size_t* dataLen)
{
ipmi_ret_t rc = IPMI_CC_OK;
bool current;
@@ -146,7 +146,7 @@
}
const auto request =
- reinterpret_cast<const struct FanCtrlRequest*>(&reqBuf[0]);
+ reinterpret_cast<const struct FanCtrlRequest*>(&reqBuf[0]);
rc = GetFanCtrlProperty(request->zone, ¤t, manualProperty);
if (rc)
@@ -166,8 +166,8 @@
* <arg name="value" direction="in" type="v"/>
* </method>
*/
-static ipmi_ret_t
-SetManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf, size_t* dataLen)
+static ipmi_ret_t SetManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
+ size_t* dataLen)
{
ipmi_ret_t rc = IPMI_CC_OK;
if (*dataLen < sizeof(struct FanCtrlRequestSet))
@@ -178,20 +178,18 @@
using Value = sdbusplus::message::variant<bool>;
const auto request =
- reinterpret_cast<const struct FanCtrlRequestSet*>(&reqBuf[0]);
+ reinterpret_cast<const struct FanCtrlRequestSet*>(&reqBuf[0]);
/* 0 is false, 1 is true */
bool setValue = static_cast<bool>(request->value);
- Value v {setValue};
+ Value v{setValue};
auto PropertyWriteBus = sdbusplus::bus::new_default();
std::string path = GetControlPath(request->zone);
- auto pimMsg = PropertyWriteBus.new_method_call(busName,
- path.c_str(),
- propertiesintf,
- "Set");
+ auto pimMsg = PropertyWriteBus.new_method_call(busName, path.c_str(),
+ propertiesintf, "Set");
pimMsg.append(intf);
pimMsg.append(manualProperty);
pimMsg.append(v);
@@ -206,12 +204,8 @@
}
/* Three command packages: get, set true, set false */
-static ipmi_ret_t
-ManualModeControl(
- ipmi_cmd_t cmd,
- const uint8_t* reqBuf,
- uint8_t* replyCmdBuf,
- size_t* dataLen)
+static ipmi_ret_t ManualModeControl(ipmi_cmd_t cmd, const uint8_t* reqBuf,
+ uint8_t* replyCmdBuf, size_t* dataLen)
{
ipmi_ret_t rc = IPMI_CC_OK;
// FanCtrlRequest is the smaller of the requests, so it's at a minimum.
@@ -221,7 +215,7 @@
}
const auto request =
- reinterpret_cast<const struct FanCtrlRequest*>(&reqBuf[0]);
+ reinterpret_cast<const struct FanCtrlRequest*>(&reqBuf[0]);
switch (request->command)
{
@@ -246,11 +240,8 @@
fprintf(stderr,
"Registering OEM:[%#08X], Cmd:[%#04X] for Manual Zone Control\n",
- oem::obmcOemNumber,
- oem::Cmd::fanManualCmd);
+ oem::obmcOemNumber, oem::Cmd::fanManualCmd);
- router->registerHandler(
- oem::obmcOemNumber,
- oem::Cmd::fanManualCmd,
- ManualModeControl);
+ router->registerHandler(oem::obmcOemNumber, oem::Cmd::fanManualCmd,
+ ManualModeControl);
}