Update to latest clang-format
Update to clang-format-10
Change-Id: I1c33ef7115c7a1459164d71f63921019d2dc9a98
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/.clang-format b/.clang-format
index dd27708..ef6f54e 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,7 +5,7 @@
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: false
+AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
@@ -14,13 +14,13 @@
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: false
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
+ AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
@@ -29,20 +29,27 @@
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
+ AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DerivePointerAlignment: true
+DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
@@ -51,17 +58,21 @@
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"](gtest|gmock)'
- Priority: 5
+ Priority: 7
- Regex: '^"config.h"'
Priority: -1
- - Regex: '^".*\.hpp"'
+ - Regex: '^".*\.h"'
Priority: 1
- - Regex: '^<.*\.h>'
+ - Regex: '^".*\.hpp"'
Priority: 2
- - Regex: '^<.*'
+ - Regex: '^<.*\.h>'
Priority: 3
- - Regex: '.*'
+ - Regex: '^<.*\.hpp>'
Priority: 4
+ - Regex: '^<.*'
+ Priority: 5
+ - Regex: '.*'
+ Priority: 6
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
@@ -79,12 +90,17 @@
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Right
ReflowComments: true
SortIncludes: true
+SortUsingDeclarations: true
SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
@@ -96,3 +112,4 @@
TabWidth: 4
UseTab: Never
...
+
diff --git a/include/appcommands.hpp b/include/appcommands.hpp
index d350139..f4cd0d6 100644
--- a/include/appcommands.hpp
+++ b/include/appcommands.hpp
@@ -31,13 +31,13 @@
} MetaRevision;
#pragma pack(pop)
-static constexpr const char *versionPurposeBMC =
+static constexpr const char* versionPurposeBMC =
"xyz.openbmc_project.Software.Version.VersionPurpose.BMC";
-static constexpr const char *versionPurposeME =
+static constexpr const char* versionPurposeME =
"xyz.openbmc_project.Software.Version.VersionPurpose.ME";
extern int getActiveSoftwareVersionInfo(ipmi::Context::ptr ctx,
- const std::string &reqVersionPurpose,
- std::string &version);
-extern std::optional<MetaRevision> convertIntelVersion(std::string &s);
+ const std::string& reqVersionPurpose,
+ std::string& version);
+extern std::optional<MetaRevision> convertIntelVersion(std::string& s);
} // namespace ipmi
diff --git a/include/bridgingcommands.hpp b/include/bridgingcommands.hpp
index e8be693..545d24a 100644
--- a/include/bridgingcommands.hpp
+++ b/include/bridgingcommands.hpp
@@ -151,9 +151,9 @@
uint8_t cmd;
std::vector<uint8_t> data;
- IpmbRequest(const ipmbHeader *ipmbBuffer, size_t bufferLength);
+ IpmbRequest(const ipmbHeader* ipmbBuffer, size_t bufferLength);
- void prepareRequest(sdbusplus::message::message &mesg);
+ void prepareRequest(sdbusplus::message::message& mesg);
};
struct IpmbResponse
@@ -170,9 +170,9 @@
IpmbResponse(uint8_t address, uint8_t netFn, uint8_t rqLun, uint8_t rsSA,
uint8_t seq, uint8_t rsLun, uint8_t cmd,
- uint8_t completionCode, std::vector<uint8_t> &inputData);
+ uint8_t completionCode, std::vector<uint8_t>& inputData);
- void ipmbToi2cConstruct(uint8_t *buffer, size_t *bufferLength);
+ void ipmbToi2cConstruct(uint8_t* buffer, size_t* bufferLength);
};
/**
@@ -198,8 +198,8 @@
void clearResponseQueue();
ipmi::Cc handleIpmbChannel(ipmi::Context::ptr ctx, const uint8_t tracking,
- const std::vector<uint8_t> &msgData,
- std::vector<uint8_t> &rspData);
+ const std::vector<uint8_t>& msgData,
+ std::vector<uint8_t>& rspData);
void insertMessageInQueue(IpmbResponse msg);
diff --git a/include/commandutils.hpp b/include/commandutils.hpp
index 3bd23f8..7898be3 100644
--- a/include/commandutils.hpp
+++ b/include/commandutils.hpp
@@ -16,10 +16,11 @@
#pragma once
-#include <iostream>
#include <ipmid/api.hpp>
-#include <map>
#include <sdbusplus/bus.hpp>
+
+#include <iostream>
+#include <map>
#include <string>
#include <tuple>
#include <utility>
diff --git a/include/manufacturingcommands.hpp b/include/manufacturingcommands.hpp
index 3594abb..e46d195 100644
--- a/include/manufacturingcommands.hpp
+++ b/include/manufacturingcommands.hpp
@@ -23,6 +23,7 @@
#include <sdbusplus/message.hpp>
#include <sdbusplus/timer.hpp>
#include <variantvisitors.hpp>
+
#include <vector>
#define FAN_SENSOR_NOT_PRESENT (0 << 0)
@@ -167,8 +168,7 @@
public:
LedProperty(SmSignalSet signal_, std::string name_) :
signal(signal_), name(name_), prevState(""), isLocked(false)
- {
- }
+ {}
LedProperty() = delete;
diff --git a/include/sdrutils.hpp b/include/sdrutils.hpp
index 206f6af..055043a 100644
--- a/include/sdrutils.hpp
+++ b/include/sdrutils.hpp
@@ -19,13 +19,14 @@
#include <boost/algorithm/string.hpp>
#include <boost/bimap.hpp>
#include <boost/container/flat_map.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus/match.hpp>
+
#include <cstdio>
#include <cstring>
#include <exception>
#include <filesystem>
#include <map>
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/bus/match.hpp>
#include <string>
#include <vector>
diff --git a/include/sensorcommands.hpp b/include/sensorcommands.hpp
index 820c746..c0d7853 100644
--- a/include/sensorcommands.hpp
+++ b/include/sensorcommands.hpp
@@ -17,9 +17,10 @@
#pragma once
#include "sdrutils.hpp"
-#include <cstdint>
#include <ipmid/api.hpp>
+#include <cstdint>
+
#pragma pack(push, 1)
struct SensorThresholdResp
@@ -120,8 +121,8 @@
namespace ipmi
{
extern SensorSubTree sensorTree;
-static ipmi_ret_t getSensorConnection(uint8_t sensnum, std::string &connection,
- std::string &path)
+static ipmi_ret_t getSensorConnection(uint8_t sensnum, std::string& connection,
+ std::string& path)
{
if (sensorTree.empty() && !getSensorSubtree(sensorTree))
{
@@ -134,7 +135,7 @@
}
uint8_t sensorIndex = sensnum;
- for (const auto &sensor : sensorTree)
+ for (const auto& sensor : sensorTree)
{
if (sensorIndex-- == 0)
{
diff --git a/include/smbioshandler.hpp b/include/smbioshandler.hpp
index 4e403ca..97ecbb7 100644
--- a/include/smbioshandler.hpp
+++ b/include/smbioshandler.hpp
@@ -15,11 +15,12 @@
*/
#pragma once
-#include <cstddef>
-#include <cstdint>
+#include "ipmid/api.h"
+
#include <oemcommands.hpp>
-#include "ipmid/api.h"
+#include <cstddef>
+#include <cstdint>
constexpr uint16_t msgPayloadSize = 1024 * 60;
diff --git a/include/smbiosmdrv2handler.hpp b/include/smbiosmdrv2handler.hpp
index 3d9b627..71f3677 100644
--- a/include/smbiosmdrv2handler.hpp
+++ b/include/smbiosmdrv2handler.hpp
@@ -21,8 +21,8 @@
#include <oemcommands.hpp>
#include <sdbusplus/timer.hpp>
-static constexpr const char *mdrType2File = "/var/lib/smbios/smbios2";
-static constexpr const char *smbiosPath = "/var/lib/smbios";
+static constexpr const char* mdrType2File = "/var/lib/smbios/smbios2";
+static constexpr const char* smbiosPath = "/var/lib/smbios";
static constexpr const size_t msgPayloadSize =
1024 * 60; // Total size will transfer for smbios table
static constexpr const size_t mdriiSMSize = 0x00100000;
@@ -62,9 +62,9 @@
static constexpr const int lastAgentIndex = -1;
static constexpr const uint16_t lastAgentId = 0xFFFF;
constexpr const uint32_t invalidChecksum = 0xffffffff;
-constexpr const char *dbusProperties = "org.freedesktop.DBus.Properties";
-constexpr const char *mdrv2Path = "/xyz/openbmc_project/Smbios/MDR_V2";
-constexpr const char *mdrv2Interface = "xyz.openbmc_project.Smbios.MDR_V2";
+constexpr const char* dbusProperties = "org.freedesktop.DBus.Properties";
+constexpr const char* mdrv2Path = "/xyz/openbmc_project/Smbios/MDR_V2";
+constexpr const char* mdrv2Interface = "xyz.openbmc_project.Smbios.MDR_V2";
enum class MDR2SMBIOSStatusEnum
{
@@ -120,7 +120,7 @@
uint32_t xferBuff;
uint32_t xferSize;
uint32_t maxDataSize;
- uint8_t *dataStorage;
+ uint8_t* dataStorage;
};
struct Mdr2DirStruct
@@ -240,7 +240,7 @@
}
}
- void *vPtr;
+ void* vPtr;
private:
uint32_t physicalAddr;
@@ -258,23 +258,23 @@
std::make_unique<phosphor::Timer>([&](void) { timeoutHandler(); });
}
- int agentLookup(const uint16_t &agentId);
- int findLockHandle(const uint16_t &lockHandle);
+ int agentLookup(const uint16_t& agentId);
+ int findLockHandle(const uint16_t& lockHandle);
int syncDirCommonData(uint8_t idIndex, uint32_t size,
- const std::string &service);
- int findDataId(const uint8_t *dataInfo, const size_t &len,
- const std::string &service);
- uint16_t getSessionHandle(Mdr2DirStruct *dir);
+ const std::string& service);
+ int findDataId(const uint8_t* dataInfo, const size_t& len,
+ const std::string& service);
+ uint16_t getSessionHandle(Mdr2DirStruct* dir);
bool smbiosIsUpdating(uint8_t index);
- uint32_t calcChecksum32(uint8_t *buf, uint32_t len);
- bool storeDatatoFlash(MDRSMBIOSHeader *mdrHdr, uint8_t *data);
+ uint32_t calcChecksum32(uint8_t* buf, uint32_t len);
+ bool storeDatatoFlash(MDRSMBIOSHeader* mdrHdr, uint8_t* data);
bool smbiosUnlock(uint8_t index);
void timeoutHandler();
- bool smbiosTryLock(uint8_t flag, uint8_t index, uint16_t *session,
+ bool smbiosTryLock(uint8_t flag, uint8_t index, uint16_t* session,
uint16_t timeout);
- int sdplusMdrv2GetProperty(const std::string &name,
- std::variant<uint8_t> &value,
- const std::string &service);
+ int sdplusMdrv2GetProperty(const std::string& name,
+ std::variant<uint8_t>& value,
+ const std::string& service);
Mdr2DirStruct smbiosDir{smbiosAgentVersion,
1,
diff --git a/include/storagecommands.hpp b/include/storagecommands.hpp
index 2055bd0..c9e2bd2 100644
--- a/include/storagecommands.hpp
+++ b/include/storagecommands.hpp
@@ -15,9 +15,10 @@
*/
#pragma once
-#include <cstdint>
#include <phosphor-ipmi-host/sensorhandler.hpp>
+#include <cstdint>
+
static constexpr uint8_t ipmiSdrVersion = 0x51;
namespace intel_oem::ipmi::sel
diff --git a/include/variantvisitors.hpp b/include/variantvisitors.hpp
index a440bfc..b24481c 100644
--- a/include/variantvisitors.hpp
+++ b/include/variantvisitors.hpp
@@ -15,9 +15,10 @@
*/
#pragma once
+#include <sdbusplus/bus.hpp>
+
#include <cstdint>
#include <limits>
-#include <sdbusplus/bus.hpp>
namespace ipmi
{
diff --git a/non-yocto/phosphor-logging/elog-errors.hpp b/non-yocto/phosphor-logging/elog-errors.hpp
index b87236a..75ef68d 100644
--- a/non-yocto/phosphor-logging/elog-errors.hpp
+++ b/non-yocto/phosphor-logging/elog-errors.hpp
@@ -5,6 +5,7 @@
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/exception.hpp>
+
#include <string>
#include <tuple>
#include <type_traits>
@@ -658,9 +659,7 @@
namespace Host
{
namespace _CommandNotSupported
-{
-
-} // namespace _CommandNotSupported
+{} // namespace _CommandNotSupported
struct CommandNotSupported
{
@@ -788,9 +787,7 @@
namespace ThermalEvent
{
namespace _Processor
-{
-
-} // namespace _Processor
+{} // namespace _Processor
struct Processor
{
@@ -827,9 +824,7 @@
namespace ThermalEvent
{
namespace _GPU
-{
-
-} // namespace _GPU
+{} // namespace _GPU
struct GPU
{
@@ -864,9 +859,7 @@
namespace Create
{
namespace _Disabled
-{
-
-} // namespace _Disabled
+{} // namespace _Disabled
struct Disabled
{
@@ -987,9 +980,7 @@
namespace Common
{
namespace _InternalFailure
-{
-
-} // namespace _InternalFailure
+{} // namespace _InternalFailure
struct InternalFailure
{
@@ -1072,9 +1063,7 @@
namespace Common
{
namespace _InsufficientPermission
-{
-
-} // namespace _InsufficientPermission
+{} // namespace _InsufficientPermission
struct InsufficientPermission
{
@@ -1107,9 +1096,7 @@
namespace Common
{
namespace _UserNameExists
-{
-
-} // namespace _UserNameExists
+{} // namespace _UserNameExists
struct UserNameExists
{
@@ -1143,9 +1130,7 @@
namespace Common
{
namespace _UserNameDoesNotExist
-{
-
-} // namespace _UserNameDoesNotExist
+{} // namespace _UserNameDoesNotExist
struct UserNameDoesNotExist
{
@@ -1781,9 +1766,7 @@
namespace Device
{
namespace _ReadFailure
-{
-
-} // namespace _ReadFailure
+{} // namespace _ReadFailure
struct ReadFailure
{
@@ -1821,9 +1804,7 @@
namespace Device
{
namespace _WriteFailure
-{
-
-} // namespace _WriteFailure
+{} // namespace _WriteFailure
struct WriteFailure
{
@@ -2051,9 +2032,7 @@
namespace Inventory
{
namespace _Fan
-{
-
-} // namespace _Fan
+{} // namespace _Fan
struct Fan
{
@@ -2090,9 +2069,7 @@
namespace Power
{
namespace _Fault
-{
-
-} // namespace _Fault
+{} // namespace _Fault
struct Fault
{
@@ -2127,9 +2104,7 @@
namespace Device
{
namespace _ReadFailure
-{
-
-} // namespace _ReadFailure
+{} // namespace _ReadFailure
struct ReadFailure
{
@@ -2167,9 +2142,7 @@
namespace Host
{
namespace _SoftOffTimeout
-{
-
-} // namespace _SoftOffTimeout
+{} // namespace _SoftOffTimeout
struct SoftOffTimeout
{
@@ -2203,9 +2176,7 @@
namespace Inventory
{
namespace _NotPresent
-{
-
-} // namespace _NotPresent
+{} // namespace _NotPresent
struct NotPresent
{
@@ -2238,9 +2209,7 @@
namespace Inventory
{
namespace _Nonfunctional
-{
-
-} // namespace _Nonfunctional
+{} // namespace _Nonfunctional
struct Nonfunctional
{
@@ -2275,9 +2244,7 @@
namespace Device
{
namespace _WriteFailure
-{
-
-} // namespace _WriteFailure
+{} // namespace _WriteFailure
struct WriteFailure
{
diff --git a/src/appcommands.cpp b/src/appcommands.cpp
index 8b37a1f..10e3d13 100644
--- a/src/appcommands.cpp
+++ b/src/appcommands.cpp
@@ -16,11 +16,12 @@
#include <byteswap.h>
#include <appcommands.hpp>
-#include <fstream>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
+
+#include <fstream>
#include <regex>
namespace ipmi
diff --git a/src/bmccontrolservices.cpp b/src/bmccontrolservices.cpp
index 5073149..418deb4 100644
--- a/src/bmccontrolservices.cpp
+++ b/src/bmccontrolservices.cpp
@@ -20,6 +20,7 @@
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
#include <phosphor-logging/log.hpp>
+
#include <variant>
namespace ipmi
diff --git a/src/bridgingcommands.cpp b/src/bridgingcommands.cpp
index 3220474..2f2c3fa 100644
--- a/src/bridgingcommands.cpp
+++ b/src/bridgingcommands.cpp
@@ -14,9 +14,7 @@
// limitations under the License.
*/
-#include <bitset>
#include <bridgingcommands.hpp>
-#include <cstring>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
#include <manufacturingcommands.hpp>
@@ -25,18 +23,21 @@
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/message.hpp>
#include <storagecommands.hpp>
+
+#include <bitset>
+#include <cstring>
#include <vector>
-static constexpr const char *wdtService = "xyz.openbmc_project.Watchdog";
-static constexpr const char *wdtInterface =
+static constexpr const char* wdtService = "xyz.openbmc_project.Watchdog";
+static constexpr const char* wdtInterface =
"xyz.openbmc_project.State.Watchdog";
-static constexpr const char *wdtObjPath = "/xyz/openbmc_project/watchdog/host0";
-static constexpr const char *wdtInterruptFlagProp =
+static constexpr const char* wdtObjPath = "/xyz/openbmc_project/watchdog/host0";
+static constexpr const char* wdtInterruptFlagProp =
"PreTimeoutInterruptOccurFlag";
-static constexpr const char *ipmbBus = "xyz.openbmc_project.Ipmi.Channel.Ipmb";
-static constexpr const char *ipmbObj = "/xyz/openbmc_project/Ipmi/Channel/Ipmb";
-static constexpr const char *ipmbIntf = "org.openbmc.Ipmb";
+static constexpr const char* ipmbBus = "xyz.openbmc_project.Ipmi.Channel.Ipmb";
+static constexpr const char* ipmbObj = "/xyz/openbmc_project/Ipmi/Channel/Ipmb";
+static constexpr const char* ipmbIntf = "org.openbmc.Ipmb";
static Bridging bridging;
static bool eventMessageBufferFlag = false;
@@ -49,7 +50,7 @@
/**
* @brief utils for checksum
*/
-static bool ipmbChecksumValidate(const uint8_t *data, uint8_t length)
+static bool ipmbChecksumValidate(const uint8_t* data, uint8_t length)
{
if (data == nullptr)
{
@@ -71,7 +72,7 @@
return false;
}
-static uint8_t ipmbChecksumCompute(uint8_t *data, uint8_t length)
+static uint8_t ipmbChecksumCompute(uint8_t* data, uint8_t length)
{
if (data == nullptr)
{
@@ -90,21 +91,21 @@
}
static inline bool
- ipmbConnectionHeaderChecksumValidate(const ipmbHeader *ipmbHeader)
+ ipmbConnectionHeaderChecksumValidate(const ipmbHeader* ipmbHeader)
{
- return ipmbChecksumValidate(reinterpret_cast<const uint8_t *>(ipmbHeader),
+ return ipmbChecksumValidate(reinterpret_cast<const uint8_t*>(ipmbHeader),
ipmbConnectionHeaderLength);
}
-static inline bool ipmbDataChecksumValidate(const ipmbHeader *ipmbHeader,
+static inline bool ipmbDataChecksumValidate(const ipmbHeader* ipmbHeader,
uint8_t length)
{
- return ipmbChecksumValidate((reinterpret_cast<const uint8_t *>(ipmbHeader) +
+ return ipmbChecksumValidate((reinterpret_cast<const uint8_t*>(ipmbHeader) +
ipmbConnectionHeaderLength),
(length - ipmbConnectionHeaderLength));
}
-static bool isFrameValid(const ipmbHeader *frame, uint8_t length)
+static bool isFrameValid(const ipmbHeader* frame, uint8_t length)
{
if ((length < ipmbMinFrameLength) || (length > ipmbMaxFrameLength))
{
@@ -124,7 +125,7 @@
return true;
}
-IpmbRequest::IpmbRequest(const ipmbHeader *ipmbBuffer, size_t bufferLength)
+IpmbRequest::IpmbRequest(const ipmbHeader* ipmbBuffer, size_t bufferLength)
{
address = ipmbBuffer->Header.Req.address;
netFn = ipmbNetFnGet(ipmbBuffer->Header.Req.rsNetFnLUN);
@@ -148,7 +149,7 @@
IpmbResponse::IpmbResponse(uint8_t address, uint8_t netFn, uint8_t rqLun,
uint8_t rsSA, uint8_t seq, uint8_t rsLun,
uint8_t cmd, uint8_t completionCode,
- std::vector<uint8_t> &inputData) :
+ std::vector<uint8_t>& inputData) :
address(address),
netFn(netFn), rqLun(rqLun), rsSA(rsSA), seq(seq), rsLun(rsLun), cmd(cmd),
completionCode(completionCode)
@@ -161,9 +162,9 @@
}
}
-void IpmbResponse::ipmbToi2cConstruct(uint8_t *buffer, size_t *bufferLength)
+void IpmbResponse::ipmbToi2cConstruct(uint8_t* buffer, size_t* bufferLength)
{
- ipmbHeader *ipmbBuffer = (ipmbHeader *)buffer;
+ ipmbHeader* ipmbBuffer = (ipmbHeader*)buffer;
ipmbBuffer->Header.Resp.address = address;
ipmbBuffer->Header.Resp.rqNetFnLUN = ipmbNetFnLunSet(netFn, rqLun);
@@ -190,7 +191,7 @@
(ipmbResponseDataHeaderLength + data.size()));
}
-void IpmbRequest::prepareRequest(sdbusplus::message::message &mesg)
+void IpmbRequest::prepareRequest(sdbusplus::message::message& mesg)
{
mesg.append(ipmbMeChannelNum, netFn, rqLun, cmd, data);
}
@@ -240,8 +241,8 @@
ipmi::Cc Bridging::handleIpmbChannel(ipmi::Context::ptr ctx,
const uint8_t tracking,
- const std::vector<uint8_t> &msgData,
- std::vector<uint8_t> &rspData)
+ const std::vector<uint8_t>& msgData,
+ std::vector<uint8_t>& rspData)
{
ipmi::Manufacturing mtm;
@@ -259,7 +260,7 @@
return ipmi::ccInsufficientPrivilege;
}
- auto sendMsgReqData = reinterpret_cast<const ipmbHeader *>(msgData.data());
+ auto sendMsgReqData = reinterpret_cast<const ipmbHeader*>(msgData.data());
// allow bridging to ME only
if (sendMsgReqData->Header.Req.address != ipmbMeSlaveAddress)
@@ -394,7 +395,7 @@
ipmiAppSendMessage(ipmi::Context::ptr ctx, const uint4_t channelNumber,
const bool authenticationEnabled,
const bool encryptionEnabled, const uint2_t tracking,
- ipmi::message::Payload &msg)
+ ipmi::message::Payload& msg)
{
// check message fields:
// encryption not supported
@@ -546,7 +547,7 @@
getMsgFlagsRes.set(getMsgFlagWatchdogPreTimeOutBit);
}
}
- catch (sdbusplus::exception::SdBusError &e)
+ catch (sdbusplus::exception::SdBusError& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiAppGetMessageFlags, dbus call exception");
@@ -595,7 +596,7 @@
ipmi::setDbusProperty(*dbus, wdtService, wdtObjPath, wdtInterface,
wdtInterruptFlagProp, false);
}
- catch (const sdbusplus::exception::SdBusError &e)
+ catch (const sdbusplus::exception::SdBusError& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiAppClearMessageFlags: can't Clear/Set "
diff --git a/src/chassiscommands.cpp b/src/chassiscommands.cpp
index 24e3322..1ff29c2 100644
--- a/src/chassiscommands.cpp
+++ b/src/chassiscommands.cpp
@@ -15,18 +15,19 @@
*/
#include "xyz/openbmc_project/Common/error.hpp"
-#include <fstream>
-#include <iostream>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
#include <nlohmann/json.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
-#include <regex>
#include <sdbusplus/timer.hpp>
+#include <xyz/openbmc_project/Control/Power/RestorePolicy/server.hpp>
+
+#include <fstream>
+#include <iostream>
+#include <regex>
#include <stdexcept>
#include <string_view>
-#include <xyz/openbmc_project/Control/Power/RestorePolicy/server.hpp>
using namespace phosphor::logging;
diff --git a/src/firmware-update.cpp b/src/firmware-update.cpp
index afb1662..04ed4e9 100644
--- a/src/firmware-update.cpp
+++ b/src/firmware-update.cpp
@@ -11,21 +11,22 @@
#include <boost/process/child.hpp>
#include <boost/uuid/random_generator.hpp>
#include <boost/uuid/uuid_io.hpp>
-#include <chrono>
#include <commandutils.hpp>
-#include <cstdint>
-#include <filesystem>
-#include <fstream>
-#include <iostream>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
-#include <map>
#include <phosphor-logging/log.hpp>
-#include <random>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/server/object.hpp>
#include <sdbusplus/timer.hpp>
+
+#include <chrono>
+#include <cstdint>
+#include <filesystem>
+#include <fstream>
+#include <iostream>
+#include <map>
+#include <random>
#ifdef INTEL_PFR_ENABLED
#include <spiDev.hpp>
#endif
@@ -68,11 +69,11 @@
}
} // namespace ipmi
-static constexpr const char *bmcStateIntf = "xyz.openbmc_project.State.BMC";
-static constexpr const char *bmcStatePath = "/xyz/openbmc_project/state/bmc0";
-static constexpr const char *bmcStateReady =
+static constexpr const char* bmcStateIntf = "xyz.openbmc_project.State.BMC";
+static constexpr const char* bmcStatePath = "/xyz/openbmc_project/state/bmc0";
+static constexpr const char* bmcStateReady =
"xyz.openbmc_project.State.BMC.BMCState.Ready";
-static constexpr const char *bmcStateUpdateInProgress =
+static constexpr const char* bmcStateUpdateInProgress =
"xyz.openbmc_project.State.BMC.BMCState.UpdateInProgress";
static constexpr char firmwareBufferFile[] = "/tmp/fw-download.bin";
@@ -92,8 +93,8 @@
bool block0Mapped = false;
static constexpr uint32_t perBlock0MagicNum = 0xB6EAFD19;
-static constexpr const char *bmcActivePfmMTDDev = "/dev/mtd/pfm";
-static constexpr const char *bmcRecoveryImgMTDDev = "/dev/mtd/rc-image";
+static constexpr const char* bmcActivePfmMTDDev = "/dev/mtd/pfm";
+static constexpr const char* bmcRecoveryImgMTDDev = "/dev/mtd/rc-image";
static constexpr size_t pfmBaseOffsetInImage = 0x400;
static constexpr size_t rootkeyOffsetInPfm = 0xA0;
static constexpr size_t cskKeyOffsetInPfm = 0x124;
@@ -101,7 +102,7 @@
static constexpr size_t certKeyLen = 96;
static constexpr size_t cskSignatureLen = 96;
-static constexpr const char *versionIntf =
+static constexpr const char* versionIntf =
"xyz.openbmc_project.Software.Version";
enum class FwGetRootCertDataTag : uint8_t
@@ -118,7 +119,7 @@
bmcRecoveryImage,
};
-const static boost::container::flat_map<FWDeviceIDTag, const char *>
+const static boost::container::flat_map<FWDeviceIDTag, const char*>
fwVersionIdMap{{FWDeviceIDTag::bmcActiveImage,
"/xyz/openbmc_project/software/bmc_active"},
{FWDeviceIDTag::bmcRecoveryImage,
@@ -179,15 +180,14 @@
};
protected:
- EVP_MD_CTX *ctx;
+ EVP_MD_CTX* ctx;
std::vector<uint8_t> expectedHash;
enum HashCheck check;
bool started;
public:
TransferHashCheck() : check(HashCheck::notRequested), started(false)
- {
- }
+ {}
~TransferHashCheck()
{
if (ctx)
@@ -196,14 +196,14 @@
ctx = NULL;
}
}
- void init(const std::vector<uint8_t> &expected)
+ void init(const std::vector<uint8_t>& expected)
{
expectedHash = expected;
check = HashCheck::requested;
ctx = EVP_MD_CTX_create();
EVP_DigestInit(ctx, EVP_sha256());
}
- void hash(const std::vector<uint8_t> &data)
+ void hash(const std::vector<uint8_t>& data)
{
if (!started)
{
@@ -259,7 +259,7 @@
class MappedFile
{
public:
- MappedFile(const std::string &fname) : addr(nullptr), fsize(0)
+ MappedFile(const std::string& fname) : addr(nullptr), fsize(0)
{
std::error_code ec;
size_t sz = std::filesystem::file_size(fname, ec);
@@ -268,7 +268,7 @@
{
return;
}
- void *tmp = mmap(NULL, sz, PROT_READ, MAP_SHARED, fd, 0);
+ void* tmp = mmap(NULL, sz, PROT_READ, MAP_SHARED, fd, 0);
close(fd);
if (tmp == MAP_FAILED)
{
@@ -285,9 +285,9 @@
munmap(addr, fsize);
}
}
- const uint8_t *data() const
+ const uint8_t* data() const
{
- return static_cast<const uint8_t *>(addr);
+ return static_cast<const uint8_t*>(addr);
}
size_t size() const
{
@@ -296,7 +296,7 @@
private:
size_t fsize;
- void *addr;
+ void* addr;
};
class FwUpdateStatusCache
@@ -351,7 +351,7 @@
{
return progressPercent;
}
- void updateActivationPercent(const std::string &objPath)
+ void updateActivationPercent(const std::string& objPath)
{
std::shared_ptr<sdbusplus::asio::connection> busp = getSdBus();
fwUpdateState = fwStateProgram;
@@ -360,7 +360,7 @@
*busp,
sdbusplus::bus::match::rules::propertiesChanged(
objPath, "xyz.openbmc_project.Software.ActivationProgress"),
- [&](sdbusplus::message::message &msg) {
+ [&](sdbusplus::message::message& msg) {
std::map<std::string, ipmi::DbusVariant> props;
std::vector<std::string> inVal;
std::string iface;
@@ -368,7 +368,7 @@
{
msg.read(iface, props, inVal);
}
- catch (const std::exception &e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Exception caught in get ActivationProgress");
@@ -435,7 +435,7 @@
static FwUpdateStatusCache fwUpdateStatus;
std::shared_ptr<TransferHashCheck> xferHashCheck;
-static void activateImage(const std::string &objPath)
+static void activateImage(const std::string& objPath)
{
// If flag is false means to reboot
if (fwUpdateStatus.getDeferRestart() == false)
@@ -479,7 +479,7 @@
std::string bmcState = std::get<std::string>(state);
return (bmcState == bmcStateUpdateInProgress);
}
- catch (const std::exception &e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Exception caught while getting BMC state.",
@@ -504,7 +504,7 @@
ipmi::setDbusProperty(*busp, service, bmcStatePath, bmcStateIntf,
"CurrentBMCState", bmcState);
}
- catch (const std::exception &e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Exception caught while setting BMC state.",
@@ -520,7 +520,7 @@
* @param[in] ctx - context of current session.
* @returns true if the medium is IPMB else return true.
**/
-ipmi::Cc checkIPMBChannel(const ipmi::Context::ptr &ctx, bool &isIPMBChannel)
+ipmi::Cc checkIPMBChannel(const ipmi::Context::ptr& ctx, bool& isIPMBChannel)
{
ipmi::ChannelInfo chInfo;
@@ -541,7 +541,7 @@
}
static void postTransferCompleteHandler(
- std::unique_ptr<sdbusplus::bus::match::match> &fwUpdateMatchSignal)
+ std::unique_ptr<sdbusplus::bus::match::match>& fwUpdateMatchSignal)
{
// Setup timer for watching signal
static phosphor::Timer timer(
@@ -559,7 +559,7 @@
timer.start(std::chrono::microseconds(5000000), false);
// callback function for capturing signal
- auto callback = [&](sdbusplus::message::message &m) {
+ auto callback = [&](sdbusplus::message::message& m) {
bool flag = false;
std::vector<std::pair<
@@ -573,7 +573,7 @@
m.read(objPath, intfPropsPair); // Read in the object path
// that was just created
}
- catch (const std::exception &e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Exception caught in reading created object path.");
@@ -583,7 +583,7 @@
phosphor::logging::log<phosphor::logging::level::INFO>(
"New Interface Added.",
phosphor::logging::entry("OBJPATH=%s", objPath.str.c_str()));
- for (auto &interface : intfPropsPair)
+ for (auto& interface : intfPropsPair)
{
if (interface.first == "xyz.openbmc_project.Software.Activation")
{
@@ -604,7 +604,7 @@
activationStatusTimer.start(
std::chrono::microseconds(3000000), true);
}
- catch (const std::exception &e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Exception caught in start activationStatusTimer.",
@@ -624,7 +624,7 @@
"member='InterfacesAdded',path='/xyz/openbmc_project/software'",
callback);
}
-static bool startFirmwareUpdate(const std::string &uri)
+static bool startFirmwareUpdate(const std::string& uri)
{
// fwupdate URIs start with file:// or usb:// or tftp:// etc. By the time
// the code gets to this point, the file should be transferred start the
@@ -638,7 +638,7 @@
return true;
}
-static int transferImageFromFile(const std::string &uri, bool move = true)
+static int transferImageFromFile(const std::string& uri, bool move = true)
{
std::error_code ec;
phosphor::logging::log<phosphor::logging::level::INFO>(
@@ -669,14 +669,14 @@
}
template <typename... ArgTypes>
-static int executeCmd(const char *path, ArgTypes &&... tArgs)
+static int executeCmd(const char* path, ArgTypes&&... tArgs)
{
- boost::process::child execProg(path, const_cast<char *>(tArgs)...);
+ boost::process::child execProg(path, const_cast<char*>(tArgs)...);
execProg.wait();
return execProg.exit_code();
}
-static int transferImageFromUsb(const std::string &uri)
+static int transferImageFromUsb(const std::string& uri)
{
int ret, sysret;
char fwpath[fwPathMaxLength];
@@ -697,7 +697,7 @@
return ret;
}
-static bool transferFirmwareFromUri(const std::string &uri)
+static bool transferFirmwareFromUri(const std::string& uri)
{
static constexpr char fwUriFile[] = "file://";
static constexpr char fwUriUsb[] = "usb://";
@@ -761,7 +761,7 @@
constexpr uint8_t undefinedImage = 0x00;
constexpr uint8_t primaryImage = 0x01;
constexpr uint8_t secondaryImage = 0x02;
- constexpr const char *secondaryFitImageStartAddr = "22480000";
+ constexpr const char* secondaryFitImageStartAddr = "22480000";
uint8_t bootImage = primaryImage;
boost::system::error_code ec;
@@ -805,7 +805,7 @@
std::vector<fwVersionInfoType> fwVerInfoList;
std::shared_ptr<sdbusplus::asio::connection> busp = getSdBus();
- for (const auto &fwDev : fwVersionIdMap)
+ for (const auto& fwDev : fwVersionIdMap)
{
std::string verStr;
try
@@ -816,7 +816,7 @@
*busp, service, fwDev.second, versionIntf, "Version");
verStr = std::get<std::string>(result);
}
- catch (const std::exception &e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::INFO>(
"Failed to fetch Version property",
@@ -856,7 +856,7 @@
minorNum = std::stoul(splitVer[1], nullptr, 16);
buildNum = std::stoul(splitVer[2], nullptr, 16);
}
- catch (const std::exception &e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::INFO>(
"Failed to convert stoul.",
@@ -885,7 +885,7 @@
ipmi::RspType<std::array<uint8_t, certKeyLen>,
std::optional<std::array<uint8_t, cskSignatureLen>>>
- ipmiGetFwRootCertData(const ipmi::Context::ptr &ctx, uint8_t certId)
+ ipmiGetFwRootCertData(const ipmi::Context::ptr& ctx, uint8_t certId)
{
bool isIPMBChannel = false;
@@ -953,7 +953,7 @@
return ipmi::responseSuccess(certKey, cskSignature);
}
}
- catch (const std::exception &e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Exception caught in ipmiGetFwRootCertData",
@@ -1016,7 +1016,7 @@
* - random number
**/
ipmi::RspType<std::array<uint8_t, fwRandomNumLength>>
- ipmiGetFwUpdateRandomNumber(const ipmi::Context::ptr &ctx)
+ ipmiGetFwUpdateRandomNumber(const ipmi::Context::ptr& ctx)
{
phosphor::logging::log<phosphor::logging::level::INFO>(
"Generate FW update random number");
@@ -1057,8 +1057,8 @@
* @returns IPMI completion code
**/
ipmi::RspType<>
- ipmiSetFirmwareUpdateMode(const ipmi::Context::ptr &ctx,
- std::array<uint8_t, fwRandomNumLength> &randNum)
+ ipmiSetFirmwareUpdateMode(const ipmi::Context::ptr& ctx,
+ std::array<uint8_t, fwRandomNumLength>& randNum)
{
phosphor::logging::log<phosphor::logging::level::INFO>(
"Start FW update mode");
@@ -1107,13 +1107,13 @@
return ipmi::responseBusy();
}
}
- catch (const std::exception &e)
+ catch (const std::exception& e)
{
return ipmi::responseUnspecifiedError();
}
// FIXME? c++ doesn't off an option for exclusive file creation
- FILE *fp = fopen(firmwareBufferFile, "wx");
+ FILE* fp = fopen(firmwareBufferFile, "wx");
if (!fp)
{
phosphor::logging::log<phosphor::logging::level::INFO>(
@@ -1126,7 +1126,7 @@
{
setFirmwareUpdateMode(true);
}
- catch (const std::exception &e)
+ catch (const std::exception& e)
{
unlink(firmwareBufferFile);
return ipmi::responseUnspecifiedError();
@@ -1140,7 +1140,7 @@
*
* @returns IPMI completion code
*/
-ipmi::RspType<> ipmiExitFirmwareUpdateMode(const ipmi::Context::ptr &ctx)
+ipmi::RspType<> ipmiExitFirmwareUpdateMode(const ipmi::Context::ptr& ctx)
{
phosphor::logging::log<phosphor::logging::level::INFO>(
"Exit FW update mode");
@@ -1181,7 +1181,7 @@
{
setFirmwareUpdateMode(false);
}
- catch (const std::exception &e)
+ catch (const std::exception& e)
{
return ipmi::responseUnspecifiedError();
}
@@ -1199,9 +1199,9 @@
* - Byte 2: Current control status
**/
ipmi::RspType<bool, bool, bool, bool, uint4_t>
- ipmiGetSetFirmwareUpdateControl(const ipmi::Context::ptr &ctx,
+ ipmiGetSetFirmwareUpdateControl(const ipmi::Context::ptr& ctx,
const uint8_t controlReq,
- const std::optional<std::string> &fileName)
+ const std::optional<std::string>& fileName)
{
bool isIPMBChannel = false;
@@ -1404,7 +1404,7 @@
}
ipmi::RspType<bool, bool, bool, uint5_t> ipmiSetFirmwareUpdateOptions(
- const ipmi::Context::ptr &ctx, bool noDowngradeMask, bool deferRestartMask,
+ const ipmi::Context::ptr& ctx, bool noDowngradeMask, bool deferRestartMask,
bool sha2CheckMask, uint5_t reserved1, bool noDowngrade, bool deferRestart,
bool sha2Check, uint5_t reserved2,
std::optional<std::vector<uint8_t>> integrityCheckVal)
@@ -1463,7 +1463,7 @@
}
ipmi::RspType<uint32_t>
- ipmiFwImageWriteData(const std::vector<uint8_t> &writeData)
+ ipmiFwImageWriteData(const std::vector<uint8_t>& writeData)
{
const uint8_t ccCmdNotSupportedInPresentState = 0xD5;
size_t writeDataLen = writeData.size();
@@ -1498,7 +1498,7 @@
return ipmi::responseInvalidFieldRequest();
}
- const char *data = reinterpret_cast<const char *>(writeData.data());
+ const char* data = reinterpret_cast<const char*>(writeData.data());
out.write(data, writeDataLen);
out.close();
@@ -1529,7 +1529,7 @@
std::ifstream inFile(firmwareBufferFile,
std::ios::binary | std::ios::in);
- inFile.read(reinterpret_cast<char *>(&block0Data), sizeof(block0Data));
+ inFile.read(reinterpret_cast<char*>(&block0Data), sizeof(block0Data));
inFile.close();
uint32_t magicNum = block0Data.tag;
diff --git a/src/ipmi_to_redfish_hooks.cpp b/src/ipmi_to_redfish_hooks.cpp
index 9cac813..92f9f2e 100644
--- a/src/ipmi_to_redfish_hooks.cpp
+++ b/src/ipmi_to_redfish_hooks.cpp
@@ -15,11 +15,12 @@
*/
#include <boost/beast/core/span.hpp>
-#include <iomanip>
#include <ipmi_to_redfish_hooks.hpp>
#include <me_to_redfish_hooks.hpp>
-#include <sstream>
#include <storagecommands.hpp>
+
+#include <iomanip>
+#include <sstream>
#include <string_view>
namespace intel_oem::ipmi::sel
diff --git a/src/manufacturingcommands.cpp b/src/manufacturingcommands.cpp
index 60199d9..3b48bb2 100644
--- a/src/manufacturingcommands.cpp
+++ b/src/manufacturingcommands.cpp
@@ -17,12 +17,13 @@
#include <linux/input.h>
#include <boost/container/flat_map.hpp>
-#include <filesystem>
-#include <fstream>
#include <ipmid/api.hpp>
#include <manufacturingcommands.hpp>
#include <oemcommands.hpp>
+#include <filesystem>
+#include <fstream>
+
namespace ipmi
{
diff --git a/src/me_to_redfish_hooks.cpp b/src/me_to_redfish_hooks.cpp
index fac2731..c473038 100644
--- a/src/me_to_redfish_hooks.cpp
+++ b/src/me_to_redfish_hooks.cpp
@@ -17,6 +17,7 @@
#include <boost/algorithm/string/join.hpp>
#include <me_to_redfish_hooks.hpp>
#include <phosphor-logging/log.hpp>
+
#include <string_view>
namespace intel_oem::ipmi::sel::redfish_hooks::me
diff --git a/src/multinodecommands.cpp b/src/multinodecommands.cpp
index 5966605..d55b2f0 100644
--- a/src/multinodecommands.cpp
+++ b/src/multinodecommands.cpp
@@ -21,6 +21,7 @@
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/message/types.hpp>
+
#include <string>
namespace ipmi
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 515a539..9e05308 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -20,26 +20,19 @@
#include <systemd/sd-journal.h>
#include <appcommands.hpp>
-#include <array>
#include <boost/container/flat_map.hpp>
#include <boost/process/child.hpp>
#include <boost/process/io.hpp>
#include <com/intel/Control/OCOTShutdownPolicy/server.hpp>
#include <commandutils.hpp>
-#include <filesystem>
#include <gpiod.hpp>
-#include <iostream>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
#include <nlohmann/json.hpp>
#include <oemcommands.hpp>
#include <phosphor-logging/log.hpp>
-#include <regex>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/message/types.hpp>
-#include <string>
-#include <variant>
-#include <vector>
#include <xyz/openbmc_project/Chassis/Control/NMISource/server.hpp>
#include <xyz/openbmc_project/Control/Boot/Mode/server.hpp>
#include <xyz/openbmc_project/Control/Boot/Source/server.hpp>
@@ -47,6 +40,14 @@
#include <xyz/openbmc_project/Control/Security/RestrictionMode/server.hpp>
#include <xyz/openbmc_project/Control/Security/SpecialMode/server.hpp>
+#include <array>
+#include <filesystem>
+#include <iostream>
+#include <regex>
+#include <string>
+#include <variant>
+#include <vector>
+
namespace ipmi
{
static void registerOEMFunctions() __attribute__((constructor));
diff --git a/src/sensorcommands.cpp b/src/sensorcommands.cpp
index 0c1840c..811cd91 100644
--- a/src/sensorcommands.cpp
+++ b/src/sensorcommands.cpp
@@ -22,21 +22,22 @@
#include "sensorutils.hpp"
#include "storagecommands.hpp"
-#include <algorithm>
-#include <array>
#include <boost/algorithm/string.hpp>
#include <boost/container/flat_map.hpp>
+#include <ipmid/api.hpp>
+#include <ipmid/utils.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
+
+#include <algorithm>
+#include <array>
#include <chrono>
#include <cmath>
#include <cstring>
#include <iostream>
-#include <ipmid/api.hpp>
-#include <ipmid/utils.hpp>
#include <map>
#include <memory>
#include <optional>
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/bus.hpp>
#include <stdexcept>
#include <string>
#include <utility>
@@ -64,12 +65,12 @@
// Specify the comparison required to sort and find char* map objects
struct CmpStr
{
- bool operator()(const char *a, const char *b) const
+ bool operator()(const char* a, const char* b) const
{
return std::strcmp(a, b) < 0;
}
};
-const static boost::container::flat_map<const char *, SensorUnits, CmpStr>
+const static boost::container::flat_map<const char*, SensorUnits, CmpStr>
sensorUnits{{{"temperature", SensorUnits::degreesC},
{"voltage", SensorUnits::volts},
{"current", SensorUnits::amps},
@@ -82,7 +83,7 @@
*getSdBus(),
"type='signal',member='InterfacesAdded',arg0path='/xyz/openbmc_project/"
"sensors/'",
- [](sdbusplus::message::message &m) {
+ [](sdbusplus::message::message& m) {
sensorTree.clear();
sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
@@ -93,7 +94,7 @@
*getSdBus(),
"type='signal',member='InterfacesRemoved',arg0path='/xyz/openbmc_project/"
"sensors/'",
- [](sdbusplus::message::message &m) {
+ [](sdbusplus::message::message& m) {
sensorTree.clear();
sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
@@ -110,13 +111,13 @@
*getSdBus(),
"type='signal',member='PropertiesChanged',interface='org.freedesktop.DBus."
"Properties',arg0namespace='xyz.openbmc_project.Sensor.Threshold'",
- [](sdbusplus::message::message &m) {
+ [](sdbusplus::message::message& m) {
boost::container::flat_map<std::string, std::variant<bool, double>>
values;
m.read(std::string(), values);
auto findAssert =
- std::find_if(values.begin(), values.end(), [](const auto &pair) {
+ std::find_if(values.begin(), values.end(), [](const auto& pair) {
return pair.first.find("Alarm") != std::string::npos;
});
if (findAssert != values.end())
@@ -137,7 +138,7 @@
}
else
{
- auto &value =
+ auto& value =
thresholdDeassertMap[m.get_path()][findAssert->first];
if (value)
{
@@ -150,8 +151,8 @@
}
});
-static void getSensorMaxMin(const SensorMap &sensorMap, double &max,
- double &min)
+static void getSensorMaxMin(const SensorMap& sensorMap, double& max,
+ double& min)
{
max = 127;
min = -128;
@@ -211,7 +212,7 @@
static bool getSensorMap(boost::asio::yield_context yield,
std::string sensorConnection, std::string sensorPath,
- SensorMap &sensorMap)
+ SensorMap& sensorMap)
{
static boost::container::flat_map<
std::string, std::chrono::time_point<std::chrono::steady_clock>>
@@ -265,13 +266,13 @@
/* sensor commands */
namespace meHealth
{
-constexpr const char *busname = "xyz.openbmc_project.NodeManagerProxy";
-constexpr const char *path = "/xyz/openbmc_project/status/me";
-constexpr const char *interface = "xyz.openbmc_project.SetHealth";
-constexpr const char *method = "SetHealth";
-constexpr const char *critical = "critical";
-constexpr const char *warning = "warning";
-constexpr const char *ok = "ok";
+constexpr const char* busname = "xyz.openbmc_project.NodeManagerProxy";
+constexpr const char* path = "/xyz/openbmc_project/status/me";
+constexpr const char* interface = "xyz.openbmc_project.SetHealth";
+constexpr const char* method = "SetHealth";
+constexpr const char* critical = "critical";
+constexpr const char* warning = "warning";
+constexpr const char* ok = "ok";
} // namespace meHealth
static void setMeStatus(uint8_t eventData2, uint8_t eventData3, bool disable)
@@ -322,14 +323,14 @@
{
dbus->call(setHealth);
}
- catch (sdbusplus::exception_t &)
+ catch (sdbusplus::exception_t&)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Failed to set ME Health");
}
}
-ipmi::RspType<> ipmiSenPlatformEvent(ipmi::message::Payload &p)
+ipmi::RspType<> ipmiSenPlatformEvent(ipmi::message::Payload& p)
{
constexpr const uint8_t meId = 0x2C;
constexpr const uint8_t meSensorNum = 0x17;
@@ -408,7 +409,7 @@
{
return ipmi::responseResponseError();
}
- auto &valueVariant = sensorObject->second["Value"];
+ auto& valueVariant = sensorObject->second["Value"];
double reading = std::visit(VariantToDoubleVisitor(), valueVariant);
double max = 0;
@@ -630,7 +631,7 @@
findThreshold->first);
}
}
- for (const auto &property : thresholdsToSet)
+ for (const auto& property : thresholdsToSet)
{
// from section 36.3 in the IPMI Spec, assume all linear
double valueToSet = ((mValue * std::get<thresholdValue>(property)) +
@@ -643,7 +644,7 @@
return ipmi::responseSuccess();
}
-IPMIThresholds getIPMIThresholds(const SensorMap &sensorMap)
+IPMIThresholds getIPMIThresholds(const SensorMap& sensorMap)
{
IPMIThresholds resp;
auto warningInterface =
@@ -679,7 +680,7 @@
}
if (warningInterface != sensorMap.end())
{
- auto &warningMap = warningInterface->second;
+ auto& warningMap = warningInterface->second;
auto warningHigh = warningMap.find("WarningHigh");
auto warningLow = warningMap.find("WarningLow");
@@ -702,7 +703,7 @@
}
if (criticalInterface != sensorMap.end())
{
- auto &criticalMap = criticalInterface->second;
+ auto& criticalMap = criticalInterface->second;
auto criticalHigh = criticalMap.find("CriticalHigh");
auto criticalLow = criticalMap.find("CriticalLow");
@@ -756,7 +757,7 @@
{
thresholdData = getIPMIThresholds(sensorMap);
}
- catch (std::exception &)
+ catch (std::exception&)
{
return ipmi::responseResponseError();
}
@@ -851,7 +852,7 @@
IPMISensorEventEnableByte2::sensorScanningEnable);
if (warningInterface != sensorMap.end())
{
- auto &warningMap = warningInterface->second;
+ auto& warningMap = warningInterface->second;
auto warningHigh = warningMap.find("WarningHigh");
auto warningLow = warningMap.find("WarningLow");
@@ -872,7 +873,7 @@
}
if (criticalInterface != sensorMap.end())
{
- auto &criticalMap = criticalInterface->second;
+ auto& criticalMap = criticalInterface->second;
auto criticalHigh = criticalMap.find("CriticalHigh");
auto criticalLow = criticalMap.find("CriticalLow");
@@ -985,7 +986,7 @@
IPMISensorEventEnableByte2::eventMessagesEnable);
if (warningInterface != sensorMap.end())
{
- auto &warningMap = warningInterface->second;
+ auto& warningMap = warningInterface->second;
auto warningHigh = warningMap.find("WarningAlarmHigh");
auto warningLow = warningMap.find("WarningAlarmLow");
@@ -1015,7 +1016,7 @@
}
if (criticalInterface != sensorMap.end())
{
- auto &criticalMap = criticalInterface->second;
+ auto& criticalMap = criticalInterface->second;
auto criticalHigh = criticalMap.find("CriticalAlarmHigh");
auto criticalLow = criticalMap.find("CriticalAlarmLow");
@@ -1237,7 +1238,7 @@
bytesToRead = sizeof(data) - offset;
}
- uint8_t *respStart = reinterpret_cast<uint8_t *>(&data) + offset;
+ uint8_t* respStart = reinterpret_cast<uint8_t*>(&data) + offset;
recordData.insert(recordData.end(), respStart,
respStart + bytesToRead);
}
@@ -1248,7 +1249,7 @@
std::string connection;
std::string path;
uint16_t sensorIndex = recordID;
- for (const auto &sensor : sensorTree)
+ for (const auto& sensor : sensorTree)
{
if (sensorIndex-- == 0)
{
@@ -1399,10 +1400,10 @@
if (name.size() > FULL_RECORD_ID_STR_MAX_LENGTH)
{
// try to not truncate by replacing common words
- constexpr std::array<std::pair<const char *, const char *>, 2>
+ constexpr std::array<std::pair<const char*, const char*>, 2>
replaceWords = {std::make_pair("Output", "Out"),
std::make_pair("Input", "In")};
- for (const auto &[find, replace] : replaceWords)
+ for (const auto& [find, replace] : replaceWords)
{
boost::replace_all(name, find, replace);
}
@@ -1418,7 +1419,7 @@
{
thresholdData = getIPMIThresholds(sensorMap);
}
- catch (std::exception &)
+ catch (std::exception&)
{
return ipmi::responseResponseError();
}
@@ -1481,7 +1482,7 @@
bytesToRead = sizeof(get_sdr::SensorDataFullRecord) - offset;
}
- uint8_t *respStart = reinterpret_cast<uint8_t *>(&record) + offset;
+ uint8_t* respStart = reinterpret_cast<uint8_t*>(&record) + offset;
std::vector<uint8_t> recordData(respStart, respStart + bytesToRead);
return ipmi::responseSuccess(nextRecordId, recordData);
diff --git a/src/smbioshandler.cpp b/src/smbioshandler.cpp
index aeaba5c..e330e5a 100644
--- a/src/smbioshandler.cpp
+++ b/src/smbioshandler.cpp
@@ -15,16 +15,17 @@
*/
#include <commandutils.hpp>
-#include <cstdint>
-#include <iostream>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
#include <smbioshandler.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+
+#include <cstdint>
+#include <iostream>
#include <string>
#include <vector>
-#include <xyz/openbmc_project/Common/error.hpp>
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
diff --git a/src/smbiosmdrv2handler.cpp b/src/smbiosmdrv2handler.cpp
index a33d0b2..52cd78f 100644
--- a/src/smbiosmdrv2handler.cpp
+++ b/src/smbiosmdrv2handler.cpp
@@ -22,17 +22,18 @@
#include <unistd.h>
#include <commandutils.hpp>
-#include <cstdint>
-#include <fstream>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
#include <oemcommands.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/message/types.hpp>
#include <smbiosmdrv2handler.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+
+#include <cstdint>
+#include <fstream>
#include <string>
#include <vector>
-#include <xyz/openbmc_project/Common/error.hpp>
std::unique_ptr<MDRV2> mdrv2 = nullptr;
static constexpr const uint8_t ccOemInvalidChecksum = 0x85;
@@ -41,7 +42,7 @@
static void register_netfn_smbiosmdrv2_functions() __attribute__((constructor));
-int MDRV2::agentLookup(const uint16_t &agentId)
+int MDRV2::agentLookup(const uint16_t& agentId)
{
int agentIndex = -1;
@@ -58,9 +59,9 @@
return agentIndex;
}
-int MDRV2::sdplusMdrv2GetProperty(const std::string &name,
- std::variant<uint8_t> &value,
- const std::string &service)
+int MDRV2::sdplusMdrv2GetProperty(const std::string& name,
+ std::variant<uint8_t>& value,
+ const std::string& service)
{
std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus();
sdbusplus::message::message method =
@@ -74,7 +75,7 @@
sdbusplus::message::message reply = bus->call(method);
reply.read(value);
}
- catch (sdbusplus::exception_t &e)
+ catch (sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error get property, sdbusplus call failed",
@@ -86,7 +87,7 @@
}
int MDRV2::syncDirCommonData(uint8_t idIndex, uint32_t size,
- const std::string &service)
+ const std::string& service)
{
std::vector<uint32_t> commonData;
std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus();
@@ -100,7 +101,7 @@
sdbusplus::message::message reply = bus->call(method);
reply.read(commonData);
}
- catch (sdbusplus::exception_t &e)
+ catch (sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error sync dir common data with service",
@@ -121,8 +122,8 @@
return 0;
}
-int MDRV2::findDataId(const uint8_t *dataInfo, const size_t &len,
- const std::string &service)
+int MDRV2::findDataId(const uint8_t* dataInfo, const size_t& len,
+ const std::string& service)
{
int idIndex = -1;
@@ -146,7 +147,7 @@
sdbusplus::message::message reply = bus->call(method);
reply.read(idIndex);
}
- catch (sdbusplus::exception_t &e)
+ catch (sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error find id index",
@@ -159,7 +160,7 @@
return idIndex;
}
-uint16_t MDRV2::getSessionHandle(Mdr2DirStruct *dir)
+uint16_t MDRV2::getSessionHandle(Mdr2DirStruct* dir)
{
if (dir == NULL)
{
@@ -176,7 +177,7 @@
return dir->sessionHandle;
}
-int MDRV2::findLockHandle(const uint16_t &lockHandle)
+int MDRV2::findLockHandle(const uint16_t& lockHandle)
{
int idIndex = -1;
@@ -205,7 +206,7 @@
return false;
}
-uint32_t MDRV2::calcChecksum32(uint8_t *buf, uint32_t len)
+uint32_t MDRV2::calcChecksum32(uint8_t* buf, uint32_t len)
{
uint32_t sum = 0;
@@ -319,7 +320,7 @@
sdbusplus::message::message reply = bus->call(method);
reply.read(dataOut);
}
- catch (sdbusplus::exception_t &e)
+ catch (sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error get dir", phosphor::logging::entry("ERROR=%s", e.what()),
@@ -388,7 +389,7 @@
sdbusplus::message::message reply = bus->call(method);
reply.read(terminate);
}
- catch (sdbusplus::exception_t &e)
+ catch (sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error send dir", phosphor::logging::entry("ERROR=%s", e.what()),
@@ -454,7 +455,7 @@
sdbusplus::message::message reply = bus->call(method);
reply.read(res);
}
- catch (sdbusplus::exception_t &e)
+ catch (sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error get data info",
@@ -507,7 +508,7 @@
sdbusplus::message::message reply = bus->call(method);
reply.read(dataOut);
}
- catch (sdbusplus::exception_t &e)
+ catch (sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error send data info offer",
@@ -588,7 +589,7 @@
sdbusplus::message::message reply = bus->call(method);
reply.read(entryChanged);
}
- catch (sdbusplus::exception_t &e)
+ catch (sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error send data info",
@@ -760,9 +761,9 @@
"Offset is out of range");
return ipmi::responseParmOutOfRange();
}
- uint8_t *destAddr =
+ uint8_t* destAddr =
mdrv2->smbiosDir.dir[idIndex].dataStorage + xferOffset;
- uint8_t *sourceAddr = reinterpret_cast<uint8_t *>(mdrv2->area->vPtr);
+ uint8_t* sourceAddr = reinterpret_cast<uint8_t*>(mdrv2->area->vPtr);
uint32_t calcChecksum = mdrv2->calcChecksum32(sourceAddr, xferLength);
if (calcChecksum != checksum)
{
@@ -791,7 +792,7 @@
return ipmi::responseSuccess();
}
-bool MDRV2::storeDatatoFlash(MDRSMBIOSHeader *mdrHdr, uint8_t *data)
+bool MDRV2::storeDatatoFlash(MDRSMBIOSHeader* mdrHdr, uint8_t* data)
{
std::ofstream smbiosFile(mdrType2File,
std::ios_base::binary | std::ios_base::trunc);
@@ -804,11 +805,11 @@
try
{
- smbiosFile.write(reinterpret_cast<char *>(mdrHdr),
+ smbiosFile.write(reinterpret_cast<char*>(mdrHdr),
sizeof(MDRSMBIOSHeader));
- smbiosFile.write(reinterpret_cast<char *>(data), mdrHdr->dataSize);
+ smbiosFile.write(reinterpret_cast<char*>(data), mdrHdr->dataSize);
}
- catch (std::ofstream::failure &e)
+ catch (std::ofstream::failure& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Write data from flash error - write data error",
@@ -882,7 +883,7 @@
return ret;
}
-bool MDRV2::smbiosTryLock(uint8_t flag, uint8_t index, uint16_t *session,
+bool MDRV2::smbiosTryLock(uint8_t flag, uint8_t index, uint16_t* session,
uint16_t timeout)
{
bool ret = false;
@@ -1121,7 +1122,7 @@
mdrv2->area =
std::make_unique<SharedMemoryArea>(xferAddress, xferLength);
}
- catch (const std::system_error &e)
+ catch (const std::system_error& e)
{
mdrv2->smbiosUnlock(idIndex);
phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -1225,7 +1226,7 @@
sdbusplus::message::message reply = bus->call(method);
reply.read(status);
}
- catch (sdbusplus::exception_t &e)
+ catch (sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error Sync data with service",
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 9c73b6a..68e3c04 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -23,15 +23,16 @@
#include <boost/algorithm/string.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/process.hpp>
-#include <filesystem>
-#include <functional>
-#include <iostream>
#include <ipmid/api.hpp>
#include <ipmid/message.hpp>
#include <phosphor-ipmi-host/selutility.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/message/types.hpp>
#include <sdbusplus/timer.hpp>
+
+#include <filesystem>
+#include <functional>
+#include <iostream>
#include <stdexcept>
#include <string_view>
diff --git a/src/whitelist-filter.cpp b/src/whitelist-filter.cpp
index 3f30a41..18ff4d5 100644
--- a/src/whitelist-filter.cpp
+++ b/src/whitelist-filter.cpp
@@ -1,5 +1,3 @@
-#include <algorithm>
-#include <array>
#include <ipmi-whitelist.hpp>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
@@ -7,6 +5,9 @@
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Control/Security/RestrictionMode/server.hpp>
+#include <algorithm>
+#include <array>
+
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
using namespace sdbusplus::xyz::openbmc_project::Control::Security::server;
diff --git a/tests/test_sensorcommands.cpp b/tests/test_sensorcommands.cpp
index 38f7407..b10bf3b 100644
--- a/tests/test_sensorcommands.cpp
+++ b/tests/test_sensorcommands.cpp
@@ -1,6 +1,7 @@
-#include <cmath>
#include <sensorutils.hpp>
+#include <cmath>
+
#include "gtest/gtest.h"
// There is a surprising amount of slop in the math,