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: Iceec1dc95b6c908ec6c21fb40093de9dd18bf11a
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index d896f6d..4415144 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -63,14 +63,14 @@
[pcieDevicePath, asyncResp,
callback](const boost::system::error_code& ec,
const dbus::utility::MapperGetObject& object) {
- if (ec || object.empty())
- {
- BMCWEB_LOG_ERROR("DBUS response error {}", ec);
- messages::internalError(asyncResp->res);
- return;
- }
- callback(pcieDevicePath, object.begin()->first);
- });
+ if (ec || object.empty())
+ {
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ callback(pcieDevicePath, object.begin()->first);
+ });
return;
}
@@ -90,16 +90,16 @@
callback](const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreePathsResponse&
pcieDevicePaths) {
- if (ec)
- {
- BMCWEB_LOG_ERROR("D-Bus response error on GetSubTree {}", ec);
- messages::internalError(asyncResp->res);
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR("D-Bus response error on GetSubTree {}", ec);
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ handlePCIeDevicePath(pcieDeviceId, asyncResp, pcieDevicePaths,
+ callback);
return;
- }
- handlePCIeDevicePath(pcieDeviceId, asyncResp, pcieDevicePaths,
- callback);
- return;
- });
+ });
}
static inline void handlePCIeDeviceCollectionGet(
@@ -227,43 +227,42 @@
[callback = std::move(callback), asyncResp, pcieDevicePath](
const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreePathsResponse& endpoints) {
- if (ec)
- {
- if (ec.value() == EBADR)
+ if (ec)
{
- // Missing association is not an error
+ if (ec.value() == EBADR)
+ {
+ // Missing association is not an error
+ return;
+ }
+ BMCWEB_LOG_ERROR(
+ "DBUS response error for getAssociatedSubTreePaths {}",
+ ec.value());
+ messages::internalError(asyncResp->res);
return;
}
- BMCWEB_LOG_ERROR(
- "DBUS response error for getAssociatedSubTreePaths {}",
- ec.value());
- messages::internalError(asyncResp->res);
- return;
- }
- if (endpoints.size() > 1)
- {
- BMCWEB_LOG_ERROR(
- "PCIeDevice is associated with more than one PCIeSlot: {}",
- endpoints.size());
- messages::internalError(asyncResp->res);
- return;
- }
- if (endpoints.empty())
- {
- // If the device doesn't have an association, return without PCIe
- // Slot properties
- BMCWEB_LOG_DEBUG("PCIeDevice is not associated with PCIeSlot");
- return;
- }
- callback(endpoints[0]);
- });
+ if (endpoints.size() > 1)
+ {
+ BMCWEB_LOG_ERROR(
+ "PCIeDevice is associated with more than one PCIeSlot: {}",
+ endpoints.size());
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ if (endpoints.empty())
+ {
+ // If the device doesn't have an association, return without
+ // PCIe Slot properties
+ BMCWEB_LOG_DEBUG("PCIeDevice is not associated with PCIeSlot");
+ return;
+ }
+ callback(endpoints[0]);
+ });
}
-inline void
- afterGetDbusObject(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& pcieDeviceSlot,
- const boost::system::error_code& ec,
- const dbus::utility::MapperGetObject& object)
+inline void afterGetDbusObject(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& pcieDeviceSlot, const boost::system::error_code& ec,
+ const dbus::utility::MapperGetObject& object)
{
if (ec || object.empty())
{
@@ -278,8 +277,8 @@
[asyncResp](
const boost::system::error_code& ec2,
const dbus::utility::DBusPropertiesMap& pcieSlotProperties) {
- addPCIeSlotProperties(asyncResp->res, ec2, pcieSlotProperties);
- });
+ addPCIeSlotProperties(asyncResp->res, ec2, pcieSlotProperties);
+ });
}
inline void afterGetPCIeDeviceSlotPath(
@@ -291,69 +290,66 @@
[asyncResp,
pcieDeviceSlot](const boost::system::error_code& ec,
const dbus::utility::MapperGetObject& object) {
- afterGetDbusObject(asyncResp, pcieDeviceSlot, ec, object);
- });
+ afterGetDbusObject(asyncResp, pcieDeviceSlot, ec, object);
+ });
}
-inline void
- getPCIeDeviceHealth(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& pcieDevicePath,
- const std::string& service)
+inline void getPCIeDeviceHealth(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& pcieDevicePath, const std::string& service)
{
sdbusplus::asio::getProperty<bool>(
*crow::connections::systemBus, service, pcieDevicePath,
"xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional",
[asyncResp](const boost::system::error_code& ec, const bool value) {
- if (ec)
- {
- if (ec.value() != EBADR)
+ if (ec)
{
- BMCWEB_LOG_ERROR("DBUS response error for Health {}",
- ec.value());
- messages::internalError(asyncResp->res);
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR("DBUS response error for Health {}",
+ ec.value());
+ messages::internalError(asyncResp->res);
+ }
+ return;
}
- return;
- }
- if (!value)
- {
- asyncResp->res.jsonValue["Status"]["Health"] =
- resource::Health::Critical;
- }
- });
+ if (!value)
+ {
+ asyncResp->res.jsonValue["Status"]["Health"] =
+ resource::Health::Critical;
+ }
+ });
}
-inline void
- getPCIeDeviceState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& pcieDevicePath,
- const std::string& service)
+inline void getPCIeDeviceState(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& pcieDevicePath, const std::string& service)
{
sdbusplus::asio::getProperty<bool>(
*crow::connections::systemBus, service, pcieDevicePath,
"xyz.openbmc_project.Inventory.Item", "Present",
[asyncResp](const boost::system::error_code& ec, bool value) {
- if (ec)
- {
- if (ec.value() != EBADR)
+ if (ec)
{
- BMCWEB_LOG_ERROR("DBUS response error for State");
- messages::internalError(asyncResp->res);
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR("DBUS response error for State");
+ messages::internalError(asyncResp->res);
+ }
+ return;
}
- return;
- }
- if (!value)
- {
- asyncResp->res.jsonValue["Status"]["State"] =
- resource::State::Absent;
- }
- });
+ if (!value)
+ {
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Absent;
+ }
+ });
}
-inline void
- getPCIeDeviceAsset(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& pcieDevicePath,
- const std::string& service)
+inline void getPCIeDeviceAsset(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& pcieDevicePath, const std::string& service)
{
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, service, pcieDevicePath,
@@ -361,58 +357,59 @@
[pcieDevicePath, asyncResp{asyncResp}](
const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& assetList) {
- if (ec)
- {
- if (ec.value() != EBADR)
+ if (ec)
{
- BMCWEB_LOG_ERROR("DBUS response error for Properties{}",
- ec.value());
- messages::internalError(asyncResp->res);
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR("DBUS response error for Properties{}",
+ ec.value());
+ messages::internalError(asyncResp->res);
+ }
+ return;
}
- return;
- }
- const std::string* manufacturer = nullptr;
- const std::string* model = nullptr;
- const std::string* partNumber = nullptr;
- const std::string* serialNumber = nullptr;
- const std::string* sparePartNumber = nullptr;
+ const std::string* manufacturer = nullptr;
+ const std::string* model = nullptr;
+ const std::string* partNumber = nullptr;
+ const std::string* serialNumber = nullptr;
+ const std::string* sparePartNumber = nullptr;
- const bool success = sdbusplus::unpackPropertiesNoThrow(
- dbus_utils::UnpackErrorPrinter(), assetList, "Manufacturer",
- manufacturer, "Model", model, "PartNumber", partNumber,
- "SerialNumber", serialNumber, "SparePartNumber", sparePartNumber);
+ const bool success = sdbusplus::unpackPropertiesNoThrow(
+ dbus_utils::UnpackErrorPrinter(), assetList, "Manufacturer",
+ manufacturer, "Model", model, "PartNumber", partNumber,
+ "SerialNumber", serialNumber, "SparePartNumber",
+ sparePartNumber);
- if (!success)
- {
- messages::internalError(asyncResp->res);
- return;
- }
+ if (!success)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
- if (manufacturer != nullptr)
- {
- asyncResp->res.jsonValue["Manufacturer"] = *manufacturer;
- }
- if (model != nullptr)
- {
- asyncResp->res.jsonValue["Model"] = *model;
- }
+ if (manufacturer != nullptr)
+ {
+ asyncResp->res.jsonValue["Manufacturer"] = *manufacturer;
+ }
+ if (model != nullptr)
+ {
+ asyncResp->res.jsonValue["Model"] = *model;
+ }
- if (partNumber != nullptr)
- {
- asyncResp->res.jsonValue["PartNumber"] = *partNumber;
- }
+ if (partNumber != nullptr)
+ {
+ asyncResp->res.jsonValue["PartNumber"] = *partNumber;
+ }
- if (serialNumber != nullptr)
- {
- asyncResp->res.jsonValue["SerialNumber"] = *serialNumber;
- }
+ if (serialNumber != nullptr)
+ {
+ asyncResp->res.jsonValue["SerialNumber"] = *serialNumber;
+ }
- if (sparePartNumber != nullptr && !sparePartNumber->empty())
- {
- asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber;
- }
- });
+ if (sparePartNumber != nullptr && !sparePartNumber->empty())
+ {
+ asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber;
+ }
+ });
}
inline void addPCIeDeviceProperties(
@@ -523,17 +520,17 @@
[asyncResp,
callback](const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& pcieDevProperties) {
- if (ec)
- {
- if (ec.value() != EBADR)
+ if (ec)
{
- BMCWEB_LOG_ERROR("DBUS response error for Properties");
- messages::internalError(asyncResp->res);
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR("DBUS response error for Properties");
+ messages::internalError(asyncResp->res);
+ }
+ return;
}
- return;
- }
- callback(pcieDevProperties);
- });
+ callback(pcieDevProperties);
+ });
}
inline void addPCIeDeviceCommonProperties(
@@ -570,11 +567,10 @@
std::bind_front(afterGetPCIeDeviceSlotPath, asyncResp));
}
-inline void
- handlePCIeDeviceGet(App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& systemName,
- const std::string& pcieDeviceId)
+inline void handlePCIeDeviceGet(
+ App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName, const std::string& pcieDeviceId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
@@ -619,8 +615,8 @@
{
// Check if this function exists by
// looking for a device ID
- std::string devIDProperty = "Function" + std::to_string(functionNum) +
- "DeviceId";
+ std::string devIDProperty =
+ "Function" + std::to_string(functionNum) + "DeviceId";
const std::string* property = nullptr;
for (const auto& propEntry : pcieDevProperties)
{
@@ -666,25 +662,25 @@
pcieDeviceId, asyncResp,
[asyncResp, pcieDeviceId](const std::string& pcieDevicePath,
const std::string& service) {
- asyncResp->res.addHeader(
- boost::beast::http::field::link,
- "</redfish/v1/JsonSchemas/PCIeFunctionCollection/PCIeFunctionCollection.json>; rel=describedby");
- asyncResp->res.jsonValue["@odata.type"] =
- "#PCIeFunctionCollection.PCIeFunctionCollection";
- asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/{}/PCIeDevices/{}/PCIeFunctions",
- BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId);
- asyncResp->res.jsonValue["Name"] = "PCIe Function Collection";
- asyncResp->res.jsonValue["Description"] =
- "Collection of PCIe Functions for PCIe Device " + pcieDeviceId;
- getPCIeDeviceProperties(
- asyncResp, pcieDevicePath, service,
- [asyncResp, pcieDeviceId](
- const dbus::utility::DBusPropertiesMap& pcieDevProperties) {
- addPCIeFunctionList(asyncResp->res, pcieDeviceId,
- pcieDevProperties);
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/PCIeFunctionCollection/PCIeFunctionCollection.json>; rel=describedby");
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#PCIeFunctionCollection.PCIeFunctionCollection";
+ asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Systems/{}/PCIeDevices/{}/PCIeFunctions",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId);
+ asyncResp->res.jsonValue["Name"] = "PCIe Function Collection";
+ asyncResp->res.jsonValue["Description"] =
+ "Collection of PCIe Functions for PCIe Device " + pcieDeviceId;
+ getPCIeDeviceProperties(
+ asyncResp, pcieDevicePath, service,
+ [asyncResp, pcieDeviceId](
+ const dbus::utility::DBusPropertiesMap& pcieDevProperties) {
+ addPCIeFunctionList(asyncResp->res, pcieDeviceId,
+ pcieDevProperties);
+ });
});
- });
}
inline void requestRoutesSystemPCIeFunctionCollection(App& app)
@@ -795,12 +791,11 @@
BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId);
}
-inline void
- handlePCIeFunctionGet(App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& systemName,
- const std::string& pcieDeviceId,
- const std::string& pcieFunctionIdStr)
+inline void handlePCIeFunctionGet(
+ App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName, const std::string& pcieDeviceId,
+ const std::string& pcieFunctionIdStr)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
@@ -831,20 +826,20 @@
return;
}
- getValidPCIeDevicePath(pcieDeviceId, asyncResp,
- [asyncResp, pcieDeviceId,
- pcieFunctionId](const std::string& pcieDevicePath,
- const std::string& service) {
- getPCIeDeviceProperties(
- asyncResp, pcieDevicePath, service,
- [asyncResp, pcieDeviceId, pcieFunctionId](
- const dbus::utility::DBusPropertiesMap& pcieDevProperties) {
- addPCIeFunctionCommonProperties(asyncResp->res, pcieDeviceId,
- pcieFunctionId);
- addPCIeFunctionProperties(asyncResp->res, pcieFunctionId,
- pcieDevProperties);
+ getValidPCIeDevicePath(
+ pcieDeviceId, asyncResp,
+ [asyncResp, pcieDeviceId, pcieFunctionId](
+ const std::string& pcieDevicePath, const std::string& service) {
+ getPCIeDeviceProperties(
+ asyncResp, pcieDevicePath, service,
+ [asyncResp, pcieDeviceId, pcieFunctionId](
+ const dbus::utility::DBusPropertiesMap& pcieDevProperties) {
+ addPCIeFunctionCommonProperties(
+ asyncResp->res, pcieDeviceId, pcieFunctionId);
+ addPCIeFunctionProperties(asyncResp->res, pcieFunctionId,
+ pcieDevProperties);
+ });
});
- });
}
inline void requestRoutesSystemPCIeFunction(App& app)