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: I917f3a65c985f3df3bb4d7a1bef0a13da54ab7bd
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/vpd-manager/bios_handler.cpp b/vpd-manager/bios_handler.cpp
index f8c6d73..14e1095 100644
--- a/vpd-manager/bios_handler.cpp
+++ b/vpd-manager/bios_handler.cpp
@@ -34,23 +34,24 @@
sdbusplus::bus::match::rules::nameOwnerChanged(
"xyz.openbmc_project.PLDM"),
[this](sdbusplus::message_t& msg) {
- if (msg.is_method_error())
- {
- std::cerr << "Error in reading name owner signal " << std::endl;
- return;
- }
- std::string name;
- std::string newOwner;
- std::string oldOwner;
+ if (msg.is_method_error())
+ {
+ std::cerr
+ << "Error in reading name owner signal " << std::endl;
+ return;
+ }
+ std::string name;
+ std::string newOwner;
+ std::string oldOwner;
- msg.read(name, oldOwner, newOwner);
- if (newOwner != "" && name == "xyz.openbmc_project.PLDM")
- {
- this->restoreBIOSAttribs();
- // We don't need the match anymore
- nameOwnerMatch.reset();
- }
- });
+ msg.read(name, oldOwner, newOwner);
+ if (newOwner != "" && name == "xyz.openbmc_project.PLDM")
+ {
+ this->restoreBIOSAttribs();
+ // We don't need the match anymore
+ nameOwnerMatch.reset();
+ }
+ });
// Check if PLDM is already running, if it is, we can go ahead and attempt
// to sync BIOS attributes (since PLDM would have initialized them by the
// time it acquires a bus name).
@@ -550,8 +551,8 @@
}
// Need to write?
- std::string toWrite = (createDefaultLpar.at(0) & 0x02) ? "Enabled"
- : "Disabled";
+ std::string toWrite =
+ (createDefaultLpar.at(0) & 0x02) ? "Enabled" : "Disabled";
if (createDefaultLparInBIOS == toWrite)
{
std::cout << "Skip Create default LPAR BIOS write, value is already: "
@@ -623,8 +624,8 @@
// VPD keywords with data taken from the BIOS.
auto fcoInVPD = readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.VSYS", "RG");
auto ammInVPD = readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.UTIL", "D0");
- auto keepAndClearInVPD = readBusProperty(SYSTEM_OBJECT,
- "com.ibm.ipzvpd.UTIL", "D1");
+ auto keepAndClearInVPD =
+ readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.UTIL", "D1");
auto fcoInBIOS = readBIOSFCO();
auto ammInBIOS = readBIOSAMM();
auto keepAndClearInBIOS = readBIOSKeepAndClear();
@@ -655,13 +656,13 @@
saveKeepAndClearToBIOS(keepAndClearInVPD, keepAndClearInBIOS);
// Have to read D1 again because two attributes are stored in the same
// keyword.
- auto createDefaultLparInVPD = readBusProperty(SYSTEM_OBJECT,
- "com.ibm.ipzvpd.UTIL", "D1");
+ auto createDefaultLparInVPD =
+ readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.UTIL", "D1");
saveCreateDefaultLparToBIOS(createDefaultLparInVPD,
createDefaultLparInBIOS);
- auto clearNVRAMInVPD = readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.UTIL",
- "D1");
+ auto clearNVRAMInVPD =
+ readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.UTIL", "D1");
saveClearNVRAMToBIOS(clearNVRAMInVPD, clearNVRAMInBIOS);
// Start listener now that we have done the restore
diff --git a/vpd-manager/bios_handler.hpp b/vpd-manager/bios_handler.hpp
index ef4cfa4..adee3c7 100644
--- a/vpd-manager/bios_handler.hpp
+++ b/vpd-manager/bios_handler.hpp
@@ -42,9 +42,7 @@
~BiosHandler() = default;
BiosHandler(std::shared_ptr<sdbusplus::asio::connection>& conn,
- Manager& manager) :
- conn(conn),
- manager(manager)
+ Manager& manager) : conn(conn), manager(manager)
{
checkAndListenPLDMService();
}
diff --git a/vpd-manager/editor_impl.cpp b/vpd-manager/editor_impl.cpp
index 727afac..c24cc0f 100644
--- a/vpd-manager/editor_impl.cpp
+++ b/vpd-manager/editor_impl.cpp
@@ -65,10 +65,10 @@
else
{
// Jump the record
- std::advance(iterator, lengths::RECORD_NAME + sizeof(RecordType) +
- sizeof(RecordOffset) +
- sizeof(RecordLength) +
- sizeof(ECCOffset) + sizeof(ECCLength));
+ std::advance(iterator,
+ lengths::RECORD_NAME + sizeof(RecordType) +
+ sizeof(RecordOffset) + sizeof(RecordLength) +
+ sizeof(ECCOffset) + sizeof(ECCLength));
}
}
// imples the record was not found
@@ -311,10 +311,9 @@
}
template <typename T>
-void EditorImpl::makeDbusCall(const std::string& object,
- const std::string& interface,
- const std::string& property,
- const std::variant<T>& data)
+void EditorImpl::makeDbusCall(
+ const std::string& object, const std::string& interface,
+ const std::string& property, const std::variant<T>& data)
{
auto bus = sdbusplus::bus::new_default();
auto properties =
@@ -470,17 +469,17 @@
if (locationCodeType == "fcs")
{
- propertyFCorTM = readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.VCEN",
- "FC");
- propertySE = readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.VCEN",
- "SE");
+ propertyFCorTM =
+ readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.VCEN", "FC");
+ propertySE =
+ readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.VCEN", "SE");
}
else if (locationCodeType == "mts")
{
- propertyFCorTM = readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.VSYS",
- "TM");
- propertySE = readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.VSYS",
- "SE");
+ propertyFCorTM =
+ readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.VSYS", "TM");
+ propertySE =
+ readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.VSYS", "SE");
}
const nlohmann::json& groupFRUS =
@@ -602,15 +601,15 @@
enableRebootGuard();
Binary completeVPDFile;
- vpdFileStream.exceptions(std::ifstream::badbit |
- std::ifstream::failbit);
+ vpdFileStream.exceptions(
+ std::ifstream::badbit | std::ifstream::failbit);
try
{
vpdFileStream.open(vpdFilePath,
std::ios::in | std::ios::out | std::ios::binary);
- auto vpdFileSize = std::min(std::filesystem::file_size(vpdFilePath),
- MAX_VPD_SIZE);
+ auto vpdFileSize =
+ std::min(std::filesystem::file_size(vpdFilePath), MAX_VPD_SIZE);
if (vpdFileSize == 0)
{
std::cerr << "File size is 0 for " << vpdFilePath << std::endl;
diff --git a/vpd-manager/editor_impl.hpp b/vpd-manager/editor_impl.hpp
index 98a2fa1..cf0ef2b 100644
--- a/vpd-manager/editor_impl.hpp
+++ b/vpd-manager/editor_impl.hpp
@@ -37,8 +37,7 @@
*/
EditorImpl(const std::string& record, const std::string& kwd,
Binary&& vpd) :
- startOffset(0),
- thisRecord(record, kwd), vpdFile(std::move(vpd))
+ startOffset(0), thisRecord(record, kwd), vpdFile(std::move(vpd))
{}
/** @brief Construct EditorImpl class
@@ -52,9 +51,8 @@
EditorImpl(const inventory::Path& path, const nlohmann::json& json,
const std::string& record, const std::string& kwd,
const sdbusplus::message::object_path& inventoryPath) :
- vpdFilePath(path),
- objPath(inventoryPath), startOffset(0), jsonFile(json),
- thisRecord(record, kwd)
+ vpdFilePath(path), objPath(inventoryPath), startOffset(0),
+ jsonFile(json), thisRecord(record, kwd)
{}
/** @brief Construct EditorImpl class
@@ -66,8 +64,7 @@
*/
EditorImpl(const inventory::Path& path, const nlohmann::json& json,
const std::string& record, const std::string& kwd) :
- vpdFilePath(path),
- jsonFile(json), thisRecord(record, kwd)
+ vpdFilePath(path), jsonFile(json), thisRecord(record, kwd)
{}
/**
diff --git a/vpd-manager/gpioMonitor.cpp b/vpd-manager/gpioMonitor.cpp
index 90374d2..3196fee 100644
--- a/vpd-manager/gpioMonitor.cpp
+++ b/vpd-manager/gpioMonitor.cpp
@@ -174,8 +174,8 @@
{
toggleGpio();
}
- timer->expires_at(std::chrono::steady_clock::now() +
- std::chrono::seconds(5));
+ timer->expires_at(
+ std::chrono::steady_clock::now() + std::chrono::seconds(5));
timer->async_wait(boost::bind(&GpioEventHandler::handleTimerExpiry, this,
boost::asio::placeholders::error, timer));
}
diff --git a/vpd-manager/gpioMonitor.hpp b/vpd-manager/gpioMonitor.hpp
index 790373b..5f34336 100644
--- a/vpd-manager/gpioMonitor.hpp
+++ b/vpd-manager/gpioMonitor.hpp
@@ -31,10 +31,9 @@
Byte& outValue, std::string& devAddr, std::string& driver,
std::string& bus, std::string& objPath,
std::shared_ptr<boost::asio::io_context>& ioCon) :
- presencePin(presPin),
- presenceValue(presValue), outputPin(outPin), outputValue(outValue),
- devNameAddr(devAddr), driverType(driver), busType(bus),
- objectPath(objPath)
+ presencePin(presPin), presenceValue(presValue), outputPin(outPin),
+ outputValue(outValue), devNameAddr(devAddr), driverType(driver),
+ busType(bus), objectPath(objPath)
{
doEventAndTimerSetup(ioCon);
}
@@ -120,8 +119,7 @@
GpioMonitor& operator=(GpioMonitor&&) = delete;
GpioMonitor(nlohmann::json& js,
- std::shared_ptr<boost::asio::io_context>& ioCon) :
- jsonFile(js)
+ std::shared_ptr<boost::asio::io_context>& ioCon) : jsonFile(js)
{
initGpioInfos(ioCon);
}
diff --git a/vpd-manager/manager.cpp b/vpd-manager/manager.cpp
index 072fe99..62220db 100644
--- a/vpd-manager/manager.cpp
+++ b/vpd-manager/manager.cpp
@@ -38,49 +38,50 @@
Manager::Manager(std::shared_ptr<boost::asio::io_context>& ioCon,
std::shared_ptr<sdbusplus::asio::dbus_interface>& iFace,
std::shared_ptr<sdbusplus::asio::connection>& conn) :
- ioContext(ioCon),
- interface(iFace), conn(conn)
+ ioContext(ioCon), interface(iFace), conn(conn)
{
interface->register_method(
"WriteKeyword",
[this](const sdbusplus::message::object_path& path,
const std::string& recordName, const std::string& keyword,
const Binary& value) {
- this->writeKeyword(path, recordName, keyword, value);
- });
+ this->writeKeyword(path, recordName, keyword, value);
+ });
interface->register_method(
"GetFRUsByUnexpandedLocationCode",
[this](const std::string& locationCode,
const uint16_t nodeNumber) -> inventory::ListOfPaths {
- return this->getFRUsByUnexpandedLocationCode(locationCode, nodeNumber);
- });
+ return this->getFRUsByUnexpandedLocationCode(locationCode,
+ nodeNumber);
+ });
interface->register_method(
"GetFRUsByExpandedLocationCode",
[this](const std::string& locationCode) -> inventory::ListOfPaths {
- return this->getFRUsByExpandedLocationCode(locationCode);
- });
+ return this->getFRUsByExpandedLocationCode(locationCode);
+ });
interface->register_method(
"GetExpandedLocationCode",
[this](const std::string& locationCode,
const uint16_t nodeNumber) -> std::string {
- return this->getExpandedLocationCode(locationCode, nodeNumber);
- });
+ return this->getExpandedLocationCode(locationCode, nodeNumber);
+ });
- interface->register_method("PerformVPDRecollection",
- [this]() { this->performVPDRecollection(); });
+ interface->register_method("PerformVPDRecollection", [this]() {
+ this->performVPDRecollection();
+ });
interface->register_method(
"deleteFRUVPD", [this](const sdbusplus::message::object_path& path) {
- this->deleteFRUVPD(path);
- });
+ this->deleteFRUVPD(path);
+ });
interface->register_method(
"CollectFRUVPD", [this](const sdbusplus::message::object_path& path) {
- this->collectFRUVPD(path);
- });
+ this->collectFRUVPD(path);
+ });
sd_bus_default(&sdBus);
initManager();
@@ -408,11 +409,11 @@
if (itr != svpdKwdMap.end())
{
auto systemKwdInfoList = itr->second;
- const auto& itrToKwd = find_if(systemKwdInfoList.begin(),
- systemKwdInfoList.end(),
- [&keyword](const auto& kwdInfo) {
- return (keyword == std::get<0>(kwdInfo));
- });
+ const auto& itrToKwd =
+ find_if(systemKwdInfoList.begin(), systemKwdInfoList.end(),
+ [&keyword](const auto& kwdInfo) {
+ return (keyword == std::get<0>(kwdInfo));
+ });
if (itrToKwd != systemKwdInfoList.end())
{
@@ -525,9 +526,8 @@
}
}
-ListOfPaths
- Manager::getFRUsByUnexpandedLocationCode(const LocationCode& locationCode,
- const NodeNumber nodeNumber)
+ListOfPaths Manager::getFRUsByUnexpandedLocationCode(
+ const LocationCode& locationCode, const NodeNumber nodeNumber)
{
ReaderImpl read;
return read.getFrusAtLocation(locationCode, nodeNumber, fruLocationCode);
@@ -790,14 +790,14 @@
string busNum = deviceAddress.substr(0, pos);
deviceAddress = "0x" + deviceAddress.substr(pos + 1, string::npos);
- string deleteDevice = "echo" + deviceAddress + " > /sys/bus/" +
- busType + "/devices/" + busType + "-" +
- busNum + "/delete_device";
+ string deleteDevice =
+ "echo" + deviceAddress + " > /sys/bus/" + busType +
+ "/devices/" + busType + "-" + busNum + "/delete_device";
executeCmd(deleteDevice);
- string addDevice = "echo" + driverType + " " + deviceAddress +
- " > /sys/bus/" + busType + "/devices/" +
- busType + "-" + busNum + "/new_device";
+ string addDevice =
+ "echo" + driverType + " " + deviceAddress + " > /sys/bus/" +
+ busType + "/devices/" + busType + "-" + busNum + "/new_device";
executeCmd(addDevice);
}
else
@@ -862,8 +862,8 @@
// check if we have cxp-port populated for the given object path.
std::vector<std::string> interfaceList{
"xyz.openbmc_project.State.Decorator.OperationalStatus"};
- MapperResponse subTree = getObjectSubtreeForInterfaces(path, 0,
- interfaceList);
+ MapperResponse subTree =
+ getObjectSubtreeForInterfaces(path, 0, interfaceList);
if (subTree.size() != 0)
{
diff --git a/vpd-manager/manager.hpp b/vpd-manager/manager.hpp
index 4ee376f..ae278ac 100644
--- a/vpd-manager/manager.hpp
+++ b/vpd-manager/manager.hpp
@@ -75,9 +75,8 @@
* @return inventoryList[std::vector<sdbusplus::message::object_path>] -
* List of all the FRUs D-Bus object paths for the given location code.
*/
- inventory::ListOfPaths
- getFRUsByUnexpandedLocationCode(const std::string& locationCode,
- const uint16_t nodeNumber);
+ inventory::ListOfPaths getFRUsByUnexpandedLocationCode(
+ const std::string& locationCode, const uint16_t nodeNumber);
/** @brief Implementation for GetFRUsByExpandedLocationCode
* A method to get list of FRU D-BUS object paths for a given expanded
diff --git a/vpd-manager/reader_impl.cpp b/vpd-manager/reader_impl.cpp
index 92f6a91..e4f2d8b 100644
--- a/vpd-manager/reader_impl.cpp
+++ b/vpd-manager/reader_impl.cpp
@@ -80,10 +80,9 @@
return expandedLocationCode;
}
-ListOfPaths
- ReaderImpl::getFrusAtLocation(const LocationCode& locationCode,
- const NodeNumber& nodeNumber,
- const LocationCodeMap& frusLocationCode) const
+ListOfPaths ReaderImpl::getFrusAtLocation(
+ const LocationCode& locationCode, const NodeNumber& nodeNumber,
+ const LocationCodeMap& frusLocationCode) const
{
// unused at this moment, to avoid compilation warning
(void)nodeNumber;
@@ -113,8 +112,8 @@
for_each(range.first, range.second,
[&inventoryPaths](
const inventory::LocationCodeMap::value_type& mappedItem) {
- inventoryPaths.push_back(INVENTORY_PATH + mappedItem.second);
- });
+ inventoryPaths.push_back(INVENTORY_PATH + mappedItem.second);
+ });
return inventoryPaths;
}
@@ -189,8 +188,8 @@
{
std::string tm{};
// read TM kwd value
- tm = utilObj.readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.VSYS",
- "TM");
+ tm =
+ utilObj.readBusProperty(SYSTEM_OBJECT, "com.ibm.ipzvpd.VSYS", "TM");
;
// check if the substr matches to TM kwd