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/memory.hpp b/redfish-core/lib/memory.hpp
index cd87d42..39ab0ac 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -370,34 +370,38 @@
if (dataLockCapable != nullptr)
{
- asyncResp->res.jsonValue[jsonPtr]["SecurityCapabilities"]
- ["DataLockCapable"] = *dataLockCapable;
+ asyncResp->res
+ .jsonValue[jsonPtr]["SecurityCapabilities"]["DataLockCapable"] =
+ *dataLockCapable;
}
if (passphraseCapable != nullptr)
{
- asyncResp->res.jsonValue[jsonPtr]["SecurityCapabilities"]
- ["PassphraseCapable"] = *passphraseCapable;
+ asyncResp->res
+ .jsonValue[jsonPtr]["SecurityCapabilities"]["PassphraseCapable"] =
+ *passphraseCapable;
}
if (maxPassphraseCount != nullptr)
{
- asyncResp->res.jsonValue[jsonPtr]["SecurityCapabilities"]
- ["MaxPassphraseCount"] = *maxPassphraseCount;
+ asyncResp->res
+ .jsonValue[jsonPtr]["SecurityCapabilities"]["MaxPassphraseCount"] =
+ *maxPassphraseCount;
}
if (passphraseLockLimit != nullptr)
{
- asyncResp->res.jsonValue[jsonPtr]["SecurityCapabilities"]
- ["PassphraseLockLimit"] = *passphraseLockLimit;
+ asyncResp->res
+ .jsonValue[jsonPtr]["SecurityCapabilities"]["PassphraseLockLimit"] =
+ *passphraseLockLimit;
}
}
-inline void
- assembleDimmProperties(std::string_view dimmId,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const dbus::utility::DBusPropertiesMap& properties,
- const nlohmann::json::json_pointer& jsonPtr)
+inline void assembleDimmProperties(
+ std::string_view dimmId,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const dbus::utility::DBusPropertiesMap& properties,
+ const nlohmann::json::json_pointer& jsonPtr)
{
asyncResp->res.jsonValue[jsonPtr]["Id"] = dimmId;
asyncResp->res.jsonValue[jsonPtr]["Name"] = "DIMM Slot";
@@ -575,8 +579,9 @@
if (memoryController != nullptr)
{
- asyncResp->res.jsonValue[jsonPtr]["MemoryLocation"]
- ["MemoryController"] = *memoryController;
+ asyncResp->res
+ .jsonValue[jsonPtr]["MemoryLocation"]["MemoryController"] =
+ *memoryController;
}
if (slot != nullptr)
@@ -601,17 +606,17 @@
if (locationCode != nullptr)
{
- asyncResp->res.jsonValue[jsonPtr]["Location"]["PartLocation"]
- ["ServiceLabel"] = *locationCode;
+ asyncResp->res
+ .jsonValue[jsonPtr]["Location"]["PartLocation"]["ServiceLabel"] =
+ *locationCode;
}
getPersistentMemoryProperties(asyncResp, properties, jsonPtr);
}
-inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> asyncResp,
- const std::string& dimmId,
- const std::string& service,
- const std::string& objPath)
+inline void getDimmDataByService(
+ std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& dimmId,
+ const std::string& service, const std::string& objPath)
{
BMCWEB_LOG_DEBUG("Get available system components.");
sdbusplus::asio::getAllProperties(
@@ -619,14 +624,15 @@
[dimmId, asyncResp{std::move(asyncResp)}](
const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& properties) {
- if (ec)
- {
- BMCWEB_LOG_DEBUG("DBUS response error");
- messages::internalError(asyncResp->res);
- return;
- }
- assembleDimmProperties(dimmId, asyncResp, properties, ""_json_pointer);
- });
+ if (ec)
+ {
+ BMCWEB_LOG_DEBUG("DBUS response error");
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ assembleDimmProperties(dimmId, asyncResp, properties,
+ ""_json_pointer);
+ });
}
inline void assembleDimmPartitionData(
@@ -692,16 +698,16 @@
[asyncResp{std::move(asyncResp)}](
const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& properties) {
- if (ec)
- {
- BMCWEB_LOG_DEBUG("DBUS response error");
- messages::internalError(asyncResp->res);
+ if (ec)
+ {
+ BMCWEB_LOG_DEBUG("DBUS response error");
+ messages::internalError(asyncResp->res);
- return;
+ return;
+ }
+ nlohmann::json::json_pointer regionPtr = "/Regions"_json_pointer;
+ assembleDimmPartitionData(asyncResp, properties, regionPtr);
}
- nlohmann::json::json_pointer regionPtr = "/Regions"_json_pointer;
- assembleDimmPartitionData(asyncResp, properties, regionPtr);
- }
);
}
@@ -718,57 +724,57 @@
[dimmId, asyncResp{std::move(asyncResp)}](
const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreeResponse& subtree) {
- if (ec)
- {
- BMCWEB_LOG_DEBUG("DBUS response error");
- messages::internalError(asyncResp->res);
-
- return;
- }
- bool found = false;
- for (const auto& [rawPath, object] : subtree)
- {
- sdbusplus::message::object_path path(rawPath);
- for (const auto& [service, interfaces] : object)
+ if (ec)
{
- for (const auto& interface : interfaces)
- {
- if (interface ==
- "xyz.openbmc_project.Inventory.Item.Dimm" &&
- path.filename() == dimmId)
- {
- getDimmDataByService(asyncResp, dimmId, service,
- rawPath);
- found = true;
- }
+ BMCWEB_LOG_DEBUG("DBUS response error");
+ messages::internalError(asyncResp->res);
- // partitions are separate as there can be multiple
- // per
- // device, i.e.
- // /xyz/openbmc_project/Inventory/Item/Dimm1/Partition1
- // /xyz/openbmc_project/Inventory/Item/Dimm1/Partition2
- if (interface ==
- "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition" &&
- path.parent_path().filename() == dimmId)
+ return;
+ }
+ bool found = false;
+ for (const auto& [rawPath, object] : subtree)
+ {
+ sdbusplus::message::object_path path(rawPath);
+ for (const auto& [service, interfaces] : object)
+ {
+ for (const auto& interface : interfaces)
{
- getDimmPartitionData(asyncResp, service, rawPath);
+ if (interface ==
+ "xyz.openbmc_project.Inventory.Item.Dimm" &&
+ path.filename() == dimmId)
+ {
+ getDimmDataByService(asyncResp, dimmId, service,
+ rawPath);
+ found = true;
+ }
+
+ // partitions are separate as there can be multiple
+ // per
+ // device, i.e.
+ // /xyz/openbmc_project/Inventory/Item/Dimm1/Partition1
+ // /xyz/openbmc_project/Inventory/Item/Dimm1/Partition2
+ if (interface ==
+ "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition" &&
+ path.parent_path().filename() == dimmId)
+ {
+ getDimmPartitionData(asyncResp, service, rawPath);
+ }
}
}
}
- }
- // Object not found
- if (!found)
- {
- messages::resourceNotFound(asyncResp->res, "Memory", dimmId);
+ // Object not found
+ if (!found)
+ {
+ messages::resourceNotFound(asyncResp->res, "Memory", dimmId);
+ return;
+ }
+ // Set @odata only if object is found
+ asyncResp->res.jsonValue["@odata.type"] = "#Memory.v1_11_0.Memory";
+ asyncResp->res.jsonValue["@odata.id"] =
+ boost::urls::format("/redfish/v1/Systems/{}/Memory/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, dimmId);
return;
- }
- // Set @odata only if object is found
- asyncResp->res.jsonValue["@odata.type"] = "#Memory.v1_11_0.Memory";
- asyncResp->res.jsonValue["@odata.id"] =
- boost::urls::format("/redfish/v1/Systems/{}/Memory/{}",
- BMCWEB_REDFISH_SYSTEM_URI_NAME, dimmId);
- return;
- });
+ });
}
inline void requestRoutesMemoryCollection(App& app)
@@ -782,38 +788,39 @@
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& systemName) {
- if (!redfish::setUpRedfishRoute(app, req, asyncResp))
- {
- return;
- }
- if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
- {
- // Option currently returns no systems. TBD
- messages::resourceNotFound(asyncResp->res, "ComputerSystem",
- systemName);
- return;
- }
- if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
- {
- messages::resourceNotFound(asyncResp->res, "ComputerSystem",
- systemName);
- return;
- }
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
- asyncResp->res.jsonValue["@odata.type"] =
- "#MemoryCollection.MemoryCollection";
- asyncResp->res.jsonValue["Name"] = "Memory Module Collection";
- asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/{}/Memory", BMCWEB_REDFISH_SYSTEM_URI_NAME);
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#MemoryCollection.MemoryCollection";
+ asyncResp->res.jsonValue["Name"] = "Memory Module Collection";
+ asyncResp->res.jsonValue["@odata.id"] =
+ boost::urls::format("/redfish/v1/Systems/{}/Memory",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
- constexpr std::array<std::string_view, 1> interfaces{
- "xyz.openbmc_project.Inventory.Item.Dimm"};
- collection_util::getCollectionMembers(
- asyncResp,
- boost::urls::format("/redfish/v1/Systems/{}/Memory",
- BMCWEB_REDFISH_SYSTEM_URI_NAME),
- interfaces, "/xyz/openbmc_project/inventory");
- });
+ constexpr std::array<std::string_view, 1> interfaces{
+ "xyz.openbmc_project.Inventory.Item.Dimm"};
+ collection_util::getCollectionMembers(
+ asyncResp,
+ boost::urls::format("/redfish/v1/Systems/{}/Memory",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME),
+ interfaces, "/xyz/openbmc_project/inventory");
+ });
}
inline void requestRoutesMemory(App& app)
@@ -827,28 +834,28 @@
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& systemName, const std::string& dimmId) {
- if (!redfish::setUpRedfishRoute(app, req, asyncResp))
- {
- return;
- }
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
- if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
- {
- // Option currently returns no systems. TBD
- messages::resourceNotFound(asyncResp->res, "ComputerSystem",
- systemName);
- return;
- }
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
- if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
- {
- messages::resourceNotFound(asyncResp->res, "ComputerSystem",
- systemName);
- return;
- }
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
- getDimmData(asyncResp, dimmId);
- });
+ getDimmData(asyncResp, dimmId);
+ });
}
} // namespace redfish