clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: I01547e98d27910919e09ebf7907c86292a6c825d
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/dbus-sdr/sdrutils.cpp b/dbus-sdr/sdrutils.cpp
index 14eebb4..0c77ef7 100644
--- a/dbus-sdr/sdrutils.cpp
+++ b/dbus-sdr/sdrutils.cpp
@@ -85,8 +85,8 @@
{
return;
}
- nlohmann::json sensorFilterJSON = nlohmann::json::parse(filterFile, nullptr,
- false);
+ nlohmann::json sensorFilterJSON =
+ nlohmann::json::parse(filterFile, nullptr, false);
nlohmann::json::iterator svcFilterit =
sensorFilterJSON.find("ServiceFilter");
if (svcFilterit == sensorFilterJSON.end())
@@ -96,15 +96,16 @@
subtree.erase(std::remove_if(subtree.begin(), subtree.end(),
[svcFilterit](SensorSubTree::value_type& kv) {
- auto& [_, serviceToIfaces] = kv;
+ auto& [_, serviceToIfaces] = kv;
- for (auto service = svcFilterit->begin(); service != svcFilterit->end();
- ++service)
- {
- serviceToIfaces.erase(*service);
- }
- return serviceToIfaces.empty();
- }),
+ for (auto service = svcFilterit->begin();
+ service != svcFilterit->end();
+ ++service)
+ {
+ serviceToIfaces.erase(*service);
+ }
+ return serviceToIfaces.empty();
+ }),
subtree.end());
}
@@ -174,8 +175,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
@@ -291,8 +292,8 @@
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
@@ -410,8 +411,8 @@
return interfacesResponse;
}
-std::map<std::string, Value> getEntityManagerProperties(const char* path,
- const char* interface)
+std::map<std::string, Value>
+ getEntityManagerProperties(const char* path, const char* interface)
{
std::map<std::string, Value> properties;
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
@@ -462,8 +463,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 6517fdd..b3786c9 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -135,24 +135,24 @@
"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(
*getSdBus(),
"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();
+ });
ipmi_ret_t getSensorConnection(ipmi::Context::ptr ctx, uint8_t sensnum,
std::string& connection, std::string& path,
@@ -206,40 +206,43 @@
"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 ptr = std::get_if<bool>(&(findAssert->second));
- if (ptr == nullptr)
+ auto findAssert =
+ std::find_if(values.begin(), values.end(), [](const auto& pair) {
+ return pair.first.find("Alarm") != std::string::npos;
+ });
+ if (findAssert != values.end())
{
- lg2::error("thresholdChanged: Assert non bool");
- return;
- }
- if (*ptr)
- {
- lg2::info("thresholdChanged: Assert, sensor path: {SENSOR_PATH}",
- "SENSOR_PATH", m.get_path());
- thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
- }
- else
- {
- auto& value = thresholdDeassertMap[m.get_path()][findAssert->first];
- if (value)
+ auto ptr = std::get_if<bool>(&(findAssert->second));
+ if (ptr == nullptr)
+ {
+ lg2::error("thresholdChanged: Assert non bool");
+ return;
+ }
+ if (*ptr)
{
lg2::info(
- "thresholdChanged: deassert, sensor path: {SENSOR_PATH}",
+ "thresholdChanged: Assert, sensor path: {SENSOR_PATH}",
"SENSOR_PATH", m.get_path());
- value = *ptr;
+ thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
+ }
+ else
+ {
+ auto& value =
+ thresholdDeassertMap[m.get_path()][findAssert->first];
+ if (value)
+ {
+ lg2::info(
+ "thresholdChanged: deassert, sensor path: {SENSOR_PATH}",
+ "SENSOR_PATH", m.get_path());
+ value = *ptr;
+ }
}
}
- }
-});
+ });
namespace sensor
{
@@ -432,9 +435,8 @@
}
// Calculate VR Mode from input IPMI discrete event bytes
-static std::optional<std::string>
- calculateVRMode(uint15_t assertOffset,
- const ipmi::DbusInterfaceMap::mapped_type& VRObject)
+static std::optional<std::string> calculateVRMode(
+ uint15_t assertOffset, const ipmi::DbusInterfaceMap::mapped_type& VRObject)
{
// get VR mode profiles from Supported Interface
auto profiles = getSupportedVrProfiles(VRObject);
@@ -774,18 +776,16 @@
return ipmi::responseSuccess();
}
-ipmi::RspType<> ipmiSetSensorReading(ipmi::Context::ptr ctx,
- uint8_t sensorNumber, uint8_t,
- uint8_t reading, uint15_t assertOffset,
- bool, uint15_t, bool, uint8_t, uint8_t,
- uint8_t)
+ipmi::RspType<> ipmiSetSensorReading(
+ ipmi::Context::ptr ctx, uint8_t sensorNumber, uint8_t, uint8_t reading,
+ uint15_t assertOffset, bool, uint15_t, bool, uint8_t, uint8_t, uint8_t)
{
std::string connection;
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);
@@ -807,14 +807,14 @@
}
// Only allow external SetSensor if write permission granted
- if (!details::sdrWriteTable.getWritePermission((ctx->lun << 8) |
- sensorNumber))
+ if (!details::sdrWriteTable.getWritePermission(
+ (ctx->lun << 8) | sensorNumber))
{
return ipmi::responseResponseError();
}
- auto value = sensor::calculateValue(reading, sensorMap,
- sensorObject->second);
+ auto value =
+ sensor::calculateValue(reading, sensorMap, sensorObject->second);
if (!value)
{
return ipmi::responseResponseError();
@@ -863,8 +863,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();
@@ -982,8 +982,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 |=
@@ -1032,16 +1032,15 @@
{
// This is the first reading, show the coefficients
double step = (max - min) / 255.0;
- std::cerr << "IPMI sensor "
- << details::sdrStatsTable.getName((ctx->lun << 8) |
- sensnum)
- << ": Range min=" << min << " max=" << max
- << ", step=" << step
- << ", Coefficients mValue=" << static_cast<int>(mValue)
- << " rExp=" << static_cast<int>(rExp)
- << " bValue=" << static_cast<int>(bValue)
- << " bExp=" << static_cast<int>(bExp)
- << " bSigned=" << static_cast<int>(bSigned) << "\n";
+ std::cerr
+ << "IPMI sensor "
+ << details::sdrStatsTable.getName((ctx->lun << 8) | sensnum)
+ << ": Range min=" << min << " max=" << max << ", step=" << step
+ << ", Coefficients mValue=" << static_cast<int>(mValue)
+ << " rExp=" << static_cast<int>(rExp)
+ << " bValue=" << static_cast<int>(bValue)
+ << " bExp=" << static_cast<int>(bExp)
+ << " bSigned=" << static_cast<int>(bSigned) << "\n";
}
}
@@ -1296,8 +1295,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(
@@ -1306,8 +1305,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(
@@ -1324,8 +1323,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(
@@ -1334,8 +1333,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(
@@ -1511,8 +1510,8 @@
auto warningLow = warningMap.find("WarningLow");
if (warningHigh != warningMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- warningHigh->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), warningHigh->second);
if (std::isfinite(value))
{
assertionEnabledLsb |= static_cast<uint8_t>(
@@ -1525,8 +1524,8 @@
}
if (warningLow != warningMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- warningLow->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), warningLow->second);
if (std::isfinite(value))
{
assertionEnabledLsb |= static_cast<uint8_t>(
@@ -1547,8 +1546,8 @@
if (criticalHigh != criticalMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- criticalHigh->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), criticalHigh->second);
if (std::isfinite(value))
{
assertionEnabledMsb |= static_cast<uint8_t>(
@@ -1560,8 +1559,8 @@
}
if (criticalLow != criticalMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- criticalLow->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), criticalLow->second);
if (std::isfinite(value))
{
assertionEnabledLsb |= static_cast<uint8_t>(
@@ -1731,15 +1730,15 @@
}
if (warningHighAlarm)
{
- assertions.set(
- static_cast<size_t>(IPMIGetSensorEventEnableThresholds::
- upperNonCriticalGoingHigh));
+ assertions.set(static_cast<size_t>(
+ IPMIGetSensorEventEnableThresholds::
+ upperNonCriticalGoingHigh));
}
if (warningLowAlarm)
{
- assertions.set(
- static_cast<size_t>(IPMIGetSensorEventEnableThresholds::
- lowerNonCriticalGoingLow));
+ assertions.set(static_cast<size_t>(
+ IPMIGetSensorEventEnableThresholds::
+ lowerNonCriticalGoingLow));
}
}
if (criticalInterface != sensorMap.end())
@@ -1761,9 +1760,9 @@
}
if (criticalHighAlarm)
{
- assertions.set(
- static_cast<size_t>(IPMIGetSensorEventEnableThresholds::
- upperCriticalGoingHigh));
+ assertions.set(static_cast<size_t>(
+ IPMIGetSensorEventEnableThresholds::
+ upperCriticalGoingHigh));
}
if (criticalLowAlarm)
{
@@ -1898,8 +1897,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;
@@ -1923,8 +1922,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);
@@ -2173,9 +2172,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)
{
lg2::error("getSensorDataRecord: getSensorConnection error");
@@ -2369,8 +2368,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))
{
@@ -2435,8 +2434,8 @@
ipmiStorageGetSDRRepositoryInfo(ipmi::Context::ptr ctx)
{
constexpr const uint16_t unspecifiedFreeSpace = 0xFFFF;
- uint16_t recordCount = ipmi::getNumberOfSensors() +
- ipmi::sensor::getOtherSensorsCount(ctx);
+ uint16_t recordCount =
+ ipmi::getNumberOfSensors() + ipmi::sensor::getOtherSensorsCount(ctx);
uint8_t operationSupport = static_cast<uint8_t>(
SdrRepositoryInfoOps::overflow); // write not supported
@@ -2535,8 +2534,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 (offset >= sdrLength)
{
lg2::error("ipmiStorageGetSDR: offset is outside the record");
@@ -2831,8 +2830,8 @@
for (const auto& sensor : sensorList)
{
- const auto& [readResult, tempVal,
- signBit] = readTemp(ctx, sensor.objectPath);
+ const auto& [readResult, tempVal, signBit] =
+ readTemp(ctx, sensor.objectPath);
if (readResult)
{
@@ -2931,14 +2930,14 @@
ipmi::storage::cmdGetSdr, ipmi::Privilege::User,
ipmiStorageGetSDR);
// <Get DCMI Sensor Info>
- ipmi::registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
- ipmi::dcmi::cmdGetDcmiSensorInfo,
- ipmi::Privilege::Operator,
- ipmi::dcmi::getSensorInfo);
+ ipmi::registerGroupHandler(
+ ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+ ipmi::dcmi::cmdGetDcmiSensorInfo, ipmi::Privilege::Operator,
+ ipmi::dcmi::getSensorInfo);
// <Get Temperature Readings>
- ipmi::registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
- ipmi::dcmi::cmdGetTemperatureReadings,
- ipmi::Privilege::User,
- ipmi::dcmi::getTempReadings);
+ ipmi::registerGroupHandler(
+ ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+ ipmi::dcmi::cmdGetTemperatureReadings, ipmi::Privilege::User,
+ ipmi::dcmi::getTempReadings);
}
} // namespace ipmi
diff --git a/dbus-sdr/sensorutils.cpp b/dbus-sdr/sensorutils.cpp
index e76a5f1..8c6952b 100644
--- a/dbus-sdr/sensorutils.cpp
+++ b/dbus-sdr/sensorutils.cpp
@@ -240,9 +240,8 @@
// Step 4: Constrain B, and set bExp accordingly
if (!(scaleFloatExp(dB, bExp)))
{
- std::cerr << "getSensorAttributes: Offset (B=" << dB
- << ", bExp=" << (int)bExp
- << ") exceeds multiplier scale (M=" << dM
+ std::cerr << "getSensorAttributes: Offset (B=" << dB << ", bExp="
+ << (int)bExp << ") exceeds multiplier scale (M=" << dM
<< ", rExp=" << (int)rExp << ")\n";
return false;
}
@@ -312,8 +311,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 afe3535..a93a045 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -236,8 +236,8 @@
recalculateHashes();
}
-std::pair<ipmi::Cc, std::vector<uint8_t>> getFru(ipmi::Context::ptr ctx,
- uint8_t devId)
+std::pair<ipmi::Cc, std::vector<uint8_t>>
+ getFru(ipmi::Context::ptr ctx, uint8_t devId)
{
if (lastDevId == devId && devId != 0xFF)
{
@@ -297,55 +297,57 @@
fruMatches.reserve(2);
auto bus = getSdBus();
- fruMatches.emplace_back(*bus,
- "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;
- });
+ fruMatches.emplace_back(
+ *bus,
+ "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;
+ });
- 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;
- });
+ 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;
+ });
// call once to populate
boost::asio::spawn(*getIoContext(), [](boost::asio::yield_context yield) {
@@ -410,10 +412,9 @@
* @returns ipmi completion code plus response data
* - countWritten - Count written
*/
-ipmi::RspType<uint8_t>
- ipmiStorageWriteFruData(ipmi::Context::ptr ctx, uint8_t fruDeviceId,
- uint16_t fruInventoryOffset,
- std::vector<uint8_t>& dataToWrite)
+ipmi::RspType<uint8_t> ipmiStorageWriteFruData(
+ ipmi::Context::ptr ctx, uint8_t fruDeviceId, uint16_t fruInventoryOffset,
+ std::vector<uint8_t>& dataToWrite)
{
if (fruDeviceId == 0xFF)
{
@@ -558,31 +559,33 @@
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;
@@ -610,49 +613,49 @@
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())
{
@@ -747,8 +750,8 @@
dynamic_sensors::ipmi::sel::selLogFilename))
{
// If we find an ipmi_sel log file, save the path
- selLogFiles.emplace_back(dynamic_sensors::ipmi::sel::selLogDir /
- filename);
+ selLogFiles.emplace_back(
+ dynamic_sensors::ipmi::sel::selLogDir / filename);
}
}
// As the log files rotate, they are appended with a ".#" that is higher for
@@ -1139,10 +1142,9 @@
uint8_t eventType, uint8_t eventData1, uint8_t eventData2,
uint8_t eventData3
*/
-ipmi::RspType<uint16_t> ipmiStorageAddSELEntry(uint16_t, uint8_t, uint32_t,
- uint16_t, uint8_t, uint8_t,
- uint8_t, uint8_t, uint8_t,
- uint8_t, uint8_t)
+ipmi::RspType<uint16_t>
+ ipmiStorageAddSELEntry(uint16_t, uint8_t, uint32_t, uint16_t, uint8_t,
+ uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
{
// Per the IPMI spec, need to cancel any reservation when a SEL entry is
// added
@@ -1152,10 +1154,9 @@
return ipmi::responseSuccess(responseID);
}
-ipmi::RspType<uint8_t> ipmiStorageClearSEL(ipmi::Context::ptr ctx,
- uint16_t reservationID,
- const std::array<uint8_t, 3>& clr,
- uint8_t eraseOperation)
+ipmi::RspType<uint8_t> ipmiStorageClearSEL(
+ ipmi::Context::ptr ctx, uint16_t reservationID,
+ const std::array<uint8_t, 3>& clr, uint8_t eraseOperation)
{
if (!checkSELReservation(reservationID))
{
@@ -1198,9 +1199,8 @@
return ipmi::responseSuccess(ipmi::sel::eraseComplete);
}
-std::vector<uint8_t>
- getType8SDRs(ipmi::sensor::EntityInfoMap::const_iterator& entity,
- uint16_t recordId)
+std::vector<uint8_t> getType8SDRs(
+ ipmi::sensor::EntityInfoMap::const_iterator& entity, uint16_t recordId)
{
std::vector<uint8_t> resp;
get_sdr::SensorDataEntityRecord data{};
@@ -1252,8 +1252,8 @@
}
else
{
- throw std::runtime_error("getType12SDRs:: Illegal index " +
- std::to_string(index));
+ throw std::runtime_error(
+ "getType12SDRs:: Illegal index " + std::to_string(index));
}
return resp;