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: I0d10afa582342818b9d90b168f6f39f71ce4e0f4
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
[AJ: regenerate using .clang-format from openbmc/docs@f44abd66eca8]
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/src/IntrusionSensorMain.cpp b/src/IntrusionSensorMain.cpp
index 362ffce..c2783b7 100644
--- a/src/IntrusionSensorMain.cpp
+++ b/src/IntrusionSensorMain.cpp
@@ -181,48 +181,48 @@
const std::shared_ptr<sdbusplus::asio::connection>& dbusConnection)
{
auto getter = std::make_shared<GetSensorConfiguration>(
- dbusConnection, [](const ManagedObjectType& sensorConfigurations) {
- // Get NIC name and save to map
- lanInfoMap.clear();
- for (const auto& [path, cfgData] : sensorConfigurations)
+ dbusConnection,
+ [](const ManagedObjectType& sensorConfigurations) {
+ // Get NIC name and save to map
+ lanInfoMap.clear();
+ for (const auto& [path, cfgData] : sensorConfigurations)
+ {
+ const std::pair<std::string, SensorBaseConfigMap>*
+ baseConfiguration = nullptr;
+
+ // find base configuration
+ auto sensorBase = cfgData.find(configInterfaceName(nicType));
+ if (sensorBase == cfgData.end())
{
- const std::pair<std::string, SensorBaseConfigMap>*
- baseConfiguration = nullptr;
+ continue;
+ }
+ baseConfiguration = &(*sensorBase);
- // find base configuration
- auto sensorBase = cfgData.find(configInterfaceName(nicType));
- if (sensorBase == cfgData.end())
+ auto findEthIndex = baseConfiguration->second.find("EthIndex");
+ auto findName = baseConfiguration->second.find("Name");
+
+ if (findEthIndex != baseConfiguration->second.end() &&
+ findName != baseConfiguration->second.end())
+ {
+ const auto* pEthIndex =
+ std::get_if<uint64_t>(&findEthIndex->second);
+ const auto* pName = std::get_if<std::string>(&findName->second);
+ if (pEthIndex != nullptr && pName != nullptr)
{
- continue;
- }
- baseConfiguration = &(*sensorBase);
-
- auto findEthIndex = baseConfiguration->second.find("EthIndex");
- auto findName = baseConfiguration->second.find("Name");
-
- if (findEthIndex != baseConfiguration->second.end() &&
- findName != baseConfiguration->second.end())
- {
- const auto* pEthIndex =
- std::get_if<uint64_t>(&findEthIndex->second);
- const auto* pName =
- std::get_if<std::string>(&findName->second);
- if (pEthIndex != nullptr && pName != nullptr)
+ lanInfoMap[*pEthIndex] = *pName;
+ if (debugLanLeash)
{
- lanInfoMap[*pEthIndex] = *pName;
- if (debugLanLeash)
- {
- std::cout << "find name of eth" << *pEthIndex
- << " is " << *pName << "\n";
- }
+ std::cout << "find name of eth" << *pEthIndex << " is "
+ << *pName << "\n";
}
}
}
+ }
- if (lanInfoMap.empty())
- {
- std::cerr << "can't find matched NIC name. \n";
- }
+ if (lanInfoMap.empty())
+ {
+ std::cerr << "can't find matched NIC name. \n";
+ }
});
getter->getConfiguration(
@@ -306,8 +306,8 @@
{
std::string strEthNum = "eth" + std::to_string(ethNum) + lanInfo;
const auto* strState = newLanConnected ? "connected" : "lost";
- const auto* strMsgId =
- newLanConnected ? "OpenBMC.0.1.LanRegained" : "OpenBMC.0.1.LanLost";
+ const auto* strMsgId = newLanConnected ? "OpenBMC.0.1.LanRegained"
+ : "OpenBMC.0.1.LanLost";
lg2::info("{ETHDEV} LAN leash {STATE}", "ETHDEV", strEthNum, "STATE",
strState, "REDFISH_MESSAGE_ID", strMsgId,
@@ -393,9 +393,9 @@
std::cerr << "Unable to read lan status value\n";
return;
}
- bool isLanConnected =
- (*pState == "routable" || *pState == "carrier" ||
- *pState == "degraded");
+ bool isLanConnected = (*pState == "routable" ||
+ *pState == "carrier" ||
+ *pState == "degraded");
if (debugLanLeash)
{
std::cout << "ethNum = " << std::to_string(ethNum)