clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: I44441096113929ce96eb1439e2932e6ff3c87f27
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 692faa2..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,19 +5,20 @@
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: false
-AlignOperands: true
-AlignTrailingComments: true
+AlignEscapedNewlines: Right
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: true
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
@@ -30,19 +31,28 @@
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
+ AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
+DeriveLineEnding: false
DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
@@ -52,21 +62,29 @@
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
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -74,18 +92,29 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
ReflowComments: true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
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
@@ -93,7 +122,7 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
diff --git a/app/channel.cpp b/app/channel.cpp
index 7d51bfe..5da9739 100644
--- a/app/channel.cpp
+++ b/app/channel.cpp
@@ -5,14 +5,15 @@
#include <arpa/inet.h>
#include <boost/process/child.hpp>
-#include <fstream>
#include <ipmid/types.hpp>
#include <ipmid/utils.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+
+#include <fstream>
#include <set>
#include <string>
-#include <xyz/openbmc_project/Common/error.hpp>
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
@@ -139,8 +140,8 @@
{
try
{
- std::tie(cipherRecords, supportedAlgorithms) =
- cipher::getCipherRecords();
+ std::tie(cipherRecords,
+ supportedAlgorithms) = cipher::getCipherRecords();
recordInit = true;
}
catch (const std::exception& e)
@@ -149,8 +150,8 @@
}
}
- const std::vector<uint8_t>& records =
- algoSelectBit ? cipherRecords : supportedAlgorithms;
+ const std::vector<uint8_t>& records = algoSelectBit ? cipherRecords
+ : supportedAlgorithms;
static constexpr auto respSize = 16;
// Session support is available in active LAN channels.
@@ -166,8 +167,8 @@
// set of 16 and so on.
// Calculate the number of record data bytes to be returned.
- auto start =
- std::min(static_cast<size_t>(listIndex) * respSize, records.size());
+ auto start = std::min(static_cast<size_t>(listIndex) * respSize,
+ records.size());
auto end = std::min((static_cast<size_t>(listIndex) * respSize) + respSize,
records.size());
auto size = end - start;
diff --git a/app/watchdog.cpp b/app/watchdog.cpp
index e92cf81..3126c0c 100644
--- a/app/watchdog.cpp
+++ b/app/watchdog.cpp
@@ -4,15 +4,16 @@
#include <endian.h>
-#include <bitset>
-#include <cstdint>
#include <ipmid/api.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
-#include <string>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <bitset>
+#include <cstdint>
+#include <string>
+
using phosphor::logging::commit;
using phosphor::logging::level;
using phosphor::logging::log;
@@ -356,15 +357,15 @@
* - initialCountdown
* - presentCountdown
**/
-ipmi::RspType<uint3_t, // timerUse - timer use
- uint3_t, // timerUse - reserved
- bool, // timerUse - timer is started
- bool, // timerUse - don't log
+ipmi::RspType<uint3_t, // timerUse - timer use
+ uint3_t, // timerUse - reserved
+ bool, // timerUse - timer is started
+ bool, // timerUse - don't log
- uint3_t, // timerAction - timeout action
- uint1_t, // timerAction - reserved
- uint3_t, // timerAction - pre-timeout interrupt
- uint1_t, // timerAction - reserved
+ uint3_t, // timerAction - timeout action
+ uint1_t, // timerAction - reserved
+ uint3_t, // timerAction - pre-timeout interrupt
+ uint1_t, // timerAction - reserved
uint8_t, // pretimeout
std::bitset<8>, // expireFlags
diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
index 3534e89..09b700f 100644
--- a/app/watchdog_service.cpp
+++ b/app/watchdog_service.cpp
@@ -1,17 +1,18 @@
#include "watchdog_service.hpp"
-#include <exception>
#include <ipmid/api.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/message.hpp>
-#include <stdexcept>
-#include <string>
#include <xyz/openbmc_project/Common/error.hpp>
#include <xyz/openbmc_project/State/Watchdog/server.hpp>
+#include <exception>
+#include <stdexcept>
+#include <string>
+
using phosphor::logging::elog;
using phosphor::logging::entry;
using phosphor::logging::level;
@@ -26,9 +27,7 @@
ipmi::ServiceCache WatchdogService::wd_service(wd_intf, wd_path);
-WatchdogService::WatchdogService() : bus(ipmid_get_sd_bus_connection())
-{
-}
+WatchdogService::WatchdogService() : bus(ipmid_get_sd_bus_connection()) {}
void WatchdogService::resetTimeRemaining(bool enableWatchdog)
{
diff --git a/apphandler.cpp b/apphandler.cpp
index 98f7caa..5628b35 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -12,37 +12,38 @@
#include <systemd/sd-bus.h>
#include <unistd.h>
-#include <algorithm>
#include <app/channel.hpp>
#include <app/watchdog.hpp>
#include <apphandler.hpp>
+#include <ipmid/api.hpp>
+#include <ipmid/sessiondef.hpp>
+#include <ipmid/sessionhelper.hpp>
+#include <ipmid/types.hpp>
+#include <ipmid/utils.hpp>
+#include <nlohmann/json.hpp>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/message/types.hpp>
+#include <sys_info_param.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/Control/Power/ACPIPowerState/server.hpp>
+#include <xyz/openbmc_project/Software/Activation/server.hpp>
+#include <xyz/openbmc_project/Software/Version/server.hpp>
+#include <xyz/openbmc_project/State/BMC/server.hpp>
+
+#include <algorithm>
#include <array>
#include <charconv>
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <fstream>
-#include <ipmid/api.hpp>
-#include <ipmid/sessiondef.hpp>
-#include <ipmid/sessionhelper.hpp>
-#include <ipmid/types.hpp>
-#include <ipmid/utils.hpp>
#include <memory>
-#include <nlohmann/json.hpp>
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
#include <regex>
-#include <sdbusplus/message/types.hpp>
#include <string>
#include <string_view>
-#include <sys_info_param.hpp>
#include <tuple>
#include <vector>
-#include <xyz/openbmc_project/Common/error.hpp>
-#include <xyz/openbmc_project/Control/Power/ACPIPowerState/server.hpp>
-#include <xyz/openbmc_project/Software/Activation/server.hpp>
-#include <xyz/openbmc_project/Software/Version/server.hpp>
-#include <xyz/openbmc_project/State/BMC/server.hpp>
extern sd_bus* bus;
@@ -116,8 +117,8 @@
ipmi::ObjectTree objectTree;
try
{
- objectTree =
- ipmi::getAllDbusObjects(*ctx->bus, softwareRoot, redundancyIntf);
+ objectTree = ipmi::getAllDbusObjects(*ctx->bus, softwareRoot,
+ redundancyIntf);
}
catch (const sdbusplus::exception_t& e)
{
@@ -130,10 +131,10 @@
auto objectFound = false;
for (auto& softObject : objectTree)
{
- auto service =
- ipmi::getService(*ctx->bus, redundancyIntf, softObject.first);
- auto objValueTree =
- ipmi::getManagedObjects(*ctx->bus, service, softwareRoot);
+ auto service = ipmi::getService(*ctx->bus, redundancyIntf,
+ softObject.first);
+ auto objValueTree = ipmi::getManagedObjects(*ctx->bus, service,
+ softwareRoot);
auto minPriority = 0xFF;
for (const auto& objIter : objValueTree)
@@ -186,11 +187,11 @@
sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
// Get the Inventory object implementing the BMC interface
- ipmi::DbusObjectInfo bmcObject =
- ipmi::getDbusObject(bus, bmc_state_interface);
- auto variant =
- ipmi::getDbusProperty(bus, bmcObject.second, bmcObject.first,
- bmc_state_interface, bmc_state_property);
+ ipmi::DbusObjectInfo bmcObject = ipmi::getDbusObject(bus,
+ bmc_state_interface);
+ auto variant = ipmi::getDbusProperty(bus, bmcObject.second, bmcObject.first,
+ bmc_state_interface,
+ bmc_state_property);
return std::holds_alternative<std::string>(variant) &&
BMC::convertBMCStateFromString(std::get<std::string>(variant)) ==
@@ -340,11 +341,11 @@
}
else
{
- auto found = std::find_if(
- acpi_state::dbusToIPMI.begin(), acpi_state::dbusToIPMI.end(),
- [&s](const auto& iter) {
- return (static_cast<uint8_t>(iter.second) == s);
- });
+ auto found = std::find_if(acpi_state::dbusToIPMI.begin(),
+ acpi_state::dbusToIPMI.end(),
+ [&s](const auto& iter) {
+ return (static_cast<uint8_t>(iter.second) == s);
+ });
value = found->first;
@@ -389,11 +390,11 @@
}
else
{
- auto found = std::find_if(
- acpi_state::dbusToIPMI.begin(), acpi_state::dbusToIPMI.end(),
- [&s](const auto& iter) {
- return (static_cast<uint8_t>(iter.second) == s);
- });
+ auto found = std::find_if(acpi_state::dbusToIPMI.begin(),
+ acpi_state::dbusToIPMI.end(),
+ [&s](const auto& iter) {
+ return (static_cast<uint8_t>(iter.second) == s);
+ });
value = found->first;
@@ -845,9 +846,9 @@
// Read UUID property value from bmcObject
// UUID is in RFC4122 format Ex: 61a39523-78f2-11e5-9862-e6402cfc3223
- propValue =
- ipmi::getDbusProperty(*busPtr, objectInfo.second, objectInfo.first,
- uuidInterface, uuidProperty);
+ propValue = ipmi::getDbusProperty(*busPtr, objectInfo.second,
+ objectInfo.first, uuidInterface,
+ uuidProperty);
}
catch (const InternalFailure& e)
{
@@ -1158,23 +1159,23 @@
sessionProps, "State", static_cast<uint8_t>(session::State::inactive));
if (sessionState == static_cast<uint8_t>(session::State::active))
{
- sessionHandle =
- ipmi::mappedVariant<uint8_t>(sessionProps, "SessionHandle", 0);
- std::get<0>(details) =
- ipmi::mappedVariant<uint8_t>(sessionProps, "UserID", 0xff);
+ sessionHandle = ipmi::mappedVariant<uint8_t>(sessionProps,
+ "SessionHandle", 0);
+ std::get<0>(details) = ipmi::mappedVariant<uint8_t>(sessionProps,
+ "UserID", 0xff);
// std::get<1>(details) = 0; // (default constructed to 0)
std::get<2>(details) =
ipmi::mappedVariant<uint8_t>(sessionProps, "CurrentPrivilege", 0);
// std::get<3>(details) = 0; // (default constructed to 0)
- std::get<4>(details) =
- ipmi::mappedVariant<uint8_t>(sessionProps, "ChannelNum", 0xff);
+ std::get<4>(details) = ipmi::mappedVariant<uint8_t>(sessionProps,
+ "ChannelNum", 0xff);
constexpr uint4_t rmcpPlusProtocol = 1;
std::get<5>(details) = rmcpPlusProtocol;
- std::get<6>(details) =
- ipmi::mappedVariant<uint32_t>(sessionProps, "RemoteIPAddr", 0);
+ std::get<6>(details) = ipmi::mappedVariant<uint32_t>(sessionProps,
+ "RemoteIPAddr", 0);
// std::get<7>(details) = {{0}}; // default constructed to all 0
- std::get<8>(details) =
- ipmi::mappedVariant<uint16_t>(sessionProps, "RemotePort", 0);
+ std::get<8>(details) = ipmi::mappedVariant<uint16_t>(sessionProps,
+ "RemotePort", 0);
}
return ipmi::ccSuccess;
@@ -1237,8 +1238,8 @@
std::string service = itr->first;
uint8_t sessionState = 0;
- completionCode =
- getSessionState(ctx, service, objectPath, sessionState);
+ completionCode = getSessionState(ctx, service, objectPath,
+ sessionState);
if (completionCode)
{
return ipmi::response(completionCode);
@@ -1471,7 +1472,7 @@
uint8_t setSelector = data1;
size_t count = 0;
- if (setSelector == 0) // First chunk has only 14 bytes.
+ if (setSelector == 0) // First chunk has only 14 bytes.
{
size_t stringLen = configData.at(1); // string length
// maxBytesPerParamter is 256. It will always be greater than stringLen
@@ -1701,8 +1702,8 @@
}
#endif // ENABLE_I2C_WHITELIST_CHECK
std::vector<uint8_t> readBuf(readCount);
- std::string i2cBus =
- "/dev/i2c-" + std::to_string(static_cast<uint8_t>(busId));
+ std::string i2cBus = "/dev/i2c-" +
+ std::to_string(static_cast<uint8_t>(busId));
ipmi::Cc ret = ipmi::i2cWriteRead(i2cBus, static_cast<uint8_t>(slaveAddr),
writeData, readBuf);
diff --git a/chassishandler.cpp b/chassishandler.cpp
index 85b0399..0028592 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -8,16 +8,9 @@
#include <mapper.h>
#include <netinet/in.h>
-#include <array>
-#include <chrono>
-#include <cstring>
-#include <filesystem>
-#include <fstream>
-#include <future>
#include <ipmid/api.hpp>
#include <ipmid/types.hpp>
#include <ipmid/utils.hpp>
-#include <map>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
@@ -25,8 +18,6 @@
#include <sdbusplus/server/object.hpp>
#include <sdbusplus/timer.hpp>
#include <settings.hpp>
-#include <sstream>
-#include <string>
#include <xyz/openbmc_project/Common/error.hpp>
#include <xyz/openbmc_project/Control/Boot/Mode/server.hpp>
#include <xyz/openbmc_project/Control/Boot/Source/server.hpp>
@@ -36,6 +27,16 @@
#include <xyz/openbmc_project/State/Host/server.hpp>
#include <xyz/openbmc_project/State/PowerOnHours/server.hpp>
+#include <array>
+#include <chrono>
+#include <cstring>
+#include <filesystem>
+#include <fstream>
+#include <future>
+#include <map>
+#include <sstream>
+#include <string>
+
std::unique_ptr<phosphor::Timer> identifyTimer
__attribute__((init_priority(101)));
@@ -341,8 +342,7 @@
case AF_INET:
{
struct sockaddr_in addr4
- {
- };
+ {};
std::memcpy(&addr4.sin_addr.s_addr, &data[offset], addrSize);
inet_ntop(AF_INET, &addr4.sin_addr, ipAddr, INET_ADDRSTRLEN);
@@ -352,8 +352,7 @@
case AF_INET6:
{
struct sockaddr_in6 addr6
- {
- };
+ {};
std::memcpy(&addr6.sin6_addr.s6_addr, &data[offset], addrSize);
inet_ntop(AF_INET6, &addr6.sin6_addr, ipAddr, INET6_ADDRSTRLEN);
@@ -567,15 +566,15 @@
{
sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
- auto chassisStateObj =
- ipmi::getDbusObject(bus, chassisPOHStateIntf, chassisStateRoot, match);
+ auto chassisStateObj = ipmi::getDbusObject(bus, chassisPOHStateIntf,
+ chassisStateRoot, match);
- auto service =
- ipmi::getService(bus, chassisPOHStateIntf, chassisStateObj.first);
+ auto service = ipmi::getService(bus, chassisPOHStateIntf,
+ chassisStateObj.first);
- auto propValue =
- ipmi::getDbusProperty(bus, service, chassisStateObj.first,
- chassisPOHStateIntf, pohCounterProperty);
+ auto propValue = ipmi::getDbusProperty(bus, service, chassisStateObj.first,
+ chassisPOHStateIntf,
+ pohCounterProperty);
return std::get<uint32_t>(propValue);
}
@@ -623,9 +622,9 @@
// [0] -1b = Chassis provides intrusion (physical security) sensor.
// set to default value 0x0.
- properties =
- ipmi::getAllDbusProperties(bus, chassisCapObject.second,
- chassisCapObject.first, chassisCapIntf);
+ properties = ipmi::getAllDbusProperties(bus, chassisCapObject.second,
+ chassisCapObject.first,
+ chassisCapIntf);
}
catch (const std::exception& e)
{
@@ -729,7 +728,6 @@
uint8_t bridgeDeviceAddr)
{
-
// check input data
if (reserved1 != 0)
{
@@ -827,8 +825,8 @@
auto request = State::convertForMessage(transition);
std::string service;
- boost::system::error_code ec =
- ipmi::getService(ctx, hostStateIntf, hostStatePath, service);
+ boost::system::error_code ec = ipmi::getService(ctx, hostStateIntf,
+ hostStatePath, service);
if (!ec)
{
@@ -859,8 +857,8 @@
constexpr auto chassisStateIntf = "xyz.openbmc_project.State.Chassis";
std::string service;
- boost::system::error_code ec =
- ipmi::getService(ctx, chassisStateIntf, chassisStatePath, service);
+ boost::system::error_code ec = ipmi::getService(ctx, chassisStateIntf,
+ chassisStatePath, service);
// Convert to string equivalent of the passed in transition enum.
auto request = State::convertForMessage(transition);
@@ -896,8 +894,8 @@
"NMISource.BMCSourceSignal.ChassisCmd";
std::string service;
- boost::system::error_code ec =
- ipmi::getService(ctx, nmiSourceIntf, nmiSourceObjPath, service);
+ boost::system::error_code ec = ipmi::getService(ctx, nmiSourceIntf,
+ nmiSourceObjPath, service);
if (!ec)
{
ec = ipmi::setDbusProperty(ctx, service, nmiSourceObjPath,
@@ -982,8 +980,8 @@
"/xyz/openbmc_project/state/chassis0";
constexpr const char* chassisStateIntf =
"xyz.openbmc_project.State.Chassis";
- auto service =
- ipmi::getService(*busp, chassisStateIntf, chassisStatePath);
+ auto service = ipmi::getService(*busp, chassisStateIntf,
+ chassisStatePath);
ipmi::Value powerState =
ipmi::getDbusProperty(*busp, service, chassisStatePath,
@@ -1000,8 +998,8 @@
"/org/openbmc/control/power0";
constexpr const char* legacyPwrCtrlIntf =
"org.openbmc.control.Power";
- auto service =
- ipmi::getService(*busp, legacyPwrCtrlIntf, legacyPwrCtrlObj);
+ auto service = ipmi::getService(*busp, legacyPwrCtrlIntf,
+ legacyPwrCtrlObj);
ipmi::Value variant = ipmi::getDbusProperty(
*busp, service, legacyPwrCtrlObj, legacyPwrCtrlIntf, "pgood");
@@ -1032,8 +1030,8 @@
std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus();
try
{
- auto service =
- ipmi::getService(*bus, powerControlIntf, powerControlObj);
+ auto service = ipmi::getService(*bus, powerControlIntf,
+ powerControlObj);
ipmi::Value variant = ipmi::getDbusProperty(
*bus, service, powerControlObj, powerControlIntf, "PFail");
@@ -1113,8 +1111,8 @@
chassisIntrusionStr);
if (!ec)
{
- bool ret =
- (chassisIntrusionStr == "HardwareIntrusion") ? true : false;
+ bool ret = (chassisIntrusionStr == "HardwareIntrusion") ? true
+ : false;
return std::make_optional(ret);
}
}
@@ -1136,10 +1134,10 @@
uint2_t, // power restore policy
bool, // reserved
- bool, // AC failed
- bool, // last power down caused by a Power overload
- bool, // last power down caused by a power interlock
- bool, // last power down caused by power fault
+ bool, // AC failed
+ bool, // last power down caused by a Power overload
+ bool, // last power down caused by a power interlock
+ bool, // last power down caused by power fault
bool, // last ‘Power is on’ state was entered via IPMI command
uint3_t, // reserved
@@ -1151,14 +1149,14 @@
bool, // Chassis Identify command and state info supported
bool, // reserved
- bool, // Power off button disabled
- bool, // Reset button disabled
- bool, // Diagnostic Interrupt button disabled
- bool, // Standby (sleep) button disabled
- bool, // Power off button disable allowed
- bool, // Reset button disable allowed
- bool, // Diagnostic Interrupt button disable allowed
- bool // Standby (sleep) button disable allowed
+ bool, // Power off button disabled
+ bool, // Reset button disabled
+ bool, // Diagnostic Interrupt button disabled
+ bool, // Standby (sleep) button disabled
+ bool, // Power off button disable allowed
+ bool, // Reset button disable allowed
+ bool, // Diagnostic Interrupt button disable allowed
+ bool // Standby (sleep) button disable allowed
>
ipmiGetChassisStatus(ipmi::Context::ptr& ctx)
{
@@ -1172,8 +1170,8 @@
}
// Front Panel Button Capabilities and disable/enable status(Optional)
- std::optional<bool> powerButtonReading =
- getButtonEnabled(powerButtonPath, powerButtonIntf);
+ std::optional<bool> powerButtonReading = getButtonEnabled(powerButtonPath,
+ powerButtonIntf);
// allow disable if the interface is present
bool powerButtonDisableAllow = static_cast<bool>(powerButtonReading);
// default return the button is enabled (not disabled)
@@ -1184,8 +1182,8 @@
powerButtonDisabled = *powerButtonReading;
}
- std::optional<bool> resetButtonReading =
- getButtonEnabled(resetButtonPath, resetButtonIntf);
+ std::optional<bool> resetButtonReading = getButtonEnabled(resetButtonPath,
+ resetButtonIntf);
// allow disable if the interface is present
bool resetButtonDisableAllow = static_cast<bool>(resetButtonReading);
// default return the button is enabled (not disabled)
@@ -1313,8 +1311,8 @@
"xyz.openbmc_project.Control.Host.RestartCause";
std::string service;
- boost::system::error_code ec =
- ipmi::getService(ctx, restartCauseIntf, restartCausePath, service);
+ boost::system::error_code ec = ipmi::getService(ctx, restartCauseIntf,
+ restartCausePath, service);
if (!ec)
{
std::string restartCauseStr;
@@ -1447,9 +1445,9 @@
auto msg = std::string("enclosureIdentifyLed(") +
boost::lexical_cast<std::string>(flag) + ")";
log<level::DEBUG>(msg.c_str());
- auto led =
- dbus.new_method_call(connection.c_str(), identify_led_object_name,
- "org.freedesktop.DBus.Properties", "Set");
+ auto led = dbus.new_method_call(connection.c_str(),
+ identify_led_object_name,
+ "org.freedesktop.DBus.Properties", "Set");
led.append("xyz.openbmc_project.Led.Group", "Asserted",
std::variant<bool>(flag));
auto ledReply = dbus.call(led);
@@ -1580,8 +1578,8 @@
using namespace chassis::internal;
std::string result;
std::string service;
- boost::system::error_code ec =
- getService(ctx, bootSourceIntf, bootSettingsPath, service);
+ boost::system::error_code ec = getService(ctx, bootSourceIntf,
+ bootSettingsPath, service);
if (!ec)
{
ec = ipmi::getDbusProperty(ctx, service, bootSettingsPath,
@@ -1607,8 +1605,8 @@
{
using namespace chassis::internal;
std::string service;
- boost::system::error_code ec =
- getService(ctx, bootSourceIntf, bootSettingsPath, service);
+ boost::system::error_code ec = getService(ctx, bootSourceIntf,
+ bootSettingsPath, service);
if (!ec)
{
ec = ipmi::setDbusProperty(ctx, service, bootSettingsPath,
@@ -1634,8 +1632,8 @@
using namespace chassis::internal;
std::string result;
std::string service;
- boost::system::error_code ec =
- getService(ctx, bootModeIntf, bootSettingsPath, service);
+ boost::system::error_code ec = getService(ctx, bootModeIntf,
+ bootSettingsPath, service);
if (!ec)
{
ec = ipmi::getDbusProperty(ctx, service, bootSettingsPath, bootModeIntf,
@@ -1660,8 +1658,8 @@
{
using namespace chassis::internal;
std::string service;
- boost::system::error_code ec =
- getService(ctx, bootModeIntf, bootSettingsPath, service);
+ boost::system::error_code ec = getService(ctx, bootModeIntf,
+ bootSettingsPath, service);
if (!ec)
{
ec = ipmi::setDbusProperty(ctx, service, bootSettingsPath, bootModeIntf,
@@ -1686,8 +1684,8 @@
using namespace chassis::internal;
std::string result;
std::string service;
- boost::system::error_code ec =
- getService(ctx, bootTypeIntf, bootSettingsPath, service);
+ boost::system::error_code ec = getService(ctx, bootTypeIntf,
+ bootSettingsPath, service);
// Don't throw error if BootType interface is not present.
// This interface is not relevant for some Host architectures
@@ -1719,8 +1717,8 @@
{
using namespace chassis::internal;
std::string service;
- boost::system::error_code ec =
- getService(ctx, bootTypeIntf, bootSettingsPath, service);
+ boost::system::error_code ec = getService(ctx, bootTypeIntf,
+ bootSettingsPath, service);
if (!ec)
{
ec = ipmi::setDbusProperty(ctx, service, bootSettingsPath, bootTypeIntf,
@@ -1749,8 +1747,8 @@
using namespace chassis::internal;
std::string result;
std::string service;
- boost::system::error_code ec =
- getService(ctx, bootEnableIntf, bootSettingsPath, service);
+ boost::system::error_code ec = getService(ctx, bootEnableIntf,
+ bootSettingsPath, service);
if (!ec)
{
ec = ipmi::getDbusProperty(ctx, service, bootSettingsPath,
@@ -1774,8 +1772,8 @@
{
using namespace chassis::internal;
std::string service;
- boost::system::error_code ec =
- getService(ctx, bootEnableIntf, bootSettingsPath, service);
+ boost::system::error_code ec = getService(ctx, bootEnableIntf,
+ bootSettingsPath, service);
if (!ec)
{
ec = ipmi::setDbusProperty(ctx, service, bootSettingsPath,
@@ -1800,8 +1798,8 @@
using namespace chassis::internal;
std::string result;
std::string service;
- boost::system::error_code ec =
- getService(ctx, bootOneTimeIntf, bootSettingsOneTimePath, service);
+ boost::system::error_code ec = getService(ctx, bootOneTimeIntf,
+ bootSettingsOneTimePath, service);
if (!ec)
{
ec = ipmi::getDbusProperty(ctx, service, bootSettingsOneTimePath,
@@ -1825,8 +1823,8 @@
{
using namespace chassis::internal;
std::string service;
- boost::system::error_code ec =
- getService(ctx, bootOneTimeIntf, bootSettingsOneTimePath, service);
+ boost::system::error_code ec = getService(ctx, bootOneTimeIntf,
+ bootSettingsOneTimePath, service);
if (!ec)
{
ec = ipmi::setDbusProperty(ctx, service, bootSettingsOneTimePath,
@@ -2314,7 +2312,7 @@
return ipmi::responseSuccess(power_policy::allSupport, reserved);
}
- for (auto const& it : power_policy::dbusToIpmi)
+ for (const auto& it : power_policy::dbusToIpmi)
{
if (it.second == policy)
{
diff --git a/dbus-sdr/sdrutils.cpp b/dbus-sdr/sdrutils.cpp
index e818ef3..399b59a 100644
--- a/dbus-sdr/sdrutils.cpp
+++ b/dbus-sdr/sdrutils.cpp
@@ -61,8 +61,8 @@
static constexpr const int32_t depth = 2;
- auto lbdUpdateSensorTree = [&dbus](const char* path,
- const auto& interfaces) {
+ auto lbdUpdateSensorTree =
+ [&dbus](const char* path, const auto& interfaces) {
auto mapperCall = dbus->new_method_call(
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
@@ -102,8 +102,8 @@
static constexpr const std::array vrInterfaces = {
"xyz.openbmc_project.Control.VoltageRegulatorMode"};
- bool sensorRez =
- lbdUpdateSensorTree("/xyz/openbmc_project/sensors", sensorInterfaces);
+ bool sensorRez = lbdUpdateSensorTree("/xyz/openbmc_project/sensors",
+ sensorInterfaces);
#ifdef FEATURE_HYBRID_SENSORS
@@ -218,7 +218,7 @@
return std::find_if(
ipmi::sensor::sensors.begin(), ipmi::sensor::sensors.end(),
[&path](const ipmi::sensor::IdInfoMap::value_type& findSensor) {
- return findSensor.second.sensorPath == path;
+ return findSensor.second.sensorPath == path;
});
}
#endif
@@ -394,8 +394,8 @@
return ipmiDecoratorPaths;
}
- ipmiDecoratorPaths =
- std::unordered_set<std::string>(paths.begin(), paths.end());
+ ipmiDecoratorPaths = std::unordered_set<std::string>(paths.begin(),
+ paths.end());
return ipmiDecoratorPaths;
}
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index ca6040f..16860dc 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -21,25 +21,26 @@
#include "dbus-sdr/storagecommands.hpp"
#include "entity_map_json.hpp"
-#include <algorithm>
-#include <array>
#include <boost/algorithm/string.hpp>
#include <boost/container/flat_map.hpp>
+#include <ipmid/api.hpp>
+#include <ipmid/types.hpp>
+#include <ipmid/utils.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
+#include <user_channel/channel_layer.hpp>
+
+#include <algorithm>
+#include <array>
#include <chrono>
#include <cmath>
#include <cstring>
#include <iostream>
-#include <ipmid/api.hpp>
-#include <ipmid/types.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 <user_channel/channel_layer.hpp>
#include <utility>
#include <variant>
@@ -131,11 +132,11 @@
"type='signal',member='InterfacesAdded',arg0path='/xyz/openbmc_project/"
"sensors/'",
[](sdbusplus::message_t&) {
- getSensorTree().clear();
- getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
- sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
- std::chrono::system_clock::now().time_since_epoch())
- .count();
+ getSensorTree().clear();
+ getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
+ sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::system_clock::now().time_since_epoch())
+ .count();
});
static sdbusplus::bus::match_t sensorRemoved(
@@ -143,11 +144,11 @@
"type='signal',member='InterfacesRemoved',arg0path='/xyz/openbmc_project/"
"sensors/'",
[](sdbusplus::message_t&) {
- getSensorTree().clear();
- getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
- sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
- std::chrono::system_clock::now().time_since_epoch())
- .count();
+ getSensorTree().clear();
+ getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
+ sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::system_clock::now().time_since_epoch())
+ .count();
});
// this keeps track of deassertions for sensor event status command. A
@@ -161,43 +162,41 @@
"type='signal',member='PropertiesChanged',interface='org.freedesktop.DBus."
"Properties',arg0namespace='xyz.openbmc_project.Sensor.Threshold'",
[](sdbusplus::message_t& m) {
- boost::container::flat_map<std::string, std::variant<bool, double>>
- values;
- m.read(std::string(), values);
+ 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) {
- return pair.first.find("Alarm") != std::string::npos;
- });
- if (findAssert != values.end())
+ auto findAssert = std::find_if(values.begin(), values.end(),
+ [](const auto& pair) {
+ return pair.first.find("Alarm") != std::string::npos;
+ });
+ if (findAssert != values.end())
+ {
+ auto ptr = std::get_if<bool>(&(findAssert->second));
+ if (ptr == nullptr)
{
- auto ptr = std::get_if<bool>(&(findAssert->second));
- if (ptr == nullptr)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "thresholdChanged: Assert non bool");
- return;
- }
- if (*ptr)
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "thresholdChanged: Assert non bool");
+ return;
+ }
+ if (*ptr)
+ {
+ phosphor::logging::log<phosphor::logging::level::INFO>(
+ "thresholdChanged: Assert",
+ phosphor::logging::entry("SENSOR=%s", m.get_path()));
+ thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
+ }
+ else
+ {
+ auto& value = thresholdDeassertMap[m.get_path()][findAssert->first];
+ if (value)
{
phosphor::logging::log<phosphor::logging::level::INFO>(
- "thresholdChanged: Assert",
+ "thresholdChanged: deassert",
phosphor::logging::entry("SENSOR=%s", m.get_path()));
- thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
- }
- else
- {
- auto& value =
- thresholdDeassertMap[m.get_path()][findAssert->first];
- if (value)
- {
- phosphor::logging::log<phosphor::logging::level::INFO>(
- "thresholdChanged: deassert",
- phosphor::logging::entry("SENSOR=%s", m.get_path()));
- value = *ptr;
- }
+ value = *ptr;
}
}
+ }
});
namespace sensor
@@ -257,7 +256,6 @@
}
if (warning != sensorMap.end())
{
-
auto lower = warning->second.find("WarningLow");
auto upper = warning->second.find("WarningHigh");
if (lower != warning->second.end())
@@ -586,7 +584,6 @@
if (static_cast<ipmi::EChannelMediumType>(chInfo.mediumType) ==
ipmi::EChannelMediumType::systemInterface)
{
-
p.unpack(sysgeneratorID, evmRev, sensorType, sensorNum, eventType,
eventData1, eventData2, eventData3);
// Refer to IPMI Spec Table 32: SEL Event Records
@@ -597,7 +594,6 @@
}
else
{
-
p.unpack(evmRev, sensorType, sensorNum, eventType, eventData1,
eventData2, eventData3);
// Refer to IPMI Spec Table 32: SEL Event Records
@@ -635,8 +631,8 @@
std::string path;
std::vector<std::string> interfaces;
- ipmi::Cc status =
- getSensorConnection(ctx, sensorNumber, connection, path, &interfaces);
+ ipmi::Cc status = getSensorConnection(ctx, sensorNumber, connection, path,
+ &interfaces);
if (status)
{
return ipmi::response(status);
@@ -664,8 +660,8 @@
return ipmi::responseResponseError();
}
- auto value =
- sensor::calculateValue(reading, sensorMap, sensorObject->second);
+ auto value = sensor::calculateValue(reading, sensorMap,
+ sensorObject->second);
if (!value)
{
return ipmi::responseResponseError();
@@ -717,8 +713,8 @@
// VR sensors are treated as a special case and we will not check the
// write permission for VR sensors, since they always deemed writable
// and permission table are not applied to VR sensors.
- auto vrMode =
- sensor::calculateVRMode(assertOffset, sensorObject->second);
+ auto vrMode = sensor::calculateVRMode(assertOffset,
+ sensorObject->second);
if (!vrMode)
{
return ipmi::responseResponseError();
@@ -841,8 +837,8 @@
return ipmi::responseResponseError();
}
- uint8_t value =
- scaleIPMIValueFromDouble(reading, mValue, rExp, bValue, bExp, bSigned);
+ uint8_t value = scaleIPMIValueFromDouble(reading, mValue, rExp, bValue,
+ bExp, bSigned);
uint8_t operation =
static_cast<uint8_t>(IPMISensorReadingByte2::sensorScanningEnable);
operation |=
@@ -1155,9 +1151,8 @@
if (warningHigh != warningMap.end())
{
-
- double value =
- std::visit(VariantToDoubleVisitor(), warningHigh->second);
+ double value = std::visit(VariantToDoubleVisitor(),
+ warningHigh->second);
if (std::isfinite(value))
{
resp.warningHigh = scaleIPMIValueFromDouble(
@@ -1166,8 +1161,8 @@
}
if (warningLow != warningMap.end())
{
- double value =
- std::visit(VariantToDoubleVisitor(), warningLow->second);
+ double value = std::visit(VariantToDoubleVisitor(),
+ warningLow->second);
if (std::isfinite(value))
{
resp.warningLow = scaleIPMIValueFromDouble(
@@ -1184,8 +1179,8 @@
if (criticalHigh != criticalMap.end())
{
- double value =
- std::visit(VariantToDoubleVisitor(), criticalHigh->second);
+ double value = std::visit(VariantToDoubleVisitor(),
+ criticalHigh->second);
if (std::isfinite(value))
{
resp.criticalHigh = scaleIPMIValueFromDouble(
@@ -1194,8 +1189,8 @@
}
if (criticalLow != criticalMap.end())
{
- double value =
- std::visit(VariantToDoubleVisitor(), criticalLow->second);
+ double value = std::visit(VariantToDoubleVisitor(),
+ criticalLow->second);
if (std::isfinite(value))
{
resp.criticalLow = scaleIPMIValueFromDouble(
@@ -1735,8 +1730,8 @@
uint8_t bExpBits = bExp & 0x07;
// move rExp and bExp into place
- record.body.r_b_exponents =
- (rExpSign << 7) | (rExpBits << 4) | (bExpSign << 3) | bExpBits;
+ record.body.r_b_exponents = (rExpSign << 7) | (rExpBits << 4) |
+ (bExpSign << 3) | bExpBits;
// Set the analog reading byte interpretation accordingly
record.body.sensor_units_1 = (bSigned ? 1 : 0) << 7;
@@ -1760,8 +1755,8 @@
sensorMap.find("xyz.openbmc_project.Sensor.ValueMutability");
if (mutability != sensorMap.end())
{
- sensorSettable =
- mappedVariant<bool>(mutability->second, "Mutable", false);
+ sensorSettable = mappedVariant<bool>(mutability->second, "Mutable",
+ false);
}
get_sdr::body::init_settable_state(sensorSettable, &record.body);
@@ -2058,9 +2053,9 @@
ctx->lun = lun3;
}
- auto status =
- getSensorConnection(ctx, static_cast<uint8_t>(sensNumFromRecID),
- connection, path, &interfaces);
+ auto status = getSensorConnection(ctx,
+ static_cast<uint8_t>(sensNumFromRecID),
+ connection, path, &interfaces);
if (status)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -2256,8 +2251,8 @@
// Return the number of sensors attached to the LUN
if ((ctx->lun == lun0) && (numSensors > 0))
{
- sdrCount =
- (numSensors > maxSensorsPerLUN) ? maxSensorsPerLUN : numSensors;
+ sdrCount = (numSensors > maxSensorsPerLUN) ? maxSensorsPerLUN
+ : numSensors;
}
else if ((ctx->lun == lun1) && (numSensors > maxSensorsPerLUN))
{
@@ -2269,8 +2264,8 @@
{
if (numSensors <= maxIPMISensors)
{
- sdrCount =
- (numSensors - (2 * maxSensorsPerLUN)) & maxSensorsPerLUN;
+ sdrCount = (numSensors - (2 * maxSensorsPerLUN)) &
+ maxSensorsPerLUN;
}
else
{
@@ -2335,8 +2330,8 @@
return ipmi::response(ret);
}
- uint16_t recordCount =
- getNumberOfSensors() + fruCount + ipmi::storage::type12Count;
+ uint16_t recordCount = getNumberOfSensors() + fruCount +
+ ipmi::storage::type12Count;
uint8_t operationSupport = static_cast<uint8_t>(
SdrRepositoryInfoOps::overflow); // write not supported
@@ -2454,8 +2449,8 @@
return ipmi::responseSuccess(nextRecordId, record);
}
- size_t sdrLength =
- sizeof(get_sdr::SensorDataRecordHeader) + hdr->record_length;
+ size_t sdrLength = sizeof(get_sdr::SensorDataRecordHeader) +
+ hdr->record_length;
if (sdrLength < (offset + bytesToRead))
{
bytesToRead = sdrLength - offset;
diff --git a/dbus-sdr/sensorutils.cpp b/dbus-sdr/sensorutils.cpp
index d31dbed..e76a5f1 100644
--- a/dbus-sdr/sensorutils.cpp
+++ b/dbus-sdr/sensorutils.cpp
@@ -312,8 +312,8 @@
int8_t bExp = 0;
bool bSigned = false;
- bool result =
- getSensorAttributes(max, min, mValue, rExp, bValue, bExp, bSigned);
+ bool result = getSensorAttributes(max, min, mValue, rExp, bValue, bExp,
+ bSigned);
if (!result)
{
throw std::runtime_error("Illegal sensor attributes");
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index b50db1a..f123e99 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -22,16 +22,17 @@
#include <boost/algorithm/string.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/process.hpp>
-#include <filesystem>
-#include <fstream>
-#include <functional>
-#include <iostream>
#include <ipmid/api.hpp>
#include <ipmid/message.hpp>
#include <ipmid/types.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/message/types.hpp>
#include <sdbusplus/timer.hpp>
+
+#include <filesystem>
+#include <fstream>
+#include <functional>
+#include <iostream>
#include <stdexcept>
#include <string_view>
@@ -171,7 +172,6 @@
void recalculateHashes()
{
-
deviceHashes.clear();
// hash the object paths to create unique device id's. increment on
// collision
@@ -324,53 +324,51 @@
"type='signal',arg0path='/xyz/openbmc_project/"
"FruDevice/',member='InterfacesAdded'",
[](sdbusplus::message_t& message) {
- sdbusplus::message::object_path path;
- ObjectType object;
- try
- {
- message.read(path, object);
- }
- catch (const sdbusplus::exception_t&)
- {
- return;
- }
- auto findType = object.find(
- "xyz.openbmc_project.FruDevice");
- if (findType == object.end())
- {
- return;
- }
- writeFruIfRunning();
- frus[path] = object;
- recalculateHashes();
- lastDevId = 0xFF;
- });
+ sdbusplus::message::object_path path;
+ ObjectType object;
+ try
+ {
+ message.read(path, object);
+ }
+ catch (const sdbusplus::exception_t&)
+ {
+ return;
+ }
+ auto findType = object.find("xyz.openbmc_project.FruDevice");
+ if (findType == object.end())
+ {
+ return;
+ }
+ writeFruIfRunning();
+ frus[path] = object;
+ recalculateHashes();
+ lastDevId = 0xFF;
+ });
fruMatches.emplace_back(*bus,
"type='signal',arg0path='/xyz/openbmc_project/"
"FruDevice/',member='InterfacesRemoved'",
[](sdbusplus::message_t& message) {
- sdbusplus::message::object_path path;
- std::set<std::string> interfaces;
- try
- {
- message.read(path, interfaces);
- }
- catch (const sdbusplus::exception_t&)
- {
- return;
- }
- auto findType = interfaces.find(
- "xyz.openbmc_project.FruDevice");
- if (findType == interfaces.end())
- {
- return;
- }
- writeFruIfRunning();
- frus.erase(path);
- recalculateHashes();
- lastDevId = 0xFF;
- });
+ sdbusplus::message::object_path path;
+ std::set<std::string> interfaces;
+ try
+ {
+ message.read(path, interfaces);
+ }
+ catch (const sdbusplus::exception_t&)
+ {
+ return;
+ }
+ auto findType = interfaces.find("xyz.openbmc_project.FruDevice");
+ if (findType == interfaces.end())
+ {
+ return;
+ }
+ writeFruIfRunning();
+ frus.erase(path);
+ recalculateHashes();
+ lastDevId = 0xFF;
+ });
// call once to populate
boost::asio::spawn(*getIoContext(), [](boost::asio::yield_context yield) {
@@ -583,34 +581,31 @@
uint8_t& address = device->second.second;
boost::container::flat_map<std::string, Value>* fruData = nullptr;
- auto fru =
- std::find_if(frus.begin(), frus.end(),
- [bus, address, &fruData](ManagedEntry& entry) {
- auto findFruDevice =
- entry.second.find("xyz.openbmc_project.FruDevice");
- if (findFruDevice == entry.second.end())
- {
- return false;
- }
- fruData = &(findFruDevice->second);
- auto findBus = findFruDevice->second.find("BUS");
- auto findAddress =
- findFruDevice->second.find("ADDRESS");
- if (findBus == findFruDevice->second.end() ||
- findAddress == findFruDevice->second.end())
- {
- return false;
- }
- if (std::get<uint32_t>(findBus->second) != bus)
- {
- return false;
- }
- if (std::get<uint32_t>(findAddress->second) != address)
- {
- return false;
- }
- return true;
- });
+ auto fru = std::find_if(frus.begin(), frus.end(),
+ [bus, address, &fruData](ManagedEntry& entry) {
+ auto findFruDevice = entry.second.find("xyz.openbmc_project.FruDevice");
+ if (findFruDevice == entry.second.end())
+ {
+ return false;
+ }
+ fruData = &(findFruDevice->second);
+ auto findBus = findFruDevice->second.find("BUS");
+ auto findAddress = findFruDevice->second.find("ADDRESS");
+ if (findBus == findFruDevice->second.end() ||
+ findAddress == findFruDevice->second.end())
+ {
+ return false;
+ }
+ if (std::get<uint32_t>(findBus->second) != bus)
+ {
+ return false;
+ }
+ if (std::get<uint32_t>(findAddress->second) != address)
+ {
+ return false;
+ }
+ return true;
+ });
if (fru == frus.end())
{
return IPMI_CC_RESPONSE_ERROR;
@@ -638,48 +633,48 @@
return ipmi::ccResponseError;
}
- auto entity = std::find_if(
- entities.begin(), entities.end(),
- [bus, address, &entityData, &name](ManagedEntry& entry) {
- auto findFruDevice = entry.second.find(
- "xyz.openbmc_project.Inventory.Decorator.I2CDevice");
- if (findFruDevice == entry.second.end())
- {
- return false;
- }
+ auto entity =
+ std::find_if(entities.begin(), entities.end(),
+ [bus, address, &entityData, &name](ManagedEntry& entry) {
+ auto findFruDevice = entry.second.find(
+ "xyz.openbmc_project.Inventory.Decorator.I2CDevice");
+ if (findFruDevice == entry.second.end())
+ {
+ return false;
+ }
- // Integer fields added via Entity-Manager json are uint64_ts by
- // default.
- auto findBus = findFruDevice->second.find("Bus");
- auto findAddress = findFruDevice->second.find("Address");
+ // Integer fields added via Entity-Manager json are uint64_ts by
+ // default.
+ auto findBus = findFruDevice->second.find("Bus");
+ auto findAddress = findFruDevice->second.find("Address");
- if (findBus == findFruDevice->second.end() ||
- findAddress == findFruDevice->second.end())
- {
- return false;
- }
- if ((std::get<uint64_t>(findBus->second) != bus) ||
- (std::get<uint64_t>(findAddress->second) != address))
- {
- return false;
- }
+ if (findBus == findFruDevice->second.end() ||
+ findAddress == findFruDevice->second.end())
+ {
+ return false;
+ }
+ if ((std::get<uint64_t>(findBus->second) != bus) ||
+ (std::get<uint64_t>(findAddress->second) != address))
+ {
+ return false;
+ }
- auto fruName = findFruDevice->second.find("Name");
- if (fruName != findFruDevice->second.end())
- {
- name = std::get<std::string>(fruName->second);
- }
+ auto fruName = findFruDevice->second.find("Name");
+ if (fruName != findFruDevice->second.end())
+ {
+ name = std::get<std::string>(fruName->second);
+ }
- // At this point we found the device entry and should return
- // true.
- auto findIpmiDevice = entry.second.find(
- "xyz.openbmc_project.Inventory.Decorator.Ipmi");
- if (findIpmiDevice != entry.second.end())
- {
- entityData = &(findIpmiDevice->second);
- }
+ // At this point we found the device entry and should return
+ // true.
+ auto findIpmiDevice =
+ entry.second.find("xyz.openbmc_project.Inventory.Decorator.Ipmi");
+ if (findIpmiDevice != entry.second.end())
+ {
+ entityData = &(findIpmiDevice->second);
+ }
- return true;
+ return true;
});
if (entity == entities.end())
@@ -907,9 +902,9 @@
using oemEventType =
std::array<uint8_t, dynamic_sensors::ipmi::sel::oemEventSize>; // Event Data
-ipmi::RspType<uint16_t, // Next Record ID
- uint16_t, // Record ID
- uint8_t, // Record Type
+ipmi::RspType<uint16_t, // Next Record ID
+ uint16_t, // Record ID
+ uint8_t, // Record Type
std::variant<systemEventType, oemTsEventType,
oemEventType>> // Record Content
ipmiStorageGetSELEntry(uint16_t reservationID, uint16_t targetID,
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index f06441b..e525f8e 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -4,19 +4,20 @@
#include "user_channel/channel_layer.hpp"
-#include <bitset>
-#include <cmath>
-#include <fstream>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
#include <nlohmann/json.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
-#include <variant>
#include <xyz/openbmc_project/Common/error.hpp>
#include <xyz/openbmc_project/Network/EthernetInterface/server.hpp>
+#include <bitset>
+#include <cmath>
+#include <fstream>
+#include <variant>
+
using namespace phosphor::logging;
using sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface;
@@ -253,8 +254,8 @@
sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
auto ethdevice = ipmi::getChannelName(ethernetDefaultChannelNum);
- auto ethernetObj =
- ipmi::getDbusObject(bus, ethernetIntf, networkRoot, ethdevice);
+ auto ethernetObj = ipmi::getDbusObject(bus, ethernetIntf, networkRoot,
+ ethdevice);
auto service = ipmi::getService(bus, ethernetIntf, ethernetObj.first);
auto value = ipmi::getDbusProperty(bus, service, ethernetObj.first,
ethernetIntf, "DHCPEnabled");
@@ -690,7 +691,6 @@
ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t)
{
-
std::ifstream dcmiCapFile(dcmi::gDCMICapabilitiesConfig);
if (!dcmiCapFile.is_open())
{
@@ -776,8 +776,8 @@
sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
auto result = ipmi::getAllDbusProperties(
bus, dbusService, dbusPath, "xyz.openbmc_project.Sensor.Value");
- auto temperature =
- std::visit(ipmi::VariantToDoubleVisitor(), result.at("Value"));
+ auto temperature = std::visit(ipmi::VariantToDoubleVisitor(),
+ result.at("Value"));
double absTemp = std::abs(temperature);
auto findFactor = result.find("Scale");
@@ -828,8 +828,8 @@
std::string service;
try
{
- service =
- ipmi::getService(bus, "xyz.openbmc_project.Sensor.Value", path);
+ service = ipmi::getService(bus, "xyz.openbmc_project.Sensor.Value",
+ path);
}
catch (const std::exception& e)
{
@@ -1102,7 +1102,6 @@
ipmi_response_t response, ipmi_data_len_t data_len,
ipmi_context_t)
{
-
auto requestData =
reinterpret_cast<const dcmi::GetConfParamsRequest*>(request);
auto responseData =
diff --git a/dcmihandler.hpp b/dcmihandler.hpp
index 303f6d0..793a03c 100644
--- a/dcmihandler.hpp
+++ b/dcmihandler.hpp
@@ -2,8 +2,9 @@
#include "nlohmann/json.hpp"
-#include <map>
#include <sdbusplus/bus.hpp>
+
+#include <map>
#include <string>
#include <vector>
@@ -90,7 +91,7 @@
uint8_t sign : 1; //!< Sign bit
uint8_t temperature : 7; //!< Temperature reading in Celsius
#endif
- uint8_t instance; //!< Entity instance number
+ uint8_t instance; //!< Entity instance number
} __attribute__((packed));
using ResponseList = std::vector<Response>;
diff --git a/elog-errors.hpp b/elog-errors.hpp
index 7a43954..bb80614 100644
--- a/elog-errors.hpp
+++ b/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>
@@ -1778,9 +1779,7 @@
namespace VPD
{
namespace _LocationNotFound
-{
-
-} // namespace _LocationNotFound
+{} // namespace _LocationNotFound
struct LocationNotFound
{
@@ -1810,9 +1809,7 @@
namespace VPD
{
namespace _NodeNotFound
-{
-
-} // namespace _NodeNotFound
+{} // namespace _NodeNotFound
struct NodeNotFound
{
@@ -1842,9 +1839,7 @@
namespace VPD
{
namespace _PathNotFound
-{
-
-} // namespace _PathNotFound
+{} // namespace _PathNotFound
struct PathNotFound
{
@@ -1874,9 +1869,7 @@
namespace VPD
{
namespace _RecordNotFound
-{
-
-} // namespace _RecordNotFound
+{} // namespace _RecordNotFound
struct RecordNotFound
{
@@ -1906,9 +1899,7 @@
namespace VPD
{
namespace _KeywordNotFound
-{
-
-} // namespace _KeywordNotFound
+{} // namespace _KeywordNotFound
struct KeywordNotFound
{
@@ -1938,9 +1929,7 @@
namespace VPD
{
namespace _BlankSystemVPD
-{
-
-} // namespace _BlankSystemVPD
+{} // namespace _BlankSystemVPD
struct BlankSystemVPD
{
@@ -1970,9 +1959,7 @@
namespace VPD
{
namespace _InvalidEepromPath
-{
-
-} // namespace _InvalidEepromPath
+{} // namespace _InvalidEepromPath
struct InvalidEepromPath
{
@@ -2002,9 +1989,7 @@
namespace VPD
{
namespace _InvalidVPD
-{
-
-} // namespace _InvalidVPD
+{} // namespace _InvalidVPD
struct InvalidVPD
{
@@ -2034,9 +2019,7 @@
namespace VPD
{
namespace _EccCheckFailed
-{
-
-} // namespace _EccCheckFailed
+{} // namespace _EccCheckFailed
struct EccCheckFailed
{
@@ -2066,9 +2049,7 @@
namespace VPD
{
namespace _InvalidJson
-{
-
-} // namespace _InvalidJson
+{} // namespace _InvalidJson
struct InvalidJson
{
@@ -2098,9 +2079,7 @@
namespace VPD
{
namespace _DbusFailure
-{
-
-} // namespace _DbusFailure
+{} // namespace _DbusFailure
struct DbusFailure
{
@@ -2326,9 +2305,7 @@
namespace HardwareIsolation
{
namespace _IsolatedAlready
-{
-
-} // namespace _IsolatedAlready
+{} // namespace _IsolatedAlready
struct IsolatedAlready
{
@@ -2408,9 +2385,7 @@
namespace Common
{
namespace _InternalFailure
-{
-
-} // namespace _InternalFailure
+{} // namespace _InternalFailure
struct InternalFailure
{
@@ -2505,9 +2480,7 @@
namespace Common
{
namespace _InsufficientPermission
-{
-
-} // namespace _InsufficientPermission
+{} // namespace _InsufficientPermission
struct InsufficientPermission
{
@@ -2585,9 +2558,7 @@
namespace Common
{
namespace _NoCACertificate
-{
-
-} // namespace _NoCACertificate
+{} // namespace _NoCACertificate
struct NoCACertificate
{
@@ -2618,9 +2589,7 @@
namespace Common
{
namespace _TooManyResources
-{
-
-} // namespace _TooManyResources
+{} // namespace _TooManyResources
struct TooManyResources
{
@@ -2651,9 +2620,7 @@
namespace Common
{
namespace _ResourceNotFound
-{
-
-} // namespace _ResourceNotFound
+{} // namespace _ResourceNotFound
struct ResourceNotFound
{
@@ -2684,9 +2651,7 @@
namespace Common
{
namespace _Unavailable
-{
-
-} // namespace _Unavailable
+{} // namespace _Unavailable
struct Unavailable
{
@@ -2766,9 +2731,7 @@
namespace Common
{
namespace _AttributeNotFound
-{
-
-} // namespace _AttributeNotFound
+{} // namespace _AttributeNotFound
struct AttributeNotFound
{
@@ -2852,9 +2815,7 @@
namespace Common
{
namespace _InvalidCurrentPassword
-{
-
-} // namespace _InvalidCurrentPassword
+{} // namespace _InvalidCurrentPassword
struct InvalidCurrentPassword
{
@@ -2889,9 +2850,7 @@
namespace Common
{
namespace _PasswordNotSettable
-{
-
-} // namespace _PasswordNotSettable
+{} // namespace _PasswordNotSettable
struct PasswordNotSettable
{
@@ -2925,9 +2884,7 @@
namespace Common
{
namespace _UnsupportedCommand
-{
-
-} // namespace _UnsupportedCommand
+{} // namespace _UnsupportedCommand
struct UnsupportedCommand
{
@@ -2961,9 +2918,7 @@
namespace Common
{
namespace _IOError
-{
-
-} // namespace _IOError
+{} // namespace _IOError
struct IOError
{
@@ -3298,9 +3253,7 @@
namespace Device
{
namespace _ReadFailure
-{
-
-} // namespace _ReadFailure
+{} // namespace _ReadFailure
struct ReadFailure
{
@@ -3338,9 +3291,7 @@
namespace Device
{
namespace _WriteFailure
-{
-
-} // namespace _WriteFailure
+{} // namespace _WriteFailure
struct WriteFailure
{
@@ -3656,9 +3607,7 @@
namespace Device
{
namespace _WriteFailure
-{
-
-} // namespace _WriteFailure
+{} // namespace _WriteFailure
struct WriteFailure
{
@@ -3696,9 +3645,7 @@
namespace Host
{
namespace _CommandNotSupported
-{
-
-} // namespace _CommandNotSupported
+{} // namespace _CommandNotSupported
struct CommandNotSupported
{
@@ -3732,9 +3679,7 @@
namespace Create
{
namespace _Disabled
-{
-
-} // namespace _Disabled
+{} // namespace _Disabled
struct Disabled
{
@@ -3930,9 +3875,7 @@
namespace MemoryECC
{
namespace _isLoggingLimitReached
-{
-
-} // namespace _isLoggingLimitReached
+{} // namespace _isLoggingLimitReached
struct isLoggingLimitReached
{
@@ -3966,9 +3909,7 @@
namespace MemoryECC
{
namespace _ceCount
-{
-
-} // namespace _ceCount
+{} // namespace _ceCount
struct ceCount
{
@@ -4002,9 +3943,7 @@
namespace MemoryECC
{
namespace _ueCount
-{
-
-} // namespace _ueCount
+{} // namespace _ueCount
struct ueCount
{
@@ -4038,9 +3977,7 @@
namespace Status
{
namespace _CapacityFault
-{
-
-} // namespace _CapacityFault
+{} // namespace _CapacityFault
struct CapacityFault
{
@@ -4074,9 +4011,7 @@
namespace Status
{
namespace _TemperatureFault
-{
-
-} // namespace _TemperatureFault
+{} // namespace _TemperatureFault
struct TemperatureFault
{
@@ -4110,9 +4045,7 @@
namespace Status
{
namespace _DegradesFault
-{
-
-} // namespace _DegradesFault
+{} // namespace _DegradesFault
struct DegradesFault
{
@@ -4146,9 +4079,7 @@
namespace Status
{
namespace _MediaFault
-{
-
-} // namespace _MediaFault
+{} // namespace _MediaFault
struct MediaFault
{
@@ -4182,9 +4113,7 @@
namespace Status
{
namespace _BackupDeviceFault
-{
-
-} // namespace _BackupDeviceFault
+{} // namespace _BackupDeviceFault
struct BackupDeviceFault
{
@@ -4218,9 +4147,7 @@
namespace Device
{
namespace _ReadFailure
-{
-
-} // namespace _ReadFailure
+{} // namespace _ReadFailure
struct ReadFailure
{
@@ -4362,9 +4289,7 @@
namespace MDR_V2
{
namespace _InvalidParameter
-{
-
-} // namespace _InvalidParameter
+{} // namespace _InvalidParameter
struct InvalidParameter
{
@@ -4398,9 +4323,7 @@
namespace MDR_V2
{
namespace _UpdateInProgress
-{
-
-} // namespace _UpdateInProgress
+{} // namespace _UpdateInProgress
struct UpdateInProgress
{
@@ -4434,9 +4357,7 @@
namespace MDR_V2
{
namespace _InvalidId
-{
-
-} // namespace _InvalidId
+{} // namespace _InvalidId
struct InvalidId
{
@@ -4605,9 +4526,7 @@
namespace Host
{
namespace _SoftOffTimeout
-{
-
-} // namespace _SoftOffTimeout
+{} // namespace _SoftOffTimeout
struct SoftOffTimeout
{
@@ -4697,9 +4616,7 @@
namespace Inventory
{
namespace _Fan
-{
-
-} // namespace _Fan
+{} // namespace _Fan
struct Fan
{
@@ -4736,9 +4653,7 @@
namespace ThermalEvent
{
namespace _Processor
-{
-
-} // namespace _Processor
+{} // namespace _Processor
struct Processor
{
@@ -4775,9 +4690,7 @@
namespace ThermalEvent
{
namespace _GPU
-{
-
-} // namespace _GPU
+{} // namespace _GPU
struct GPU
{
@@ -4814,9 +4727,7 @@
namespace ThermalEvent
{
namespace _Ambient
-{
-
-} // namespace _Ambient
+{} // namespace _Ambient
struct Ambient
{
@@ -4853,9 +4764,7 @@
namespace Power
{
namespace _Fault
-{
-
-} // namespace _Fault
+{} // namespace _Fault
struct Fault
{
@@ -4892,9 +4801,7 @@
namespace Power
{
namespace _Blackout
-{
-
-} // namespace _Blackout
+{} // namespace _Blackout
struct Blackout
{
@@ -4931,9 +4838,7 @@
namespace Power
{
namespace _Regulator
-{
-
-} // namespace _Regulator
+{} // namespace _Regulator
struct Regulator
{
@@ -4968,9 +4873,7 @@
namespace Common
{
namespace _UserNameExists
-{
-
-} // namespace _UserNameExists
+{} // namespace _UserNameExists
struct UserNameExists
{
@@ -5004,9 +4907,7 @@
namespace Common
{
namespace _UserNameDoesNotExist
-{
-
-} // namespace _UserNameDoesNotExist
+{} // namespace _UserNameDoesNotExist
struct UserNameDoesNotExist
{
@@ -5193,9 +5094,7 @@
namespace Common
{
namespace _PrivilegeMappingExists
-{
-
-} // namespace _PrivilegeMappingExists
+{} // namespace _PrivilegeMappingExists
struct PrivilegeMappingExists
{
@@ -5746,9 +5645,7 @@
namespace FSI
{
namespace _MasterDetectionFailure
-{
-
-} // namespace _MasterDetectionFailure
+{} // namespace _MasterDetectionFailure
struct MasterDetectionFailure
{
@@ -5784,9 +5681,7 @@
namespace Inventory
{
namespace _NotPresent
-{
-
-} // namespace _NotPresent
+{} // namespace _NotPresent
struct NotPresent
{
@@ -5819,9 +5714,7 @@
namespace Inventory
{
namespace _Nonfunctional
-{
-
-} // namespace _Nonfunctional
+{} // namespace _Nonfunctional
struct Nonfunctional
{
@@ -5965,9 +5858,7 @@
namespace BMC
{
namespace _MultiUserTargetFailure
-{
-
-} // namespace _MultiUserTargetFailure
+{} // namespace _MultiUserTargetFailure
struct MultiUserTargetFailure
{
@@ -6003,9 +5894,7 @@
namespace Chassis
{
namespace _PowerOnFailure
-{
-
-} // namespace _PowerOnFailure
+{} // namespace _PowerOnFailure
struct PowerOnFailure
{
@@ -6041,9 +5930,7 @@
namespace Chassis
{
namespace _PowerOffFailure
-{
-
-} // namespace _PowerOffFailure
+{} // namespace _PowerOffFailure
struct PowerOffFailure
{
@@ -6079,9 +5966,7 @@
namespace Host
{
namespace _HostStartFailure
-{
-
-} // namespace _HostStartFailure
+{} // namespace _HostStartFailure
struct HostStartFailure
{
@@ -6117,9 +6002,7 @@
namespace Host
{
namespace _HostMinStartFailure
-{
-
-} // namespace _HostMinStartFailure
+{} // namespace _HostMinStartFailure
struct HostMinStartFailure
{
@@ -6155,9 +6038,7 @@
namespace Host
{
namespace _HostShutdownFailure
-{
-
-} // namespace _HostShutdownFailure
+{} // namespace _HostShutdownFailure
struct HostShutdownFailure
{
@@ -6193,9 +6074,7 @@
namespace Host
{
namespace _HostStopFailure
-{
-
-} // namespace _HostStopFailure
+{} // namespace _HostStopFailure
struct HostStopFailure
{
@@ -6231,9 +6110,7 @@
namespace Host
{
namespace _HostRebootFailure
-{
-
-} // namespace _HostRebootFailure
+{} // namespace _HostRebootFailure
struct HostRebootFailure
{
diff --git a/entity_map_json.cpp b/entity_map_json.cpp
index 7b4e0bf..d00fcf0 100644
--- a/entity_map_json.cpp
+++ b/entity_map_json.cpp
@@ -1,10 +1,11 @@
#include "entity_map_json.hpp"
+#include <ipmid/types.hpp>
+#include <nlohmann/json.hpp>
+
#include <exception>
#include <fstream>
-#include <ipmid/types.hpp>
#include <memory>
-#include <nlohmann/json.hpp>
#include <string>
#include <utility>
diff --git a/entity_map_json.hpp b/entity_map_json.hpp
index 3ab4ff2..bfc8e72 100644
--- a/entity_map_json.hpp
+++ b/entity_map_json.hpp
@@ -1,9 +1,10 @@
#pragma once
#include <ipmid/types.hpp>
-#include <memory>
#include <nlohmann/json.hpp>
+#include <memory>
+
namespace ipmi
{
namespace sensor
@@ -48,8 +49,7 @@
private:
EntityInfoMapContainer(const EntityInfoMap& entityRecords) :
entityRecords(entityRecords)
- {
- }
+ {}
EntityInfoMap entityRecords;
};
diff --git a/error-HostEvent.hpp b/error-HostEvent.hpp
index 783aedd..9dbb823 100644
--- a/error-HostEvent.hpp
+++ b/error-HostEvent.hpp
@@ -25,8 +25,8 @@
const char* what() const noexcept override;
};
-struct MaintenanceProcedure final
- : public sdbusplus::exception::generated_exception
+struct MaintenanceProcedure final :
+ public sdbusplus::exception::generated_exception
{
static constexpr auto errName =
"org.open_power.Host.Error.MaintenanceProcedure";
diff --git a/globalhandler.cpp b/globalhandler.cpp
index 4012ce0..8161988 100644
--- a/globalhandler.cpp
+++ b/globalhandler.cpp
@@ -4,10 +4,11 @@
#include <ipmid/utils.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
-#include <string>
#include <xyz/openbmc_project/Common/error.hpp>
#include <xyz/openbmc_project/State/BMC/server.hpp>
+#include <string>
+
static constexpr auto bmcStateRoot = "/xyz/openbmc_project/state";
static constexpr auto bmcStateIntf = "xyz.openbmc_project.State.BMC";
static constexpr auto reqTransition = "RequestedBMCTransition";
@@ -22,8 +23,8 @@
{
sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
- auto bmcStateObj =
- ipmi::getDbusObject(bus, bmcStateIntf, bmcStateRoot, match);
+ auto bmcStateObj = ipmi::getDbusObject(bus, bmcStateIntf, bmcStateRoot,
+ match);
auto service = ipmi::getService(bus, bmcStateIntf, bmcStateObj.first);
@@ -54,7 +55,6 @@
void register_netfn_global_functions()
{
-
// Cold Reset
ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnApp,
ipmi::app::cmdColdReset, ipmi::Privilege::Admin,
diff --git a/groupext.cpp b/groupext.cpp
index 483e064..66d02f8 100644
--- a/groupext.cpp
+++ b/groupext.cpp
@@ -1,6 +1,7 @@
-#include <cstdio>
#include <ipmid/api.hpp>
+#include <cstdio>
+
#define GRPEXT_GET_GROUP_CMD 0
void register_netfn_groupext_functions() __attribute__((constructor));
diff --git a/host-cmd-manager.cpp b/host-cmd-manager.cpp
index d12583a..75cca84 100644
--- a/host-cmd-manager.cpp
+++ b/host-cmd-manager.cpp
@@ -4,7 +4,6 @@
#include "systemintfcmds.hpp"
-#include <chrono>
#include <ipmid/utils.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
@@ -13,6 +12,8 @@
#include <xyz/openbmc_project/Common/error.hpp>
#include <xyz/openbmc_project/State/Host/server.hpp>
+#include <chrono>
+
namespace phosphor
{
namespace host
diff --git a/host-cmd-manager.hpp b/host-cmd-manager.hpp
index f2fe373..cd96044 100644
--- a/host-cmd-manager.hpp
+++ b/host-cmd-manager.hpp
@@ -1,10 +1,11 @@
#pragma once
#include <ipmid-host/cmd-utils.hpp>
-#include <queue>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/timer.hpp>
+
+#include <queue>
#include <tuple>
namespace phosphor
diff --git a/host-interface.cpp b/host-interface.cpp
index e413fb7..dabaf32 100644
--- a/host-interface.cpp
+++ b/host-interface.cpp
@@ -5,14 +5,15 @@
#include "systemintfcmds.hpp"
-#include <functional>
#include <ipmid-host/cmd-utils.hpp>
#include <ipmid-host/cmd.hpp>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
+#include <phosphor-logging/log.hpp>
+
+#include <functional>
#include <memory>
#include <optional>
-#include <phosphor-logging/log.hpp>
namespace phosphor
{
diff --git a/host-interface.hpp b/host-interface.hpp
index 534f577..c4ee1c1 100644
--- a/host-interface.hpp
+++ b/host-interface.hpp
@@ -16,10 +16,10 @@
* @details A concrete implementation for xyz.openbmc_project.Control.Host
* and xyz.openbmc_project.Condition.HostFirmware DBus API's.
*/
-class Host
- : public sdbusplus::server::object_t<
- sdbusplus::xyz::openbmc_project::Control::server::Host,
- sdbusplus::xyz::openbmc_project::Condition::server::HostFirmware>
+class Host :
+ public sdbusplus::server::object_t<
+ sdbusplus::xyz::openbmc_project::Control::server::Host,
+ sdbusplus::xyz::openbmc_project::Condition::server::HostFirmware>
{
public:
/** @brief Constructs Host Control and Condition Interfaces
diff --git a/include/dbus-sdr/sdrutils.hpp b/include/dbus-sdr/sdrutils.hpp
index c129876..7a001a6 100644
--- a/include/dbus-sdr/sdrutils.hpp
+++ b/include/dbus-sdr/sdrutils.hpp
@@ -17,16 +17,17 @@
#include <boost/algorithm/string.hpp>
#include <boost/bimap.hpp>
#include <boost/container/flat_map.hpp>
+#include <ipmid/api.hpp>
+#include <ipmid/types.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus/match.hpp>
+
#include <cstdio>
#include <cstring>
#include <exception>
#include <filesystem>
-#include <ipmid/api.hpp>
-#include <ipmid/types.hpp>
#include <map>
#include <optional>
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/bus/match.hpp>
#include <string>
#include <unordered_set>
#include <vector>
diff --git a/include/dbus-sdr/sensorcommands.hpp b/include/dbus-sdr/sensorcommands.hpp
index 4689acb..1e342d7 100644
--- a/include/dbus-sdr/sensorcommands.hpp
+++ b/include/dbus-sdr/sensorcommands.hpp
@@ -15,9 +15,10 @@
*/
#pragma once
-#include <cstdint>
#include <dbus-sdr/sdrutils.hpp>
+#include <cstdint>
+
#pragma pack(push, 1)
struct SensorThresholdResp
diff --git a/include/ipmid-host/cmd.hpp b/include/ipmid-host/cmd.hpp
index ca73bd2..e844e8f 100644
--- a/include/ipmid-host/cmd.hpp
+++ b/include/ipmid-host/cmd.hpp
@@ -1,7 +1,8 @@
#include <ipmid-host/cmd-utils.hpp>
-#include <memory>
#include <sdbusplus/asio/connection.hpp>
+#include <memory>
+
// Global Host Bound Command manager
extern void ipmid_send_cmd_to_host(phosphor::host::command::CommandHandler&&);
extern std::unique_ptr<sdbusplus::asio::connection>&
diff --git a/include/ipmid/api-types.hpp b/include/ipmid/api-types.hpp
index 518db03..92432e0 100644
--- a/include/ipmid/api-types.hpp
+++ b/include/ipmid/api-types.hpp
@@ -15,8 +15,9 @@
*
*/
#pragma once
-#include <cstdint>
#include <ipmid/iana.hpp>
+
+#include <cstdint>
#include <optional>
#include <tuple>
diff --git a/include/ipmid/filter.hpp b/include/ipmid/filter.hpp
index 8b3a652..d57b838 100644
--- a/include/ipmid/filter.hpp
+++ b/include/ipmid/filter.hpp
@@ -14,11 +14,12 @@
* limitations under the License.
*/
#pragma once
-#include <algorithm>
#include <boost/callable_traits.hpp>
-#include <cstdint>
#include <ipmid/api-types.hpp>
#include <ipmid/message.hpp>
+
+#include <algorithm>
+#include <cstdint>
#include <memory>
#include <tuple>
#include <utility>
@@ -62,9 +63,7 @@
class IpmiFilter : public FilterBase
{
public:
- IpmiFilter(Filter&& filter) : filter_(std::move(filter))
- {
- }
+ IpmiFilter(Filter&& filter) : filter_(std::move(filter)) {}
ipmi::Cc call(message::Request::ptr request) override
{
diff --git a/include/ipmid/handler.hpp b/include/ipmid/handler.hpp
index 229b0cf..0359ee3 100644
--- a/include/ipmid/handler.hpp
+++ b/include/ipmid/handler.hpp
@@ -16,19 +16,20 @@
#pragma once
#include <cxxabi.h>
-#include <algorithm>
#include <boost/asio/spawn.hpp>
#include <boost/callable_traits.hpp>
-#include <cstdint>
-#include <exception>
#include <ipmid/api-types.hpp>
#include <ipmid/message.hpp>
+#include <phosphor-logging/log.hpp>
+#include <user_channel/channel_layer.hpp>
+
+#include <algorithm>
+#include <cstdint>
+#include <exception>
#include <memory>
#include <optional>
-#include <phosphor-logging/log.hpp>
#include <stdexcept>
#include <tuple>
-#include <user_channel/channel_layer.hpp>
#include <utility>
#ifdef ALLOW_DEPRECATED_API
@@ -61,9 +62,7 @@
class HandlerCompletion
{
public:
- HandlerCompletion(Cc cc) noexcept : cc(cc)
- {
- }
+ HandlerCompletion(Cc cc) noexcept : cc(cc) {}
Cc code() const noexcept
{
@@ -81,12 +80,10 @@
public:
HandlerException(Cc cc, const char* what) :
HandlerCompletion(cc), std::runtime_error(what)
- {
- }
+ {}
HandlerException(Cc cc, const std::string& what) :
HandlerException(cc, what.c_str())
- {
- }
+ {}
};
static inline const char* currentExceptionType()
@@ -161,8 +158,7 @@
public:
explicit IpmiHandler(Handler&& handler) :
handler_(std::forward<Handler>(handler))
- {
- }
+ {}
private:
Handler handler_;
@@ -331,8 +327,7 @@
public:
explicit IpmiHandler(const ipmid_callback_t& handler, void* ctx = nullptr) :
handler_(handler), handlerCtx(ctx)
- {
- }
+ {}
private:
ipmid_callback_t handler_;
@@ -423,9 +418,7 @@
class IpmiHandler<oem::Handler> final : public HandlerBase
{
public:
- explicit IpmiHandler(const oem::Handler& handler) : handler_(handler)
- {
- }
+ explicit IpmiHandler(const oem::Handler& handler) : handler_(handler) {}
private:
oem::Handler handler_;
diff --git a/include/ipmid/message.hpp b/include/ipmid/message.hpp
index 8cb9192..64f7777 100644
--- a/include/ipmid/message.hpp
+++ b/include/ipmid/message.hpp
@@ -15,16 +15,17 @@
*/
#pragma once
-#include <algorithm>
#include <boost/asio/spawn.hpp>
-#include <cstdint>
-#include <exception>
#include <ipmid/api-types.hpp>
#include <ipmid/message/types.hpp>
#include <ipmid/types.hpp>
-#include <memory>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/asio/connection.hpp>
+
+#include <algorithm>
+#include <cstdint>
+#include <exception>
+#include <memory>
#include <tuple>
#include <utility>
#include <vector>
@@ -50,8 +51,7 @@
netFn(netFn), lun(lun), cmd(cmd), channel(channel), userId(userId),
sessionId(sessionId), priv(priv), rqSA(rqSA), hostIdx(hostIdx),
yield(yield)
- {
- }
+ {}
std::shared_ptr<sdbusplus::asio::connection> bus;
// normal IPMI context (what call is this, from whence it came...)
@@ -116,9 +116,7 @@
Payload(Payload&&) = default;
Payload& operator=(Payload&&) = default;
- explicit Payload(SecureBuffer&& data) : raw(std::move(data))
- {
- }
+ explicit Payload(SecureBuffer&& data) : raw(std::move(data)) {}
~Payload()
{
@@ -258,8 +256,8 @@
template <typename Arg, typename... Args>
int pack(Arg&& arg, Args&&... args)
{
- int packRet =
- details::PackSingle_t<Arg>::op(*this, std::forward<Arg>(arg));
+ int packRet = details::PackSingle_t<Arg>::op(*this,
+ std::forward<Arg>(arg));
if (packRet)
{
return packRet;
@@ -466,8 +464,8 @@
size_t priorIndex = rawIndex;
fixed_uint_t<details::bitStreamSize> priorBits = bitStream;
- int ret =
- std::apply([this](Types&... args) { return unpack(args...); }, t);
+ int ret = std::apply([this](Types&... args) { return unpack(args...); },
+ t);
if (ret)
{
bitCount = priorBitCount;
@@ -515,8 +513,7 @@
explicit Response(Context::ptr& context) :
payload(), ctx(context), cc(ccSuccess)
- {
- }
+ {}
/**
* @brief pack arbitrary values (of any supported type) into the payload
@@ -597,8 +594,7 @@
explicit Request(Context::ptr context, SecureBuffer&& d) :
payload(std::forward<SecureBuffer>(d)), ctx(context)
- {
- }
+ {}
/**
* @brief unpack arbitrary values (of any supported type) from the payload
diff --git a/include/ipmid/message/pack.hpp b/include/ipmid/message/pack.hpp
index 86a12be..30baa59 100644
--- a/include/ipmid/message/pack.hpp
+++ b/include/ipmid/message/pack.hpp
@@ -15,11 +15,12 @@
*/
#pragma once
-#include <array>
#include <ipmid/message/types.hpp>
+#include <phosphor-logging/log.hpp>
+
+#include <array>
#include <memory>
#include <optional>
-#include <phosphor-logging/log.hpp>
#include <string_view>
#include <tuple>
#include <utility>
@@ -292,7 +293,7 @@
{
return std::visit(
[&p](const auto& arg) {
- return PackSingle<std::decay_t<decltype(arg)>>::op(p, arg);
+ return PackSingle<std::decay_t<decltype(arg)>>::op(p, arg);
},
v);
}
diff --git a/include/ipmid/message/types.hpp b/include/ipmid/message/types.hpp
index 1da2574..c53529b 100644
--- a/include/ipmid/message/types.hpp
+++ b/include/ipmid/message/types.hpp
@@ -15,10 +15,11 @@
*/
#pragma once
-#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/version.hpp>
#include <ipmid/utility.hpp>
+
+#include <bitset>
#include <tuple>
#if BOOST_VERSION < 107900
diff --git a/include/ipmid/message/unpack.hpp b/include/ipmid/message/unpack.hpp
index 3a80c3f..afa17e3 100644
--- a/include/ipmid/message/unpack.hpp
+++ b/include/ipmid/message/unpack.hpp
@@ -15,8 +15,9 @@
*/
#pragma once
-#include <array>
#include <ipmid/message/types.hpp>
+
+#include <array>
#include <optional>
#include <string>
#include <tuple>
diff --git a/include/ipmid/oemrouter.hpp b/include/ipmid/oemrouter.hpp
index ef0e697..2e4ea23 100644
--- a/include/ipmid/oemrouter.hpp
+++ b/include/ipmid/oemrouter.hpp
@@ -2,11 +2,12 @@
#include <ipmid/api.h>
+#include <ipmid/iana.hpp>
+
#include <array>
#include <cstddef>
#include <cstdint>
#include <functional>
-#include <ipmid/iana.hpp>
#include <vector>
namespace oem
@@ -29,9 +30,7 @@
class Router
{
public:
- virtual ~Router()
- {
- }
+ virtual ~Router() {}
/// Enable message routing to begin.
virtual void activate() = 0;
diff --git a/include/ipmid/types.hpp b/include/ipmid/types.hpp
index a36d612..98d0288 100644
--- a/include/ipmid/types.hpp
+++ b/include/ipmid/types.hpp
@@ -3,8 +3,9 @@
#include <openssl/crypto.h>
#include <stdint.h>
-#include <map>
#include <sdbusplus/server.hpp>
+
+#include <map>
#include <string>
#include <variant>
diff --git a/include/ipmid/utility.hpp b/include/ipmid/utility.hpp
index 0c39e92..a3f306f 100644
--- a/include/ipmid/utility.hpp
+++ b/include/ipmid/utility.hpp
@@ -16,6 +16,7 @@
#pragma once
#include <boost/asio/spawn.hpp>
#include <boost/callable_traits.hpp>
+
#include <cstdint>
#include <map>
#include <memory>
@@ -46,10 +47,9 @@
struct StripFirstArgs;
template <std::size_t N, typename FirstArg, typename... Rest>
-struct StripFirstArgs<N, std::tuple<FirstArg, Rest...>>
- : StripFirstArgs<N - 1, std::tuple<Rest...>>
-{
-};
+struct StripFirstArgs<N, std::tuple<FirstArg, Rest...>> :
+ StripFirstArgs<N - 1, std::tuple<Rest...>>
+{};
template <typename FirstArg, typename... Rest>
struct StripFirstArgs<0, std::tuple<FirstArg, Rest...>>
@@ -206,20 +206,17 @@
*/
template <typename>
struct is_tuple : std::false_type
-{
-};
+{};
template <typename... T>
struct is_tuple<std::tuple<T...>> : std::true_type
-{
-};
+{};
/** @brief used for static_assert in a constexpr-if else statement
*/
template <typename T>
struct dependent_false : std::false_type
-{
-};
+{};
} // namespace utility
diff --git a/include/ipmid/utils.hpp b/include/ipmid/utils.hpp
index ebd97e0..20f9847 100644
--- a/include/ipmid/utils.hpp
+++ b/include/ipmid/utils.hpp
@@ -1,13 +1,14 @@
#pragma once
#include <boost/system/error_code.hpp>
-#include <chrono>
#include <ipmid/api-types.hpp>
#include <ipmid/message.hpp>
#include <ipmid/types.hpp>
-#include <optional>
#include <sdbusplus/server.hpp>
+#include <chrono>
+#include <optional>
+
namespace ipmi
{
diff --git a/ipmi_fru_info_area.cpp b/ipmi_fru_info_area.cpp
index 155e88b..a970467 100644
--- a/ipmi_fru_info_area.cpp
+++ b/ipmi_fru_info_area.cpp
@@ -1,11 +1,12 @@
#include "ipmi_fru_info_area.hpp"
+#include <phosphor-logging/elog.hpp>
+
#include <algorithm>
#include <ctime>
#include <iomanip>
#include <map>
#include <numeric>
-#include <phosphor-logging/elog.hpp>
#include <sstream>
namespace ipmi
@@ -45,8 +46,8 @@
static constexpr auto secs_from_1970_1996 = 820454400;
static constexpr auto maxMfgDateValue = 0xFFFFFF; // 3 Byte length
static constexpr auto secs_per_min = 60;
-static constexpr auto secsToMaxMfgdate =
- secs_from_1970_1996 + secs_per_min * maxMfgDateValue;
+static constexpr auto secsToMaxMfgdate = secs_from_1970_1996 +
+ secs_per_min * maxMfgDateValue;
// Minimum size of resulting FRU blob.
// This is also the theoretical maximum size according to the spec:
@@ -116,8 +117,8 @@
padData(data);
// Set size of data info area
- data.at(areaSizeOffset) =
- (data.size() + checksumSize) / (recordUnitOfMeasurement);
+ data.at(areaSizeOffset) = (data.size() + checksumSize) /
+ (recordUnitOfMeasurement);
// Finally add area checksum
appendDataChecksum(data);
diff --git a/ipmid-new.cpp b/ipmid-new.cpp
index f3d12c6..2a78c68 100644
--- a/ipmid-new.cpp
+++ b/ipmid-new.cpp
@@ -19,14 +19,9 @@
#include <dlfcn.h>
-#include <algorithm>
-#include <any>
#include <boost/algorithm/string.hpp>
#include <boost/asio/io_context.hpp>
#include <dcmihandler.hpp>
-#include <exception>
-#include <filesystem>
-#include <forward_list>
#include <host-cmd-manager.hpp>
#include <ipmid-host/cmd.hpp>
#include <ipmid/api.hpp>
@@ -34,9 +29,6 @@
#include <ipmid/message.hpp>
#include <ipmid/oemrouter.hpp>
#include <ipmid/types.hpp>
-#include <map>
-#include <memory>
-#include <optional>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/asio/connection.hpp>
#include <sdbusplus/asio/object_server.hpp>
@@ -44,6 +36,15 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/timer.hpp>
+
+#include <algorithm>
+#include <any>
+#include <exception>
+#include <filesystem>
+#include <forward_list>
+#include <map>
+#include <memory>
+#include <optional>
#include <tuple>
#include <unordered_map>
#include <utility>
@@ -285,8 +286,8 @@
return errorResponse(request, ccReqDataLenInvalid);
}
auto group = static_cast<Group>(bytes);
- message::Response::ptr response =
- executeIpmiCommandCommon(groupHandlerMap, group, request);
+ message::Response::ptr response = executeIpmiCommandCommon(groupHandlerMap,
+ group, request);
ipmi::message::Payload prefix;
prefix.pack(bytes);
response->prepend(prefix);
@@ -302,8 +303,8 @@
return errorResponse(request, ccReqDataLenInvalid);
}
auto iana = static_cast<Iana>(bytes);
- message::Response::ptr response =
- executeIpmiCommandCommon(oemHandlerMap, iana, request);
+ message::Response::ptr response = executeIpmiCommandCommon(oemHandlerMap,
+ iana, request);
ipmi::message::Payload prefix;
prefix.pack(bytes);
response->prepend(prefix);
@@ -351,28 +352,27 @@
conn.async_method_call(
[name](const boost::system::error_code ec,
const std::string& nameOwner) {
- if (ec)
- {
- log<level::ERR>("Error getting dbus owner",
- entry("INTERFACE=%s", name.c_str()));
- return;
- }
- // start after ipmiDbusChannelPrefix (after the '.')
- std::string chName =
- name.substr(std::strlen(ipmiDbusChannelMatch) + 1);
- try
- {
- uint8_t channel = getChannelByName(chName);
- uniqueNameToChannelNumber[nameOwner] = channel;
- log<level::INFO>("New interface mapping",
- entry("INTERFACE=%s", name.c_str()),
- entry("CHANNEL=%u", channel));
- }
- catch (const std::exception& e)
- {
- log<level::INFO>("Failed interface mapping, no such name",
- entry("INTERFACE=%s", name.c_str()));
- }
+ if (ec)
+ {
+ log<level::ERR>("Error getting dbus owner",
+ entry("INTERFACE=%s", name.c_str()));
+ return;
+ }
+ // start after ipmiDbusChannelPrefix (after the '.')
+ std::string chName = name.substr(std::strlen(ipmiDbusChannelMatch) + 1);
+ try
+ {
+ uint8_t channel = getChannelByName(chName);
+ uniqueNameToChannelNumber[nameOwner] = channel;
+ log<level::INFO>("New interface mapping",
+ entry("INTERFACE=%s", name.c_str()),
+ entry("CHANNEL=%u", channel));
+ }
+ catch (const std::exception& e)
+ {
+ log<level::INFO>("Failed interface mapping, no such name",
+ entry("INTERFACE=%s", name.c_str()));
+ }
},
"org.freedesktop.DBus", "/", "org.freedesktop.DBus", "GetNameOwner",
name);
@@ -383,24 +383,24 @@
conn.async_method_call(
[&io, &conn](const boost::system::error_code ec,
std::vector<std::string> busNames) {
- if (ec)
- {
- log<level::ERR>("Error getting dbus names");
- std::exit(EXIT_FAILURE);
- return;
- }
- // Try to make startup consistent
- std::sort(busNames.begin(), busNames.end());
+ if (ec)
+ {
+ log<level::ERR>("Error getting dbus names");
+ std::exit(EXIT_FAILURE);
+ return;
+ }
+ // Try to make startup consistent
+ std::sort(busNames.begin(), busNames.end());
- const std::string channelPrefix =
- std::string(ipmiDbusChannelMatch) + ".";
- for (const std::string& busName : busNames)
+ const std::string channelPrefix = std::string(ipmiDbusChannelMatch) +
+ ".";
+ for (const std::string& busName : busNames)
+ {
+ if (busName.find(channelPrefix) == 0)
{
- if (busName.find(channelPrefix) == 0)
- {
- updateOwners(conn, busName);
- }
+ updateOwners(conn, busName);
}
+ }
},
"org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
"ListNames");
@@ -476,10 +476,10 @@
{
const auto dbusResponse =
[netFn, lun, cmd](Cc cc, const ipmi::SecureBuffer& data = {}) {
- constexpr uint8_t netFnResponse = 0x01;
- uint8_t retNetFn = netFn | netFnResponse;
- return std::make_tuple(retNetFn, lun, cmd, cc, data);
- };
+ constexpr uint8_t netFnResponse = 0x01;
+ uint8_t retNetFn = netFn | netFnResponse;
+ return std::make_tuple(retNetFn, lun, cmd, cc, data);
+ };
std::string sender = m.get_sender();
Privilege privilege = Privilege::None;
int rqSA = 0;
@@ -728,14 +728,10 @@
class LegacyRouter : public oem::Router
{
public:
- virtual ~LegacyRouter()
- {
- }
+ virtual ~LegacyRouter() {}
/// Enable message routing to begin.
- void activate() override
- {
- }
+ void activate() override {}
void registerHandler(Number oen, ipmi_cmd_t cmd, Handler handler) override
{
@@ -758,8 +754,8 @@
{
// make a copy so the next two moves don't wreak havoc on the stack
sdbusplus::message_t b{m};
- boost::asio::spawn(*getIoContext(), [b = std::move(b)](
- boost::asio::yield_context yield) {
+ boost::asio::spawn(*getIoContext(),
+ [b = std::move(b)](boost::asio::yield_context yield) {
sdbusplus::message_t m{std::move(b)};
unsigned char seq = 0, netFn = 0, lun = 0, cmd = 0;
ipmi::SecureBuffer data;
@@ -867,12 +863,12 @@
// set up boost::asio signal handling
std::function<SignalResponse(int)> stopAsioRunLoop =
[&io, &exitCode](int signalNumber) {
- log<level::INFO>("Received signal; quitting",
- entry("SIGNAL=%d", signalNumber));
- io->stop();
- exitCode = signalNumber;
- return SignalResponse::breakExecution;
- };
+ log<level::INFO>("Received signal; quitting",
+ entry("SIGNAL=%d", signalNumber));
+ io->stop();
+ exitCode = signalNumber;
+ return SignalResponse::breakExecution;
+ };
registerSignalHandler(ipmi::prioOpenBmcBase, SIGINT, stopAsioRunLoop);
registerSignalHandler(ipmi::prioOpenBmcBase, SIGTERM, stopAsioRunLoop);
diff --git a/ipmisensor.cpp b/ipmisensor.cpp
index 593f8a8..1401c55 100644
--- a/ipmisensor.cpp
+++ b/ipmisensor.cpp
@@ -39,7 +39,6 @@
int set_sensor_dbus_state_simple(const sensorRES_t* pRec,
const lookup_t* pTable, const char* value)
{
-
return set_sensor_dbus_state_s(pRec->sensor_number, pTable->member, value);
}
@@ -97,7 +96,6 @@
char* event_data_lookup(event_data_t* p, uint8_t b)
{
-
while (p->data != 0xFF)
{
if (p->data == b)
@@ -115,13 +113,11 @@
int set_sensor_dbus_state_fwprogress(const sensorRES_t* pRec,
const lookup_t* pTable, const char*)
{
-
char valuestring[128];
char* p = valuestring;
switch (pTable->offset)
{
-
case 0x00:
std::snprintf(
p, sizeof(valuestring), "POST Error, %s",
@@ -167,7 +163,6 @@
switch (pTable->offset)
{
-
case 0x00:
std::snprintf(p, sizeof(valuestring), "System Reconfigured");
break;
@@ -261,7 +256,6 @@
int findindex(const uint8_t sensor_type, int offset, int* index)
{
-
int i = 0, rc = 0;
lookup_t* pTable = g_ipmidbuslookup;
@@ -322,7 +316,6 @@
// if any bit is either asserted or Deasserted.
for (int i = 0; i < 8; i++)
{
-
if ((ISBITSET(pRec->assert_state7_0, i)) &&
(shouldReport(stype, i, &index)))
{
diff --git a/libipmid/sdbus-asio.cpp b/libipmid/sdbus-asio.cpp
index fb71805..0f4cdaa 100644
--- a/libipmid/sdbus-asio.cpp
+++ b/libipmid/sdbus-asio.cpp
@@ -1,7 +1,8 @@
#include <boost/asio/io_context.hpp>
-#include <memory>
#include <sdbusplus/asio/connection.hpp>
+#include <memory>
+
namespace
{
diff --git a/libipmid/signals.cpp b/libipmid/signals.cpp
index 84287fc..757103a 100644
--- a/libipmid/signals.cpp
+++ b/libipmid/signals.cpp
@@ -1,8 +1,9 @@
#include <boost/asio/signal_set.hpp>
-#include <forward_list>
#include <ipmid/api.hpp>
-#include <memory>
#include <phosphor-logging/log.hpp>
+
+#include <forward_list>
+#include <memory>
#include <vector>
using namespace phosphor::logging;
@@ -100,8 +101,8 @@
if (!signals[signalNumber])
{
std::shared_ptr<boost::asio::io_context> io = getIoContext();
- signals[signalNumber] =
- std::make_unique<SignalHandler>(io, signalNumber);
+ signals[signalNumber] = std::make_unique<SignalHandler>(io,
+ signalNumber);
}
signals[signalNumber]->registerHandler(priority, handler);
}
diff --git a/libipmid/systemintf-sdbus.cpp b/libipmid/systemintf-sdbus.cpp
index abd30ec..a9a4e18 100644
--- a/libipmid/systemintf-sdbus.cpp
+++ b/libipmid/systemintf-sdbus.cpp
@@ -1,7 +1,8 @@
#include <ipmid/api.hpp>
-#include <memory>
#include <sdbusplus/asio/connection.hpp>
+#include <memory>
+
namespace
{
diff --git a/libipmid/utils.cpp b/libipmid/utils.cpp
index a2e4dd2..302c0b7 100644
--- a/libipmid/utils.cpp
+++ b/libipmid/utils.cpp
@@ -8,14 +8,15 @@
#include <sys/types.h>
#include <unistd.h>
-#include <algorithm>
-#include <chrono>
#include <ipmid/utils.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/message/types.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <algorithm>
+#include <chrono>
+
namespace ipmi
{
@@ -82,10 +83,10 @@
}
// else search the match string in the object path
- auto found = std::find_if(
- objectTree.begin(), objectTree.end(), [&match](const auto& object) {
- return (object.first.find(match) != std::string::npos);
- });
+ auto found = std::find_if(objectTree.begin(), objectTree.end(),
+ [&match](const auto& object) {
+ return (object.first.find(match) != std::string::npos);
+ });
if (found == objectTree.end())
{
@@ -103,7 +104,6 @@
const std::string& property,
std::chrono::microseconds timeout)
{
-
Value value;
auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
@@ -200,14 +200,12 @@
ServiceCache::ServiceCache(const std::string& intf, const std::string& path) :
intf(intf), path(path), cachedService(std::nullopt),
cachedBusName(std::nullopt)
-{
-}
+{}
ServiceCache::ServiceCache(std::string&& intf, std::string&& path) :
intf(std::move(intf)), path(std::move(path)), cachedService(std::nullopt),
cachedBusName(std::nullopt)
-{
-}
+{}
const std::string& ServiceCache::getService(sdbusplus::bus_t& bus)
{
@@ -241,10 +239,10 @@
std::string getService(sdbusplus::bus_t& bus, const std::string& intf,
const std::string& path)
{
- auto mapperCall =
- bus.new_method_call("xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetObject");
+ auto mapperCall = bus.new_method_call("xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper",
+ "GetObject");
mapperCall.append(path);
mapperCall.append(std::vector<std::string>({intf}));
@@ -462,10 +460,10 @@
}
// else search the match string in the object path
- auto found = std::find_if(
- objectTree.begin(), objectTree.end(), [&match](const auto& object) {
- return (object.first.find(match) != std::string::npos);
- });
+ auto found = std::find_if(objectTree.begin(), objectTree.end(),
+ [&match](const auto& object) {
+ return (object.first.find(match) != std::string::npos);
+ });
if (found == objectTree.end())
{
diff --git a/read_fru_data.cpp b/read_fru_data.cpp
index fe61a61..25be922 100644
--- a/read_fru_data.cpp
+++ b/read_fru_data.cpp
@@ -2,15 +2,16 @@
#include "fruread.hpp"
-#include <algorithm>
#include <ipmid/api.hpp>
#include <ipmid/types.hpp>
#include <ipmid/utils.hpp>
-#include <map>
#include <phosphor-logging/elog-errors.hpp>
#include <sdbusplus/message/types.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <algorithm>
+#include <map>
+
extern const FruMap frus;
namespace ipmi
{
@@ -94,9 +95,10 @@
}
for (const auto& [fruId, instanceList] : frus)
{
- auto found = std::find_if(
- instanceList.begin(), instanceList.end(),
- [&path](const auto& iter) { return (iter.path == path); });
+ auto found = std::find_if(instanceList.begin(), instanceList.end(),
+ [&path](const auto& iter) {
+ return (iter.path == path);
+ });
if (found != instanceList.end())
{
@@ -143,8 +145,8 @@
{
for (auto& intf : instance.interfaces)
{
- ipmi::PropertyMap allProp =
- readAllProperties(intf.first, instance.path);
+ ipmi::PropertyMap allProp = readAllProperties(intf.first,
+ instance.path);
for (auto& properties : intf.second)
{
auto iter = allProp.find(properties.first);
diff --git a/read_fru_data.hpp b/read_fru_data.hpp
index cd5f661..e0997fd 100644
--- a/read_fru_data.hpp
+++ b/read_fru_data.hpp
@@ -2,6 +2,7 @@
#include "ipmi_fru_info_area.hpp"
#include <sdbusplus/bus.hpp>
+
#include <string>
namespace ipmi
diff --git a/selutility.cpp b/selutility.cpp
index e6b28de..8d327d2 100644
--- a/selutility.cpp
+++ b/selutility.cpp
@@ -2,16 +2,17 @@
#include "selutility.hpp"
-#include <charconv>
-#include <chrono>
-#include <filesystem>
#include <ipmid/api.hpp>
#include <ipmid/types.hpp>
#include <ipmid/utils.hpp>
#include <phosphor-logging/elog-errors.hpp>
-#include <vector>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <charconv>
+#include <chrono>
+#include <filesystem>
+#include <vector>
+
extern const ipmi::sensor::InvObjectIDMap invSensors;
using namespace phosphor::logging;
using InternalFailure =
@@ -291,8 +292,8 @@
// Evaluate if the event is assertion or deassertion event
if (std::get<bool>(iterResolved->second))
{
- record.event.eventRecord.eventType =
- deassertEvent | iter->second.eventReadingType;
+ record.event.eventRecord.eventType = deassertEvent |
+ iter->second.eventReadingType;
}
else
{
@@ -316,8 +317,8 @@
auto service = ipmi::getService(bus, assocIntf, objPath);
// Read the Associations interface.
- auto methodCall =
- bus.new_method_call(service.c_str(), objPath.c_str(), propIntf, "Get");
+ auto methodCall = bus.new_method_call(service.c_str(), objPath.c_str(),
+ propIntf, "Get");
methodCall.append(assocIntf);
methodCall.append(assocProp);
@@ -375,8 +376,8 @@
using namespace std::string_literals;
static const auto propTimeStamp = "Timestamp"s;
- auto methodCall =
- bus.new_method_call(service.c_str(), objPath.c_str(), propIntf, "Get");
+ auto methodCall = bus.new_method_call(service.c_str(), objPath.c_str(),
+ propIntf, "Get");
methodCall.append(logEntryIntf);
methodCall.append(propTimeStamp);
@@ -423,14 +424,14 @@
std::sort(paths.begin(), paths.end(),
[](const std::string& a, const std::string& b) {
- namespace fs = std::filesystem;
- fs::path pathA(a);
- fs::path pathB(b);
- auto idA = std::stoul(pathA.filename().string());
- auto idB = std::stoul(pathB.filename().string());
+ namespace fs = std::filesystem;
+ fs::path pathA(a);
+ fs::path pathB(b);
+ auto idA = std::stoul(pathA.filename().string());
+ auto idB = std::stoul(pathB.filename().string());
- return idA < idB;
- });
+ return idA < idB;
+ });
}
} // namespace sel
diff --git a/selutility.hpp b/selutility.hpp
index fa28fb1..3c9b098 100644
--- a/selutility.hpp
+++ b/selutility.hpp
@@ -1,11 +1,12 @@
#pragma once
+#include <ipmid/types.hpp>
+#include <sdbusplus/server.hpp>
+
#include <chrono>
#include <cstdint>
#include <iomanip>
#include <iostream>
-#include <ipmid/types.hpp>
-#include <sdbusplus/server.hpp>
#include <sstream>
namespace ipmi
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index a645336..e29cfac 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -2,14 +2,15 @@
#include "sensorhandler.hpp"
-#include <bitset>
-#include <filesystem>
#include <ipmid/types.hpp>
#include <ipmid/utils.hpp>
-#include <optional>
#include <sdbusplus/message/types.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <bitset>
+#include <filesystem>
+#include <optional>
+
namespace ipmi
{
namespace sensor
@@ -259,9 +260,9 @@
ipmi_ret_t eventdata(const SetSensorReadingReq&, const Info& sensorInfo,
uint8_t data)
{
- auto msg =
- makeDbusMsg("org.freedesktop.DBus.Properties", sensorInfo.sensorPath,
- "Set", sensorInfo.sensorInterface);
+ auto msg = makeDbusMsg("org.freedesktop.DBus.Properties",
+ sensorInfo.sensorPath, "Set",
+ sensorInfo.sensorInterface);
const auto& interface = sensorInfo.propertyInterfaces.begin();
msg.append(interface->first);
diff --git a/sensordatahandler.hpp b/sensordatahandler.hpp
index 601f5cd..6c3a8e5 100644
--- a/sensordatahandler.hpp
+++ b/sensordatahandler.hpp
@@ -4,7 +4,6 @@
#include "sensorhandler.hpp"
-#include <cmath>
#include <ipmid/api.hpp>
#include <ipmid/types.hpp>
#include <ipmid/utils.hpp>
@@ -12,6 +11,8 @@
#include <phosphor-logging/log.hpp>
#include <sdbusplus/message/types.hpp>
+#include <cmath>
+
#ifdef FEATURE_SENSORS_CACHE
extern ipmi::sensor::SensorCacheMap sensorCacheMap;
@@ -252,8 +253,8 @@
double value = std::get<T>(propValue) *
std::pow(10, sensorInfo.scale - sensorInfo.exponentR);
- int32_t rawData =
- (value - sensorInfo.scaledOffset) / sensorInfo.coefficientM;
+ int32_t rawData = (value - sensorInfo.scaledOffset) /
+ sensorInfo.coefficientM;
constexpr uint8_t sensorUnitsSignedBits = 2 << 6;
constexpr uint8_t signedDataFormat = 0x80;
@@ -445,8 +446,8 @@
double value = std::get<T>(iter->second) *
std::pow(10, sensorInfo.scale - sensorInfo.exponentR);
- int32_t rawData =
- (value - sensorInfo.scaledOffset) / sensorInfo.coefficientM;
+ int32_t rawData = (value - sensorInfo.scaledOffset) /
+ sensorInfo.coefficientM;
constexpr uint8_t sensorUnitsSignedBits = 2 << 6;
constexpr uint8_t signedDataFormat = 0x80;
@@ -523,9 +524,9 @@
ipmi_ret_t readingAssertion(const SetSensorReadingReq& cmdData,
const Info& sensorInfo)
{
- auto msg =
- makeDbusMsg("org.freedesktop.DBus.Properties", sensorInfo.sensorPath,
- "Set", sensorInfo.sensorInterface);
+ auto msg = makeDbusMsg("org.freedesktop.DBus.Properties",
+ sensorInfo.sensorPath, "Set",
+ sensorInfo.sensorInterface);
const auto& interface = sensorInfo.propertyInterfaces.begin();
msg.append(interface->first);
@@ -548,14 +549,14 @@
ipmi_ret_t readingData(const SetSensorReadingReq& cmdData,
const Info& sensorInfo)
{
- T raw_value =
- (sensorInfo.coefficientM * cmdData.reading) + sensorInfo.scaledOffset;
+ T raw_value = (sensorInfo.coefficientM * cmdData.reading) +
+ sensorInfo.scaledOffset;
raw_value *= std::pow(10, sensorInfo.exponentR - sensorInfo.scale);
- auto msg =
- makeDbusMsg("org.freedesktop.DBus.Properties", sensorInfo.sensorPath,
- "Set", sensorInfo.sensorInterface);
+ auto msg = makeDbusMsg("org.freedesktop.DBus.Properties",
+ sensorInfo.sensorPath, "Set",
+ sensorInfo.sensorInterface);
const auto& interface = sensorInfo.propertyInterfaces.begin();
msg.append(interface->first);
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 8acabdf..84b6e9d 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -8,19 +8,20 @@
#include <mapper.h>
#include <systemd/sd-bus.h>
-#include <bitset>
-#include <cmath>
-#include <cstring>
#include <ipmid/api.hpp>
#include <ipmid/types.hpp>
#include <ipmid/utils.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/message/types.hpp>
-#include <set>
#include <xyz/openbmc_project/Common/error.hpp>
#include <xyz/openbmc_project/Sensor/Value/server.hpp>
+#include <bitset>
+#include <cmath>
+#include <cstring>
+#include <set>
+
static constexpr uint8_t fruInventoryDevice = 0x10;
static constexpr uint8_t IPMIFruInventory = 0x02;
static constexpr uint8_t BMCSlaveAddress = 0x20;
@@ -159,11 +160,11 @@
std::make_unique<sdbusplus::bus::match_t>(
bus, interfacesRemoved() + argNpath(0, s.second.sensorPath),
[id = s.first](auto& /*msg*/) {
- // Ideally this should work.
- // But when a service is terminated or crashed, it does not
- // emit interfacesRemoved signal. In that case it's handled
- // by sensorsOwnerMatch
- sensorCacheMap[id].reset();
+ // Ideally this should work.
+ // But when a service is terminated or crashed, it does not
+ // emit interfacesRemoved signal. In that case it's handled
+ // by sensorsOwnerMatch
+ sensorCacheMap[id].reset();
}));
sensorUpdatedMatches.emplace(
s.first, std::make_unique<sdbusplus::bus::match_t>(
@@ -172,23 +173,22 @@
member("PropertiesChanged"s) +
interface("org.freedesktop.DBus.Properties"s),
[&s](auto& msg) {
- fillSensorIdServiceMap(
- s.second.sensorPath,
- s.second.propertyInterfaces.begin()->first,
- s.first);
- try
- {
- // This is signal callback
- std::string interfaceName;
- msg.read(interfaceName);
- ipmi::PropertyMap props;
- msg.read(props);
- s.second.getFunc(s.first, s.second, props);
- }
- catch (const std::exception& e)
- {
- sensorCacheMap[s.first].reset();
- }
+ fillSensorIdServiceMap(s.second.sensorPath,
+ s.second.propertyInterfaces.begin()->first,
+ s.first);
+ try
+ {
+ // This is signal callback
+ std::string interfaceName;
+ msg.read(interfaceName);
+ ipmi::PropertyMap props;
+ msg.read(props);
+ s.second.getFunc(s.first, s.second, props);
+ }
+ catch (const std::exception& e)
+ {
+ sensorCacheMap[s.first].reset();
+ }
}));
}
sensorsOwnerMatch = std::make_unique<sdbusplus::bus::match_t>(
@@ -270,7 +270,6 @@
int set_sensor_dbus_state_s(uint8_t number, const char* method,
const char* value)
{
-
dbus_interface_t a;
int r;
sd_bus_error error = SD_BUS_ERROR_NULL;
@@ -316,7 +315,6 @@
int set_sensor_dbus_state_y(uint8_t number, const char* method,
const uint8_t value)
{
-
dbus_interface_t a;
int r;
sd_bus_error error = SD_BUS_ERROR_NULL;
@@ -362,7 +360,6 @@
uint8_t dbus_to_sensor_type(char* p)
{
-
sensorTypemap_t* s = g_SensorTypeMap;
char r = 0;
while (s->number != 0xFF)
@@ -383,7 +380,6 @@
uint8_t get_type_from_interface(dbus_interface_t dbus_if)
{
-
uint8_t type;
// This is where sensors that do not exist in dbus but do
@@ -911,7 +907,6 @@
// verifiy all needed fields are present
if (lowerCriticalThreshMask || upperCriticalThreshMask)
{
-
ipmi::PropertyMap findThreshold;
ec = ipmi::getAllDbusProperties(ctx, service, info.sensorPath,
criticalThreshIntf, findThreshold);
@@ -1011,8 +1006,8 @@
const auto& entityRecords =
ipmi::sensor::EntityInfoMapContainer::getContainer()
->getIpmiEntityRecords();
- sdrCount =
- ipmi::sensor::sensors.size() + frus.size() + entityRecords.size();
+ sdrCount = ipmi::sensor::sensors.size() + frus.size() +
+ entityRecords.size();
}
else if (count.value_or(0) == getSensorCount)
{
@@ -1185,10 +1180,10 @@
const auto& entityRecords =
ipmi::sensor::EntityInfoMapContainer::getContainer()
->getIpmiEntityRecords();
- auto next_record_id =
- (entityRecords.size())
- ? entityRecords.begin()->first + ENTITY_RECORD_ID_START
- : END_OF_RECORD;
+ auto next_record_id = (entityRecords.size())
+ ? entityRecords.begin()->first +
+ ENTITY_RECORD_ID_START
+ : END_OF_RECORD;
get_sdr::response::set_next_record_id(next_record_id, resp);
}
else
@@ -1392,8 +1387,8 @@
*data_len);
// data_len should include the LSB and MSB:
- *data_len +=
- sizeof(resp->next_record_id_lsb) + sizeof(resp->next_record_id_msb);
+ *data_len += sizeof(resp->next_record_id_lsb) +
+ sizeof(resp->next_record_id_msb);
return ret;
}
@@ -1469,8 +1464,8 @@
std::vector<uint8_t> eventData(req->data, req->data + count);
sdbusplus::bus_t dbus(bus);
- std::string service =
- ipmi::getService(dbus, ipmiSELAddInterface, ipmiSELPath);
+ std::string service = ipmi::getService(dbus, ipmiSELAddInterface,
+ ipmiSELPath);
sdbusplus::message_t writeSEL = dbus.new_method_call(
service.c_str(), ipmiSELPath, ipmiSELAddInterface, "IpmiSelAdd");
writeSEL.append(ipmiSELAddMessage, sensorPath, eventData, assert,
diff --git a/sensorhandler.hpp b/sensorhandler.hpp
index 357ade4..75212d8 100644
--- a/sensorhandler.hpp
+++ b/sensorhandler.hpp
@@ -2,10 +2,11 @@
#include <stdint.h>
-#include <exception>
#include <ipmid/api.hpp>
#include <ipmid/types.hpp>
+#include <exception>
+
// IPMI commands for net functions.
enum ipmi_netfn_sen_cmds
{
@@ -69,8 +70,8 @@
uint8_t data[3];
};
-static constexpr char const* ipmiSELPath = "/xyz/openbmc_project/Logging/IPMI";
-static constexpr char const* ipmiSELAddInterface =
+static constexpr const char* ipmiSELPath = "/xyz/openbmc_project/Logging/IPMI";
+static constexpr const char* ipmiSELAddInterface =
"xyz.openbmc_project.Logging.IPMI";
static const std::string ipmiSELAddMessage = "SEL Entry";
diff --git a/settings.cpp b/settings.cpp
index 778dbd8..862aa63 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -65,8 +65,8 @@
Service Objects::service(const Path& path, const Interface& interface) const
{
using Interfaces = std::vector<Interface>;
- auto mapperCall =
- bus.new_method_call(mapperService, mapperPath, mapperIntf, "GetObject");
+ auto mapperCall = bus.new_method_call(mapperService, mapperPath, mapperIntf,
+ "GetObject");
mapperCall.append(path);
mapperCall.append(Interfaces({interface}));
diff --git a/settings.hpp b/settings.hpp
index 1f96242..e813f06 100644
--- a/settings.hpp
+++ b/settings.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <sdbusplus/bus.hpp>
+
#include <string>
#include <tuple>
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index 333d4d7..0c2c9bd 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -17,10 +17,11 @@
#include "softoff.hpp"
-#include <chrono>
#include <ipmid/utils.hpp>
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Control/Host/server.hpp>
+
+#include <chrono>
namespace phosphor
{
namespace ipmi
@@ -31,8 +32,8 @@
void SoftPowerOff::sendHostShutDownCmd()
{
- auto ctrlHostPath =
- std::string{CONTROL_HOST_OBJ_MGR} + '/' + HOST_NAME + '0';
+ auto ctrlHostPath = std::string{CONTROL_HOST_OBJ_MGR} + '/' + HOST_NAME +
+ '0';
auto host = ::ipmi::getService(this->bus, CONTROL_HOST_BUSNAME,
ctrlHostPath.c_str());
diff --git a/softoff/softoff.hpp b/softoff/softoff.hpp
index 23ff5db..c78710b 100644
--- a/softoff/softoff.hpp
+++ b/softoff/softoff.hpp
@@ -2,12 +2,13 @@
#include "config.h"
-#include <functional>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>
#include <sdbusplus/timer.hpp>
#include <xyz/openbmc_project/Control/Host/server.hpp>
#include <xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/server.hpp>
+
+#include <functional>
namespace phosphor
{
namespace ipmi
diff --git a/storageaddsel.cpp b/storageaddsel.cpp
index 6b53f87..432f712 100644
--- a/storageaddsel.cpp
+++ b/storageaddsel.cpp
@@ -6,17 +6,18 @@
#include <mapper.h>
#include <systemd/sd-bus.h>
+#include <ipmid/api.hpp>
+#include <ipmid/types.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <xyz/openbmc_project/Logging/Entry/server.hpp>
+
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
-#include <ipmid/api.hpp>
-#include <ipmid/types.hpp>
#include <memory>
-#include <phosphor-logging/elog.hpp>
#include <vector>
-#include <xyz/openbmc_project/Logging/Entry/server.hpp>
using namespace std;
using namespace phosphor::logging;
diff --git a/storagehandler.cpp b/storagehandler.cpp
index 08fdda7..61cf42e 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -11,22 +11,23 @@
#include <mapper.h>
#include <systemd/sd-bus.h>
+#include <ipmid/api.hpp>
+#include <ipmid/utils.hpp>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/server.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/Logging/SEL/error.hpp>
+
#include <algorithm>
#include <chrono>
#include <cstdio>
#include <cstring>
#include <filesystem>
-#include <ipmid/api.hpp>
-#include <ipmid/utils.hpp>
#include <optional>
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/server.hpp>
#include <string>
#include <variant>
-#include <xyz/openbmc_project/Common/error.hpp>
-#include <xyz/openbmc_project/Logging/SEL/error.hpp>
void register_netfn_storage_functions() __attribute__((constructor));
@@ -237,12 +238,12 @@
uint32_t, // most recent addition timestamp
uint32_t, // most recent erase timestamp.
- bool, // SEL allocation info supported
- bool, // reserve SEL supported
- bool, // partial Add SEL Entry supported
- bool, // delete SEL supported
- uint3_t, // reserved
- bool // overflow flag
+ bool, // SEL allocation info supported
+ bool, // reserve SEL supported
+ bool, // partial Add SEL Entry supported
+ bool, // delete SEL supported
+ uint3_t, // reserved
+ bool // overflow flag
>
ipmiStorageGetSelInfo()
{
@@ -266,8 +267,7 @@
(ipmi::sel::getEntryTimeStamp(objPath).count()));
}
catch (const InternalFailure& e)
- {
- }
+ {}
catch (const std::runtime_error& e)
{
log<level::ERR>(e.what());
@@ -379,8 +379,8 @@
}
auto diff = ipmi::sel::selRecordSize - requestData->offset;
- auto readLength =
- std::min(diff, static_cast<int>(requestData->readLength));
+ auto readLength = std::min(diff,
+ static_cast<int>(requestData->readLength));
std::memcpy(response, &record.nextRecordID,
sizeof(record.nextRecordID));
@@ -406,7 +406,6 @@
>
deleteSELEntry(uint16_t reservationID, uint16_t selRecordID)
{
-
namespace fs = std::filesystem;
if (!checkSELReservation(reservationID))
@@ -517,9 +516,9 @@
sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
auto service = ipmi::getService(bus, ipmi::sel::logIntf, ipmi::sel::logObj);
- auto method =
- bus.new_method_call(service.c_str(), ipmi::sel::logObj,
- ipmi::sel::logIntf, ipmi::sel::logDeleteAllMethod);
+ auto method = bus.new_method_call(service.c_str(), ipmi::sel::logObj,
+ ipmi::sel::logIntf,
+ ipmi::sel::logDeleteAllMethod);
try
{
bus.call_noreply(method);
@@ -684,7 +683,6 @@
cancelSELReservation();
if (recordType == systemRecordType)
{
-
for (const auto& it : invSensors)
{
if (it.second.sensorID == sensorNumber)
@@ -718,8 +716,8 @@
using namespace ipmi::fru;
std::string service;
- boost::system::error_code ec =
- getService(ctx, invItemInterface, invObjPath + fruPath, service);
+ boost::system::error_code ec = getService(ctx, invItemInterface,
+ invObjPath + fruPath, service);
if (!ec)
{
bool result;
@@ -757,7 +755,6 @@
>
ipmiStorageGetFruInvAreaInfo(ipmi::Context::ptr ctx, uint8_t fruID)
{
-
auto iter = frus.find(fruID);
if (iter == frus.end())
{
@@ -849,7 +846,6 @@
uint8_t> // operation Support
ipmiGetRepositoryInfo()
{
-
constexpr uint8_t sdrVersion = 0x51;
constexpr uint16_t freeSpace = 0xFFFF;
constexpr uint32_t additionTimestamp = 0x0;
@@ -860,8 +856,8 @@
const auto& entityRecords =
ipmi::sensor::EntityInfoMapContainer::getContainer()
->getIpmiEntityRecords();
- uint16_t records =
- ipmi::sensor::sensors.size() + frus.size() + entityRecords.size();
+ uint16_t records = ipmi::sensor::sensors.size() + frus.size() +
+ entityRecords.size();
return ipmi::responseSuccess(sdrVersion, records, freeSpace,
additionTimestamp, deletionTimestamp,
diff --git a/sys_info_param.hpp b/sys_info_param.hpp
index 6088626..52a52be 100644
--- a/sys_info_param.hpp
+++ b/sys_info_param.hpp
@@ -12,9 +12,7 @@
class SysInfoParamStoreIntf
{
public:
- virtual ~SysInfoParamStoreIntf()
- {
- }
+ virtual ~SysInfoParamStoreIntf() {}
/**
* Returns true if parameter is found. If and only if s is non-null,
diff --git a/systemintfcmds.cpp b/systemintfcmds.cpp
index 23e80a2..1ab2322 100644
--- a/systemintfcmds.cpp
+++ b/systemintfcmds.cpp
@@ -5,10 +5,11 @@
#include "host-cmd-manager.hpp"
#include "host-interface.hpp"
-#include <cstring>
#include <ipmid-host/cmd.hpp>
#include <ipmid/api.hpp>
+#include <cstring>
+
void register_netfn_app_functions() __attribute__((constructor));
using namespace sdbusplus::xyz::openbmc_project::Control::server;
@@ -135,7 +136,6 @@
void register_netfn_app_functions()
{
-
// <Read Event Message Buffer>
ipmi_register_callback(NETFUN_APP, IPMI_CMD_READ_EVENT, NULL,
ipmi_app_read_event, SYSTEM_INTERFACE);
diff --git a/test/dbus-sdr/sensorcommands_unittest.cpp b/test/dbus-sdr/sensorcommands_unittest.cpp
index bcd2f44..6cdcd2b 100644
--- a/test/dbus-sdr/sensorcommands_unittest.cpp
+++ b/test/dbus-sdr/sensorcommands_unittest.cpp
@@ -67,8 +67,8 @@
if (bSigned)
{
int8_t expect = x;
- int8_t actual =
- ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp, bSigned);
+ int8_t actual = ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp,
+ bSigned);
result = actual;
yRoundtrip = ipmitool_y_from_x(actual, M, rExp, B, bExp, bSigned);
@@ -78,8 +78,8 @@
else
{
uint8_t expect = x;
- uint8_t actual =
- ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp, bSigned);
+ uint8_t actual = ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp,
+ bSigned);
result = actual;
yRoundtrip = ipmitool_y_from_x(actual, M, rExp, B, bExp, bSigned);
@@ -430,8 +430,8 @@
EXPECT_EQ(bExp, -1);
}
- scaledVal =
- ipmi::scaleIPMIValueFromDouble(5, mValue, rExp, bValue, bExp, bSigned);
+ scaledVal = ipmi::scaleIPMIValueFromDouble(5, mValue, rExp, bValue, bExp,
+ bSigned);
expected = 5 / (mValue * std::pow(10, rExp));
EXPECT_NEAR(scaledVal, expected, expected * 0.01);
diff --git a/test/entitymap_json_unittest.cpp b/test/entitymap_json_unittest.cpp
index a380a9e..4993351 100644
--- a/test/entitymap_json_unittest.cpp
+++ b/test/entitymap_json_unittest.cpp
@@ -2,6 +2,7 @@
#include <ipmid/types.hpp>
#include <nlohmann/json.hpp>
+
#include <utility>
#include <gmock/gmock.h>
diff --git a/test/message/pack.cpp b/test/message/pack.cpp
index 2eae1ec..334750e 100644
--- a/test/message/pack.cpp
+++ b/test/message/pack.cpp
@@ -483,8 +483,8 @@
sizeof(currentSessions) + 3 * sizeof(uint8_t) +
sizeof(uint32_t) + sizeof(uint8_t) * macSize +
sizeof(uint16_t));
- uint8_t protocol_channel =
- (static_cast<uint8_t>(protocol) << 4) | static_cast<uint8_t>(channel);
+ uint8_t protocol_channel = (static_cast<uint8_t>(protocol) << 4) |
+ static_cast<uint8_t>(channel);
ipmi::SecureBuffer k = {handle, maxSessions, currentSessions, userID, priv,
protocol_channel,
// ip addr
diff --git a/test/message/payload.cpp b/test/message/payload.cpp
index 59947c6..5931694 100644
--- a/test/message/payload.cpp
+++ b/test/message/payload.cpp
@@ -19,6 +19,7 @@
#include <ipmid/api.hpp>
#include <ipmid/message.hpp>
+
#include <stdexcept>
#include <gtest/gtest.h>
@@ -314,19 +315,22 @@
std::vector<std::string> logs;
-extern "C" {
-int sd_journal_send(const char* format, ...)
+extern "C"
{
- logs.push_back(format);
- return 0;
-}
+ int sd_journal_send(const char* format, ...)
+ {
+ logs.push_back(format);
+ return 0;
+ }
-int sd_journal_send_with_location(const char* /*file*/, const char* /*line*/,
- const char* /*func*/, const char* format, ...)
-{
- logs.push_back(format);
- return 0;
-}
+ int sd_journal_send_with_location(const char* /*file*/,
+ const char* /*line*/,
+ const char* /*func*/, const char* format,
+ ...)
+ {
+ logs.push_back(format);
+ return 0;
+ }
}
class PayloadLogging : public testing::Test
@@ -436,7 +440,6 @@
throw std::runtime_error("test");
}
catch (...)
- {
- }
+ {}
EXPECT_EQ(logs.size(), 0);
}
diff --git a/test/oemrouter_unittest.cpp b/test/oemrouter_unittest.cpp
index 49a1382..2be5f55 100644
--- a/test/oemrouter_unittest.cpp
+++ b/test/oemrouter_unittest.cpp
@@ -1,9 +1,10 @@
+#include "sample.h"
+
#include <ipmid/api.h>
-#include <cstring>
#include <ipmid/oemrouter.hpp>
-#include "sample.h"
+#include <cstring>
#include <gtest/gtest.h>
diff --git a/testaddsel.cpp b/testaddsel.cpp
index 424ecdd..9269afb 100644
--- a/testaddsel.cpp
+++ b/testaddsel.cpp
@@ -16,7 +16,6 @@
// step for mapping IPMI
int find_openbmc_path(const uint8_t num, dbus_interface_t* interface)
{
-
const char* objname = "/org/openbmc/managers/System";
char *str1, *str2, *str3;
diff --git a/testit.cpp b/testit.cpp
index 2541915..0a703ab 100644
--- a/testit.cpp
+++ b/testit.cpp
@@ -8,7 +8,6 @@
uint8_t find_type_for_sensor_number(uint8_t sensor_number)
{
-
int i = 0;
uint8_t rc;
@@ -45,10 +44,9 @@
return 0;
}
-int set_sensor_dbus_state_y(unsigned char number, char const* member,
+int set_sensor_dbus_state_y(unsigned char number, const char* member,
uint8_t value)
{
-
char val[2];
snprintf(val, 2, "%d", value);
@@ -111,7 +109,6 @@
int main()
{
-
testprep();
check_results(updateSensorRecordFromSSRAESC(testrec_bootprogress),
"setValue", "FW Progress, Docking station attachment");
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 1f8f353..eb012b8 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -344,9 +344,9 @@
const typename AddrFamily<family>::addr& address,
uint8_t prefix)
{
- auto newreq =
- bus.new_method_call(params.service.c_str(), params.logicalPath.c_str(),
- INTF_IP_CREATE, "IP");
+ auto newreq = bus.new_method_call(params.service.c_str(),
+ params.logicalPath.c_str(),
+ INTF_IP_CREATE, "IP");
std::string protocol =
sdbusplus::xyz::openbmc_project::Network::server::convertForMessage(
AddrFamily<family>::protocol);
@@ -426,8 +426,8 @@
}
ObjectLookupCache neighbors(bus, params, INTF_NEIGHBOR);
- auto neighbor =
- findStaticNeighbor<family>(bus, params, *gateway, neighbors);
+ auto neighbor = findStaticNeighbor<family>(bus, params, *gateway,
+ neighbors);
if (neighbor)
{
deleteObjectIfExists(bus, params.service, neighbor->path);
@@ -629,8 +629,8 @@
std::vector<IfAddr<AF_INET6>> ifaddrs6;
for (uint8_t i = 0; i < MAX_IPV6_STATIC_ADDRESSES; ++i)
{
- auto ifaddr6 =
- findIfAddr<AF_INET6>(bus, params, i, originsV6Static, ips);
+ auto ifaddr6 = findIfAddr<AF_INET6>(bus, params, i, originsV6Static,
+ ips);
if (!ifaddr6)
{
break;
@@ -1226,9 +1226,9 @@
return responseInvalidFieldRequest();
}
- uint8_t resp =
- getCipherConfigObject(csPrivFileName, csPrivDefaultFileName)
- .setCSPrivilegeLevels(channel, cipherSuitePrivs);
+ uint8_t resp = getCipherConfigObject(csPrivFileName,
+ csPrivDefaultFileName)
+ .setCSPrivilegeLevels(channel, cipherSuitePrivs);
if (!resp)
{
return responseSuccess();
@@ -1281,8 +1281,7 @@
listInit = true;
}
catch (const std::exception& e)
- {
- }
+ {}
}
switch (static_cast<LanParam>(parameter))
diff --git a/transporthandler.hpp b/transporthandler.hpp
index 537ddc5..8e1c4fb 100644
--- a/transporthandler.hpp
+++ b/transporthandler.hpp
@@ -6,6 +6,23 @@
#include <arpa/inet.h>
#include <netinet/ether.h>
+#include <ipmid/api-types.hpp>
+#include <ipmid/api.hpp>
+#include <ipmid/message.hpp>
+#include <ipmid/message/types.hpp>
+#include <ipmid/types.hpp>
+#include <ipmid/utils.hpp>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/exception.hpp>
+#include <user_channel/channel_layer.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/Network/EthernetInterface/server.hpp>
+#include <xyz/openbmc_project/Network/IP/server.hpp>
+#include <xyz/openbmc_project/Network/Neighbor/server.hpp>
+
#include <array>
#include <bitset>
#include <cinttypes>
@@ -13,30 +30,14 @@
#include <cstring>
#include <fstream>
#include <functional>
-#include <ipmid/api-types.hpp>
-#include <ipmid/api.hpp>
-#include <ipmid/message.hpp>
-#include <ipmid/message/types.hpp>
-#include <ipmid/types.hpp>
-#include <ipmid/utils.hpp>
#include <optional>
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/bus.hpp>
-#include <sdbusplus/exception.hpp>
#include <string>
#include <string_view>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
-#include <user_channel/channel_layer.hpp>
#include <utility>
#include <vector>
-#include <xyz/openbmc_project/Common/error.hpp>
-#include <xyz/openbmc_project/Network/EthernetInterface/server.hpp>
-#include <xyz/openbmc_project/Network/IP/server.hpp>
-#include <xyz/openbmc_project/Network/Neighbor/server.hpp>
namespace ipmi
{
@@ -257,8 +258,7 @@
/** @brief Generic paramters for different address families */
template <int family>
struct AddrFamily
-{
-};
+{};
/** @brief Parameter specialization for IPv4 */
template <>
@@ -339,8 +339,7 @@
bus(bus),
params(params), intf(intf),
objs(getAllDbusObjects(bus, params.logicalPath, intf, ""))
- {
- }
+ {}
class iterator : public ObjectTree::const_iterator
{
@@ -350,8 +349,7 @@
iterator(ObjectTree::const_iterator it, ObjectLookupCache& container) :
ObjectTree::const_iterator(it), container(container),
ret(container.cache.end())
- {
- }
+ {}
value_type& operator*()
{
ret = container.get(ObjectTree::const_iterator::operator*().first);
@@ -635,9 +633,9 @@
const typename AddrFamily<family>::addr& address,
const ether_addr& mac)
{
- auto newreq =
- bus.new_method_call(params.service.c_str(), params.logicalPath.c_str(),
- INTF_NEIGHBOR_CREATE_STATIC, "Neighbor");
+ auto newreq = bus.new_method_call(params.service.c_str(),
+ params.logicalPath.c_str(),
+ INTF_NEIGHBOR_CREATE_STATIC, "Neighbor");
std::string macStr = ether_ntoa(&mac);
newreq.append(addrToString<family>(address), macStr);
bus.call_noreply(newreq);
diff --git a/user_channel/channel_layer.hpp b/user_channel/channel_layer.hpp
index 42e5b5e..37d2b90 100644
--- a/user_channel/channel_layer.hpp
+++ b/user_channel/channel_layer.hpp
@@ -16,8 +16,9 @@
#pragma once
#include <openssl/crypto.h>
-#include <array>
#include <ipmid/api.hpp>
+
+#include <array>
#include <string>
namespace ipmi
diff --git a/user_channel/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp
index 94137ff..a179b37 100644
--- a/user_channel/channel_mgmt.cpp
+++ b/user_channel/channel_mgmt.cpp
@@ -25,13 +25,14 @@
#include <unistd.h>
#include <boost/interprocess/sync/scoped_lock.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus/match.hpp>
+#include <sdbusplus/server/object.hpp>
+
#include <cerrno>
#include <exception>
#include <filesystem>
#include <fstream>
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/bus/match.hpp>
-#include <sdbusplus/server/object.hpp>
#include <unordered_map>
namespace ipmi
@@ -180,7 +181,6 @@
std::string ChannelConfig::getChannelNameFromPath(const std::string& path)
{
-
constexpr size_t length = strlen(networkIntfObjectBasePath);
if (((length + 1) >= path.size()) ||
path.compare(0, length, networkIntfObjectBasePath))
@@ -350,11 +350,11 @@
dBusPropertiesInterface) +
sdbusplus::bus::match::rules::argN(0, networkChConfigIntfName),
[&](sdbusplus::message_t& msg) {
- DbusChObjProperties props;
- std::string iface;
- std::string path = msg.get_path();
- msg.read(iface, props);
- processChAccessPropChange(path, props);
+ DbusChObjProperties props;
+ std::string iface;
+ std::string path = msg.get_path();
+ msg.read(iface, props);
+ processChAccessPropChange(path, props);
});
signalHndlrObjectState = true;
@@ -774,8 +774,8 @@
EChannelSessSupported
ChannelConfig::convertToSessionSupportIndex(const std::string& value)
{
- auto iter =
- std::find(sessionSupportList.begin(), sessionSupportList.end(), value);
+ auto iter = std::find(sessionSupportList.begin(), sessionSupportList.end(),
+ value);
if (iter == sessionSupportList.end())
{
log<level::ERR>("Invalid session supported.",
@@ -981,11 +981,11 @@
ChannelProperties& chData = channelData[chNum];
chData.chID = chNum;
chData.chName = jsonChData[nameString].get<std::string>();
- chData.isChValid =
- channelFound && jsonChData[isValidString].get<bool>();
+ chData.isChValid = channelFound &&
+ jsonChData[isValidString].get<bool>();
chData.activeSessCount = jsonChData.value(activeSessionsString, 0);
- chData.maxTransferSize =
- jsonChData.value(maxTransferSizeString, smallChannelSize);
+ chData.maxTransferSize = jsonChData.value(maxTransferSizeString,
+ smallChannelSize);
if (jsonChData.count(isManagementNIC) != 0)
{
chData.isManagementNIC =
@@ -1310,9 +1310,9 @@
{
try
{
- auto method =
- bus.new_method_call(service.c_str(), objPath.c_str(),
- "org.freedesktop.DBus.Properties", "Set");
+ auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
+ "org.freedesktop.DBus.Properties",
+ "Set");
method.append(interface, property, value);
@@ -1339,9 +1339,9 @@
{
try
{
- auto method =
- bus.new_method_call(service.c_str(), objPath.c_str(),
- "org.freedesktop.DBus.Properties", "Get");
+ auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
+ "org.freedesktop.DBus.Properties",
+ "Get");
method.append(interface, property);
diff --git a/user_channel/channel_mgmt.hpp b/user_channel/channel_mgmt.hpp
index 9b03063..a8de017 100644
--- a/user_channel/channel_mgmt.hpp
+++ b/user_channel/channel_mgmt.hpp
@@ -20,10 +20,11 @@
#include <boost/interprocess/sync/file_lock.hpp>
#include <boost/interprocess/sync/named_recursive_mutex.hpp>
-#include <cstdint>
-#include <ctime>
#include <nlohmann/json.hpp>
#include <sdbusplus/bus.hpp>
+
+#include <cstdint>
+#include <ctime>
#include <variant>
namespace ipmi
diff --git a/user_channel/channelcommands.cpp b/user_channel/channelcommands.cpp
index 769f9ff..02a50ce 100644
--- a/user_channel/channelcommands.cpp
+++ b/user_channel/channelcommands.cpp
@@ -19,6 +19,7 @@
#include <ipmid/api.hpp>
#include <phosphor-logging/log.hpp>
+
#include <regex>
using namespace phosphor::logging;
@@ -255,8 +256,8 @@
return responseInvalidFieldRequest();
}
- uint8_t chNum =
- convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
+ uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
+ ctx->channel);
if (!isValidChannel(chNum))
{
log<level::DEBUG>("Get channel Info - No support on channel");
@@ -323,8 +324,8 @@
ipmiGetChannelPayloadSupport(Context::ptr ctx, uint4_t channel,
uint4_t reserved)
{
- uint8_t chNum =
- convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
+ uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
+ ctx->channel);
if (!doesDeviceExist(chNum) || !isValidChannel(chNum) || reserved)
{
@@ -367,8 +368,8 @@
ipmiGetChannelPayloadVersion(Context::ptr ctx, uint4_t chNum,
uint4_t reserved, uint8_t payloadTypeNum)
{
- uint8_t channel =
- convertCurrentChannelNum(static_cast<uint8_t>(chNum), ctx->channel);
+ uint8_t channel = convertCurrentChannelNum(static_cast<uint8_t>(chNum),
+ ctx->channel);
constexpr uint8_t payloadTypeNotSupported = 0x80;
if (reserved || !isValidChannel(channel))
diff --git a/user_channel/cipher_mgmt.cpp b/user_channel/cipher_mgmt.cpp
index 5f50c86..a2f024b 100644
--- a/user_channel/cipher_mgmt.cpp
+++ b/user_channel/cipher_mgmt.cpp
@@ -20,9 +20,10 @@
#include <sys/types.h>
#include <unistd.h>
+#include <phosphor-logging/log.hpp>
+
#include <filesystem>
#include <fstream>
-#include <phosphor-logging/log.hpp>
namespace ipmi
{
@@ -117,8 +118,8 @@
int CipherConfig::writeCSPrivilegeLevels(const Json& jsonData)
{
- std::string tmpFile =
- static_cast<std::string>(cipherSuitePrivFileName) + "_tmpXXXXXX";
+ std::string tmpFile = static_cast<std::string>(cipherSuitePrivFileName) +
+ "_tmpXXXXXX";
std::vector<char> tmpRandomFile(tmpFile.length() + 1);
strncpy(tmpRandomFile.data(), tmpFile.c_str(), tmpFile.length() + 1);
diff --git a/user_channel/cipher_mgmt.hpp b/user_channel/cipher_mgmt.hpp
index f2ea9f3..0bd6b1d 100644
--- a/user_channel/cipher_mgmt.hpp
+++ b/user_channel/cipher_mgmt.hpp
@@ -18,9 +18,10 @@
#include <ipmid/api-types.hpp>
#include <ipmid/message/types.hpp>
-#include <map>
#include <nlohmann/json.hpp>
+#include <map>
+
namespace ipmi
{
static const std::string csPrivDefaultFileName =
diff --git a/user_channel/passwd_mgr.cpp b/user_channel/passwd_mgr.cpp
index 9b232b5..7b5b7ec 100644
--- a/user_channel/passwd_mgr.cpp
+++ b/user_channel/passwd_mgr.cpp
@@ -26,11 +26,12 @@
#include <sys/stat.h>
#include <unistd.h>
+#include <phosphor-logging/log.hpp>
+
#include <cerrno>
#include <cstring>
#include <fstream>
#include <iomanip>
-#include <phosphor-logging/log.hpp>
namespace ipmi
{
@@ -199,8 +200,8 @@
inBytes, inBytesLen)))
{
outLen += outEVPLen;
- if ((retval =
- EVP_CipherFinal(ctx.get(), outBytes + outLen, &outEVPLen)))
+ if ((retval = EVP_CipherFinal(ctx.get(), outBytes + outLen,
+ &outEVPLen)))
{
outLen += outEVPLen;
*outBytesLen = outLen;
@@ -381,8 +382,8 @@
if (dataBuf.size() != 0)
{
- inBytesLen =
- dataBuf.size() + newUserName.size() + EVP_CIPHER_block_size(cipher);
+ inBytesLen = dataBuf.size() + newUserName.size() +
+ EVP_CIPHER_block_size(cipher);
}
SecureString inBytes(inBytesLen, '\0');
diff --git a/user_channel/passwd_mgr.hpp b/user_channel/passwd_mgr.hpp
index 8704f83..338f249 100644
--- a/user_channel/passwd_mgr.hpp
+++ b/user_channel/passwd_mgr.hpp
@@ -16,8 +16,9 @@
#pragma once
#include <openssl/evp.h>
-#include <ctime>
#include <ipmid/types.hpp>
+
+#include <ctime>
#include <string>
#include <unordered_map>
#include <vector>
diff --git a/user_channel/user_layer.cpp b/user_channel/user_layer.cpp
index bb9ac38..5a2e7e0 100644
--- a/user_channel/user_layer.cpp
+++ b/user_channel/user_layer.cpp
@@ -141,7 +141,6 @@
Cc ipmiUserGetPrivilegeAccess(const uint8_t userId, const uint8_t chNum,
PrivAccess& privAccess)
{
-
if (!UserAccess::isValidChannel(chNum))
{
return ccInvalidFieldRequest;
@@ -185,7 +184,6 @@
const uint8_t userId,
const PayloadAccess& payloadAccess)
{
-
if (!UserAccess::isValidChannel(chNum))
{
return ccInvalidFieldRequest;
@@ -202,7 +200,6 @@
Cc ipmiUserGetUserPayloadAccess(const uint8_t chNum, const uint8_t userId,
PayloadAccess& payloadAccess)
{
-
if (!UserAccess::isValidChannel(chNum))
{
return ccInvalidFieldRequest;
diff --git a/user_channel/user_layer.hpp b/user_channel/user_layer.hpp
index 82e0d31..8258f6b 100644
--- a/user_channel/user_layer.hpp
+++ b/user_channel/user_layer.hpp
@@ -15,9 +15,10 @@
*/
#pragma once
-#include <bitset>
#include <ipmid/api.hpp>
#include <ipmid/types.hpp>
+
+#include <bitset>
#include <string>
namespace ipmi
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index 7ffee61..2e6e841 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -25,19 +25,20 @@
#include <boost/interprocess/sync/named_recursive_mutex.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
-#include <cerrno>
-#include <fstream>
#include <ipmid/types.hpp>
#include <nlohmann/json.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
-#include <regex>
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/server/object.hpp>
-#include <variant>
#include <xyz/openbmc_project/Common/error.hpp>
#include <xyz/openbmc_project/User/Common/error.hpp>
+#include <cerrno>
+#include <fstream>
+#include <regex>
+#include <variant>
+
namespace ipmi
{
@@ -158,9 +159,9 @@
{
try
{
- auto method =
- bus.new_method_call(service.c_str(), objPath.c_str(),
- dBusPropertiesInterface, setPropertiesMethod);
+ auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
+ dBusPropertiesInterface,
+ setPropertiesMethod);
method.append(interface, property, value);
bus.call(method);
}
@@ -182,8 +183,8 @@
{
try
{
- userMgmtService =
- ipmi::getUserService(bus, userMgrInterface, userMgrObjBasePath);
+ userMgmtService = ipmi::getUserService(bus, userMgrInterface,
+ userMgrObjBasePath);
}
catch (const sdbusplus::exception_t& e)
{
@@ -656,8 +657,8 @@
return PAM_BUF_ERR;
}
- void* ptr =
- calloc(static_cast<size_t>(numMsg), sizeof(struct pam_response));
+ void* ptr = calloc(static_cast<size_t>(numMsg),
+ sizeof(struct pam_response));
if (ptr == nullptr)
{
free(pass);
@@ -690,8 +691,8 @@
const_cast<char*>(password)};
pam_handle_t* localAuthHandle = NULL; // this gets set by pam_start
- int retval =
- pam_start("passwd", username, &localConversation, &localAuthHandle);
+ int retval = pam_start("passwd", username, &localConversation,
+ &localAuthHandle);
if (retval != PAM_SUCCESS)
{
@@ -1398,8 +1399,8 @@
readPayloadAccessFromUserInfo(usersTbl.user[usrIndex], stdPayload,
oemPayload);
- Json jsonPayloadEnabledInfo =
- constructJsonPayloadEnables(stdPayload, oemPayload);
+ Json jsonPayloadEnabledInfo = constructJsonPayloadEnables(stdPayload,
+ oemPayload);
jsonUserInfo[payloadEnabledStr] = jsonPayloadEnabledInfo;
jsonUsersTbl.push_back(jsonUserInfo);
@@ -1662,7 +1663,7 @@
sdbusplus::bus::match::rules::interface(dBusObjManager) +
sdbusplus::bus::match::rules::path(userMgrObjBasePath),
[&](sdbusplus::message_t& msg) {
- userUpdatedSignalHandler(*this, msg);
+ userUpdatedSignalHandler(*this, msg);
});
userMgrRenamedSignal = std::make_unique<sdbusplus::bus::match_t>(
bus,
@@ -1670,7 +1671,7 @@
sdbusplus::bus::match::rules::interface(userMgrInterface) +
sdbusplus::bus::match::rules::path(userMgrObjBasePath),
[&](sdbusplus::message_t& msg) {
- userUpdatedSignalHandler(*this, msg);
+ userUpdatedSignalHandler(*this, msg);
});
userPropertiesSignal = std::make_unique<sdbusplus::bus::match_t>(
bus,
@@ -1681,7 +1682,7 @@
sdbusplus::bus::match::rules::member(propertiesChangedSignal) +
sdbusplus::bus::match::rules::argN(0, usersInterface),
[&](sdbusplus::message_t& msg) {
- userUpdatedSignalHandler(*this, msg);
+ userUpdatedSignalHandler(*this, msg);
});
signalHndlrObject = true;
}
@@ -1738,8 +1739,8 @@
{
// Group "ipmi" is present so lets update other properties
// in IPMI
- uint8_t priv =
- UserAccess::convertToIPMIPrivilege(usrPriv) & privMask;
+ uint8_t priv = UserAccess::convertToIPMIPrivilege(usrPriv) &
+ privMask;
// Update all channels priv, only if it is not equivalent to
// getUsrMgmtSyncIndex()
if (userData->user[usrIdx]
diff --git a/user_channel/user_mgmt.hpp b/user_channel/user_mgmt.hpp
index b3db460..74166c2 100644
--- a/user_channel/user_mgmt.hpp
+++ b/user_channel/user_mgmt.hpp
@@ -18,10 +18,11 @@
#include <boost/interprocess/sync/file_lock.hpp>
#include <boost/interprocess/sync/named_recursive_mutex.hpp>
-#include <cstdint>
-#include <ctime>
#include <ipmid/api.hpp>
#include <sdbusplus/bus.hpp>
+
+#include <cstdint>
+#include <ctime>
#include <variant>
namespace ipmi
diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp
index 4ea8c4b..6467e45 100644
--- a/user_channel/usercommands.cpp
+++ b/user_channel/usercommands.cpp
@@ -24,6 +24,7 @@
#include <ipmid/api.hpp>
#include <phosphor-logging/log.hpp>
+
#include <regex>
namespace ipmi
@@ -67,8 +68,8 @@
return ipmi::responseInvalidFieldRequest();
}
- uint8_t chNum =
- convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
+ uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
+ ctx->channel);
if (!isValidChannel(chNum))
{
log<level::DEBUG>("Set user access - Invalid channel request");
@@ -138,8 +139,8 @@
uint6_t userId, uint2_t reserved2)
{
- uint8_t chNum =
- convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
+ uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
+ ctx->channel);
if (reserved1 || reserved2 || !isValidChannel(chNum))
{
@@ -167,8 +168,8 @@
}
bool enabledState = false;
- retStatus =
- ipmiUserCheckEnabled(static_cast<uint8_t>(userId), enabledState);
+ retStatus = ipmiUserCheckEnabled(static_cast<uint8_t>(userId),
+ enabledState);
if (retStatus != ccSuccess)
{
return ipmi::response(retStatus);
@@ -318,8 +319,8 @@
}
else if (operation == opEnableUser || operation == opDisableUser)
{
- ipmi::Cc res =
- ipmiUserUpdateEnabledState(userId, static_cast<bool>(operation));
+ ipmi::Cc res = ipmiUserUpdateEnabledState(userId,
+ static_cast<bool>(operation));
return ipmi::response(res);
}
else if (operation == opTestPassword)
@@ -410,8 +411,8 @@
uint4_t privLevel,
uint4_t reserved2)
{
- uint8_t channel =
- convertCurrentChannelNum(static_cast<uint8_t>(chNum), ctx->channel);
+ uint8_t channel = convertCurrentChannelNum(static_cast<uint8_t>(chNum),
+ ctx->channel);
if (reserved1 || reserved2 || !isValidChannel(channel) ||
!isValidPrivLimit(static_cast<uint8_t>(privLevel)))
@@ -430,16 +431,16 @@
constexpr bool extDataSupport = true; // true for IPMI 2.0 extensions
constexpr bool reserved3 = false;
- constexpr uint6_t rmcpAuthTypes = 0; // IPMI 1.5 auth types - not supported
+ constexpr uint6_t rmcpAuthTypes = 0; // IPMI 1.5 auth types - not supported
constexpr uint2_t reserved4 = 0;
- constexpr bool KGStatus = false; // Not supporting now.
+ constexpr bool KGStatus = false; // Not supporting now.
constexpr bool perMessageAuth = false; // Per message auth - enabled
constexpr bool userAuth = false; // User authentication - enabled
constexpr bool nullUsers = false; // Null user names - not supported
constexpr bool anonymousLogin = false; // Anonymous login - not supported
constexpr uint6_t reserved5 = 0;
- constexpr bool rmcpp = true; // IPMI 2.0 - supported
- constexpr bool rmcp = false; // IPMI 1.5 - not supported
+ constexpr bool rmcpp = true; // IPMI 2.0 - supported
+ constexpr bool rmcp = false; // IPMI 1.5 - not supported
constexpr uint24_t oemID = 0;
constexpr uint8_t oemAuxillary = 0;
@@ -499,8 +500,8 @@
uint8_t oemPayloadEnables2Reserved)
{
- auto chNum =
- convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
+ auto chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
+ ctx->channel);
// Validate the reserved args. Only SOL payload is supported as on date.
if (reserved || stdPayload0ipmiReserved || stdPayload2 || stdPayload3 ||
stdPayload4 || stdPayload5 || stdPayload6 || stdPayload7 ||
@@ -566,27 +567,27 @@
* - oemPayloadEnables2Reserved - Reserved
*/
-ipmi::RspType<bool, // stdPayload0ipmiReserved
- bool, // stdPayload1SOL
- bool, // stdPayload2
- bool, // stdPayload3
- bool, // stdPayload4
- bool, // stdPayload5
- bool, // stdPayload6
- bool, // stdPayload7
+ipmi::RspType<bool, // stdPayload0ipmiReserved
+ bool, // stdPayload1SOL
+ bool, // stdPayload2
+ bool, // stdPayload3
+ bool, // stdPayload4
+ bool, // stdPayload5
+ bool, // stdPayload6
+ bool, // stdPayload7
uint8_t, // stdPayloadEnables2Reserved
- bool, // oemPayload0
- bool, // oemPayload1
- bool, // oemPayload2
- bool, // oemPayload3
- bool, // oemPayload4
- bool, // oemPayload5
- bool, // oemPayload6
- bool, // oemPayload7
+ bool, // oemPayload0
+ bool, // oemPayload1
+ bool, // oemPayload2
+ bool, // oemPayload3
+ bool, // oemPayload4
+ bool, // oemPayload5
+ bool, // oemPayload6
+ bool, // oemPayload7
- uint8_t // oemPayloadEnables2Reserved
+ uint8_t // oemPayloadEnables2Reserved
>
ipmiGetUserPayloadAccess(ipmi::Context::ptr ctx,
@@ -594,8 +595,8 @@
uint6_t userId, uint2_t reserved2)
{
- uint8_t chNum =
- convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
+ uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
+ ctx->channel);
if (reserved1 || reserved2 || !isValidChannel(chNum))
{
diff --git a/whitelist-filter.cpp b/whitelist-filter.cpp
index dfd2a19..7092096 100644
--- a/whitelist-filter.cpp
+++ b/whitelist-filter.cpp
@@ -1,5 +1,3 @@
-#include <algorithm>
-#include <array>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
#include <ipmiwhitelist.hpp>
@@ -8,6 +6,9 @@
#include <settings.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;
@@ -28,9 +29,9 @@
public:
WhitelistFilter();
~WhitelistFilter() = default;
- WhitelistFilter(WhitelistFilter const&) = delete;
+ WhitelistFilter(const WhitelistFilter&) = delete;
WhitelistFilter(WhitelistFilter&&) = delete;
- WhitelistFilter& operator=(WhitelistFilter const&) = delete;
+ WhitelistFilter& operator=(const WhitelistFilter&) = delete;
WhitelistFilter& operator=(WhitelistFilter&&) = delete;
private:
@@ -57,8 +58,8 @@
log<level::INFO>("Loading whitelist filter");
ipmi::registerFilter(ipmi::prioOpenBmcBase,
[this](ipmi::message::Request::ptr request) {
- return filterMessage(request);
- });
+ return filterMessage(request);
+ });
// wait until io->run is going to fetch RestrictionMode
post_work([this]() { postInit(); });
@@ -82,8 +83,8 @@
try
{
restrictionModeSetting = dev;
- restrictionModeService =
- objects->service(restrictionModeSetting, restrictionModeIntf);
+ restrictionModeService = objects->service(restrictionModeSetting,
+ restrictionModeIntf);
}
catch (const std::out_of_range& e)
{
@@ -95,24 +96,24 @@
bus->async_method_call(
[this, index = std::distance(&*std::begin(devices), &dev)](
boost::system::error_code ec, ipmi::Value v) {
- if (ec)
- {
- log<level::ERR>("Error in RestrictionMode Get");
- // Fail-safe to true.
- restrictedMode[index] = true;
- return;
- }
+ if (ec)
+ {
+ log<level::ERR>("Error in RestrictionMode Get");
+ // Fail-safe to true.
+ restrictedMode[index] = true;
+ return;
+ }
- auto mode = std::get<std::string>(v);
- auto restrictionMode =
- RestrictionMode::convertModesFromString(mode);
+ auto mode = std::get<std::string>(v);
+ auto restrictionMode =
+ RestrictionMode::convertModesFromString(mode);
- bool restrictMode =
- (restrictionMode == RestrictionMode::Modes::Whitelist);
- restrictedMode.emplace_back(restrictMode);
+ bool restrictMode =
+ (restrictionMode == RestrictionMode::Modes::Whitelist);
+ restrictedMode.emplace_back(restrictMode);
- log<level::INFO>((restrictMode ? "Set restrictedMode = true"
- : "Set restrictedMode = false"));
+ log<level::INFO>((restrictMode ? "Set restrictedMode = true"
+ : "Set restrictedMode = false"));
},
restrictionModeService, restrictionModeSetting,
"org.freedesktop.DBus.Properties", "Get", restrictionModeIntf,