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: I61b093f75011417cc9c7acf9605200f4fa429bac
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/host-bmc/dbus_to_event_handler.cpp b/host-bmc/dbus_to_event_handler.cpp
index d1125f1..e8f84a6 100644
--- a/host-bmc/dbus_to_event_handler.cpp
+++ b/host-bmc/dbus_to_event_handler.cpp
@@ -49,9 +49,8 @@
return;
}
- auto platformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
- const pldm_msg* response,
- size_t respMsgLen) {
+ auto platformEventMessageResponseHandler =
+ [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
if (response == nullptr || !respMsgLen)
{
error("Failed to receive response for platform event message");
@@ -115,52 +114,50 @@
dbusMapping.interface.c_str()),
[this, sensorEventDataVec, dbusValueMapping,
dbusMapping](auto& msg) mutable {
- DbusChangedProps props{};
- std::string intf;
- msg.read(intf, props);
- if (!props.contains(dbusMapping.propertyName))
+ DbusChangedProps props{};
+ std::string intf;
+ msg.read(intf, props);
+ if (!props.contains(dbusMapping.propertyName))
+ {
+ return;
+ }
+ for (const auto& itr : dbusValueMapping)
+ {
+ bool findValue = false;
+ if (dbusMapping.propertyType == "string")
{
- return;
- }
- for (const auto& itr : dbusValueMapping)
- {
- bool findValue = false;
- if (dbusMapping.propertyType == "string")
- {
- std::string src = std::get<std::string>(itr.second);
- std::string dst = std::get<std::string>(
- props.at(dbusMapping.propertyName));
+ std::string src = std::get<std::string>(itr.second);
+ std::string dst = std::get<std::string>(
+ props.at(dbusMapping.propertyName));
- auto values = pldm::utils::split(src, "||", " ");
- for (auto& value : values)
+ auto values = pldm::utils::split(src, "||", " ");
+ for (auto& value : values)
+ {
+ if (value == dst)
{
- if (value == dst)
- {
- findValue = true;
- break;
- }
+ findValue = true;
+ break;
}
}
- else
- {
- findValue =
- itr.second == props.at(dbusMapping.propertyName)
- ? true
- : false;
- }
-
- if (findValue)
- {
- auto eventData =
- reinterpret_cast<struct pldm_sensor_event_data*>(
- sensorEventDataVec.data());
- eventData->event_class[1] = itr.first;
- eventData->event_class[2] = itr.first;
- this->sendEventMsg(PLDM_SENSOR_EVENT,
- sensorEventDataVec);
- break;
- }
}
+ else
+ {
+ findValue = itr.second == props.at(dbusMapping.propertyName)
+ ? true
+ : false;
+ }
+
+ if (findValue)
+ {
+ auto eventData =
+ reinterpret_cast<struct pldm_sensor_event_data*>(
+ sensorEventDataVec.data());
+ eventData->event_class[1] = itr.first;
+ eventData->event_class[2] = itr.first;
+ this->sendEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec);
+ break;
+ }
+ }
});
stateSensorMatchs.emplace_back(std::move(stateSensorMatch));
}
@@ -172,7 +169,7 @@
const std::map<Type, sensorEvent> sensorHandlers = {
{PLDM_STATE_SENSOR_PDR,
[this](SensorId sensorId, const DbusObjMaps& dbusMaps) {
- this->sendStateSensorEvent(sensorId, dbusMaps);
+ this->sendStateSensorEvent(sensorId, dbusMaps);
}}};
pldm_state_sensor_pdr* pdr = nullptr;
diff --git a/host-bmc/dbus_to_host_effecters.cpp b/host-bmc/dbus_to_host_effecters.cpp
index 32419a2..8f54ca2 100644
--- a/host-bmc/dbus_to_host_effecters.cpp
+++ b/host-bmc/dbus_to_host_effecters.cpp
@@ -71,12 +71,12 @@
EffecterInfo effecterInfo;
effecterInfo.mctpEid = entry.value("mctp_eid", 0xFF);
auto jsonEffecterInfo = entry.value("effecter_info", empty);
- auto effecterId =
- jsonEffecterInfo.value("effecterID", PLDM_INVALID_EFFECTER_ID);
+ auto effecterId = jsonEffecterInfo.value("effecterID",
+ PLDM_INVALID_EFFECTER_ID);
effecterInfo.containerId = jsonEffecterInfo.value("containerID", 0);
effecterInfo.entityType = jsonEffecterInfo.value("entityType", 0);
- effecterInfo.entityInstance =
- jsonEffecterInfo.value("entityInstance", 0);
+ effecterInfo.entityInstance = jsonEffecterInfo.value("entityInstance",
+ 0);
effecterInfo.compEffecterCnt =
jsonEffecterInfo.value("compositeEffecterCount", 0);
auto effecters = entry.value("effecters", emptyList);
@@ -86,10 +86,10 @@
auto jsonDbusInfo = effecter.value("dbus_info", empty);
dbusInfo.dbusMap.objectPath = jsonDbusInfo.value("object_path", "");
dbusInfo.dbusMap.interface = jsonDbusInfo.value("interface", "");
- dbusInfo.dbusMap.propertyName =
- jsonDbusInfo.value("property_name", "");
- dbusInfo.dbusMap.propertyType =
- jsonDbusInfo.value("property_type", "");
+ dbusInfo.dbusMap.propertyName = jsonDbusInfo.value("property_name",
+ "");
+ dbusInfo.dbusMap.propertyType = jsonDbusInfo.value("property_type",
+ "");
Json propertyValues = jsonDbusInfo["property_values"];
populatePropVals(propertyValues, dbusInfo.propertyValues,
@@ -187,8 +187,8 @@
uint8_t newState{};
try
{
- newState =
- findNewStateValue(effecterInfoIndex, dbusInfoIndex, it->second);
+ newState = findNewStateValue(effecterInfoIndex, dbusInfoIndex,
+ it->second);
}
catch (const std::out_of_range& e)
{
@@ -273,9 +273,8 @@
return rc;
}
- auto setStateEffecterStatesRespHandler = [](mctp_eid_t /*eid*/,
- const pldm_msg* response,
- size_t respMsgLen) {
+ auto setStateEffecterStatesRespHandler =
+ [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
if (response == nullptr || !respMsgLen)
{
error(
@@ -323,11 +322,11 @@
propertiesChanged(objectPath, interface),
[this, effecterInfoIndex, dbusInfoIndex,
effecterId](sdbusplus::message_t& msg) {
- DbusChgHostEffecterProps props;
- std::string iface;
- msg.read(iface, props);
- processHostEffecterChangeNotification(props, effecterInfoIndex,
- dbusInfoIndex, effecterId);
+ DbusChgHostEffecterProps props;
+ std::string iface;
+ msg.read(iface, props);
+ processHostEffecterChangeNotification(props, effecterInfoIndex,
+ dbusInfoIndex, effecterId);
}));
}
diff --git a/host-bmc/dbus_to_host_effecters.hpp b/host-bmc/dbus_to_host_effecters.hpp
index 11721bb..c5aef12 100644
--- a/host-bmc/dbus_to_host_effecters.hpp
+++ b/host-bmc/dbus_to_host_effecters.hpp
@@ -54,7 +54,7 @@
uint16_t entityInstance; //!< Entity instance for the host effecter
uint8_t compEffecterCnt; //!< Composite effecter count
std::vector<DBusEffecterMapping>
- dbusInfo; //!< D-Bus information for the effecter id
+ dbusInfo; //!< D-Bus information for the effecter id
};
/** @class HostEffecterParser
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index cedebb0..a5ecced 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -96,29 +96,29 @@
propertiesChanged("/xyz/openbmc_project/state/host0",
"xyz.openbmc_project.State.Host"),
[this, repo, entityTree, bmcEntityTree](sdbusplus::message_t& msg) {
- DbusChangedProps props{};
- std::string intf;
- msg.read(intf, props);
- const auto itr = props.find("CurrentHostState");
- if (itr != props.end())
+ DbusChangedProps props{};
+ std::string intf;
+ msg.read(intf, props);
+ const auto itr = props.find("CurrentHostState");
+ if (itr != props.end())
+ {
+ PropertyValue value = itr->second;
+ auto propVal = std::get<std::string>(value);
+ if (propVal == "xyz.openbmc_project.State.Host.HostState.Off")
{
- PropertyValue value = itr->second;
- auto propVal = std::get<std::string>(value);
- if (propVal == "xyz.openbmc_project.State.Host.HostState.Off")
- {
- // Delete all the remote terminus information
- std::erase_if(tlPDRInfo, [](const auto& item) {
- auto const& [key, value] = item;
- return key != TERMINUS_HANDLE;
- });
- pldm_pdr_remove_remote_pdrs(repo);
- pldm_entity_association_tree_destroy_root(entityTree);
- pldm_entity_association_tree_copy_root(bmcEntityTree,
- entityTree);
- this->sensorMap.clear();
- this->responseReceived = false;
- }
+ // Delete all the remote terminus information
+ std::erase_if(tlPDRInfo, [](const auto& item) {
+ auto const& [key, value] = item;
+ return key != TERMINUS_HANDLE;
+ });
+ pldm_pdr_remove_remote_pdrs(repo);
+ pldm_entity_association_tree_destroy_root(entityTree);
+ pldm_entity_association_tree_copy_root(bmcEntityTree,
+ entityTree);
+ this->sensorMap.clear();
+ this->responseReceived = false;
}
+ }
});
}
@@ -174,9 +174,9 @@
}
auto instanceId = requester.getInstanceId(mctp_eid);
- auto rc =
- encode_get_pdr_req(instanceId, recordHandle, 0, PLDM_GET_FIRSTPART,
- UINT16_MAX, 0, request, PLDM_GET_PDR_REQ_BYTES);
+ auto rc = encode_get_pdr_req(instanceId, recordHandle, 0,
+ PLDM_GET_FIRSTPART, UINT16_MAX, 0, request,
+ PLDM_GET_PDR_REQ_BYTES);
if (rc != PLDM_SUCCESS)
{
requester.markFree(mctp_eid, instanceId);
@@ -330,9 +330,8 @@
return;
}
- auto platformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
- const pldm_msg* response,
- size_t respMsgLen) {
+ auto platformEventMessageResponseHandler =
+ [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
if (response == nullptr || !respMsgLen)
{
error(
@@ -692,11 +691,9 @@
return;
}
- auto getStateSensorReadingRespHandler = [=, this](
- mctp_eid_t /*eid*/,
- const pldm_msg*
- response,
- size_t respMsgLen) {
+ auto getStateSensorReadingRespHandler =
+ [=, this](mctp_eid_t /*eid*/, const pldm_msg* response,
+ size_t respMsgLen) {
if (response == nullptr || !respMsgLen)
{
error(
@@ -774,8 +771,8 @@
error("Error invalid_data, Invalid event state");
return;
}
- const auto& [containerId, entityType, entityInstance] =
- entityInfo;
+ const auto& [containerId, entityType,
+ entityInstance] = entityInfo;
pldm::responder::events::StateSensorEntry
stateSensorEntry{containerId, entityType,
entityInstance, sensorOffset};