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/.clang-format b/.clang-format
index d43e884..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -87,7 +87,7 @@
IndentWrappedFunctionNames: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
-LambdaBodyIndentation: OuterScope
+LambdaBodyIndentation: Signature
LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
@@ -98,13 +98,14 @@
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 25
-PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakBeforeFirstCallParameter: 50
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PenaltyIndentedWhitespace: 0
+PenaltyIndentedWhitespace: 1
PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
diff --git a/common_utility.cpp b/common_utility.cpp
index c1c5e4f..0497d0f 100644
--- a/common_utility.cpp
+++ b/common_utility.cpp
@@ -55,8 +55,8 @@
{
auto bus = sdbusplus::bus::new_default();
auto service = getService(bus, pimPath, pimIntf);
- auto pimMsg = bus.new_method_call(service.c_str(), pimPath, pimIntf,
- "Notify");
+ auto pimMsg =
+ bus.new_method_call(service.c_str(), pimPath, pimIntf, "Notify");
pimMsg.append(std::move(objects));
auto result = bus.call(pimMsg);
if (result.is_method_error())
diff --git a/ibm_vpd_app.cpp b/ibm_vpd_app.cpp
index 55a01ff..476d802 100644
--- a/ibm_vpd_app.cpp
+++ b/ibm_vpd_app.cpp
@@ -240,9 +240,8 @@
* @param[out] interfaces - Reference to interface map.
*/
template <typename T>
-static void populateFruSpecificInterfaces(const T& map,
- const string& preIntrStr,
- inventory::InterfaceMap& interfaces)
+static void populateFruSpecificInterfaces(
+ const T& map, const string& preIntrStr, inventory::InterfaceMap& interfaces)
{
inventory::PropertyMap prop;
@@ -376,8 +375,8 @@
if (!rec.empty() && !kw.empty() && vpdMap.count(rec) &&
vpdMap.at(rec).count(kw))
{
- auto encoded = encodeKeyword(vpdMap.at(rec).at(kw),
- encoding);
+ auto encoded =
+ encodeKeyword(vpdMap.at(rec).at(kw), encoding);
props.emplace(busProp, encoded);
}
}
@@ -387,8 +386,8 @@
{
if (auto kwValue = get_if<Binary>(&vpdMap.at(kw)))
{
- auto prop = string((*kwValue).begin(),
- (*kwValue).end());
+ auto prop =
+ string((*kwValue).begin(), (*kwValue).end());
auto encoded = encodeKeyword(prop, encoding);
@@ -397,8 +396,8 @@
else if (auto kwValue =
get_if<std::string>(&vpdMap.at(kw)))
{
- auto prop = string((*kwValue).begin(),
- (*kwValue).end());
+ auto prop =
+ string((*kwValue).begin(), (*kwValue).end());
auto encoded = encodeKeyword(prop, encoding);
@@ -537,9 +536,9 @@
// Check if device showed up (test for file)
if (!fs::exists(file))
{
- std::cerr << "EEPROM " << file
- << " does not exist. Take failure action"
- << std::endl;
+ std::cerr
+ << "EEPROM " << file
+ << " does not exist. Take failure action" << std::endl;
// If not, then take failure postAction
executePostFailAction(json, file);
}
@@ -681,8 +680,8 @@
* @returns Map of items in extraInterface.
*/
template <typename T>
-inventory::ObjectMap primeInventory(const nlohmann::json& jsObject,
- const T& vpdMap)
+inventory::ObjectMap
+ primeInventory(const nlohmann::json& jsObject, const T& vpdMap)
{
inventory::ObjectMap objects;
@@ -1110,17 +1109,17 @@
std::ostringstream busStream;
for (uint16_t byte : backupValue)
{
- busStream << std::setfill('0')
- << std::setw(2) << std::hex
- << "0x" << byte << " ";
+ busStream
+ << std::setfill('0') << std::setw(2)
+ << std::hex << "0x" << byte << " ";
}
std::ostringstream vpdStream;
for (uint16_t byte : kwdValue)
{
- vpdStream << std::setfill('0')
- << std::setw(2) << std::hex
- << "0x" << byte << " ";
+ vpdStream
+ << std::setfill('0') << std::setw(2)
+ << std::hex << "0x" << byte << " ";
}
// data mismatch
diff --git a/ibm_vpd_utils.cpp b/ibm_vpd_utils.cpp
index de38c6e..d015d86 100644
--- a/ibm_vpd_utils.cpp
+++ b/ibm_vpd_utils.cpp
@@ -717,16 +717,16 @@
std::string hexString;
std::visit(
[&hexString](auto&& kw) {
- std::stringstream ss;
- std::string hexRep = "0x";
- ss << hexRep;
- for (auto& kwVal : kw)
- {
- ss << std::setfill('0') << std::setw(2) << std::hex
- << static_cast<int>(kwVal);
- }
- hexString = ss.str();
- },
+ std::stringstream ss;
+ std::string hexRep = "0x";
+ ss << hexRep;
+ for (auto& kwVal : kw)
+ {
+ ss << std::setfill('0') << std::setw(2) << std::hex
+ << static_cast<int>(kwVal);
+ }
+ hexString = ss.str();
+ },
kw);
return hexString;
}
@@ -736,18 +736,18 @@
std::string kwString{};
std::visit(
[&kwString](auto&& kwVal) {
- const auto it =
- std::find_if(kwVal.begin(), kwVal.end(),
- [](const auto& kw) { return !isprint(kw); });
- if (it != kwVal.end())
- {
- kwString = hexString(kwVal);
- }
- else
- {
- kwString = std::string(kwVal.begin(), kwVal.end());
- }
- },
+ const auto it =
+ std::find_if(kwVal.begin(), kwVal.end(),
+ [](const auto& kw) { return !isprint(kw); });
+ if (it != kwVal.end())
+ {
+ kwString = hexString(kwVal);
+ }
+ else
+ {
+ kwString = std::string(kwVal.begin(), kwVal.end());
+ }
+ },
kwVal);
return kwString;
}
@@ -1007,10 +1007,10 @@
// TODO: How do we handle multiple chassis?
std::string powerState{};
auto bus = sdbusplus::bus::new_default();
- auto properties = bus.new_method_call("xyz.openbmc_project.State.Chassis0",
- "/xyz/openbmc_project/state/chassis0",
- "org.freedesktop.DBus.Properties",
- "Get");
+ auto properties =
+ bus.new_method_call("xyz.openbmc_project.State.Chassis0",
+ "/xyz/openbmc_project/state/chassis0",
+ "org.freedesktop.DBus.Properties", "Get");
properties.append("xyz.openbmc_project.State.Chassis");
properties.append("CurrentPowerState");
auto result = bus.call(properties);
diff --git a/ibm_vpd_utils.hpp b/ibm_vpd_utils.hpp
index 03015d1..5f0f9e7 100644
--- a/ibm_vpd_utils.hpp
+++ b/ibm_vpd_utils.hpp
@@ -139,9 +139,9 @@
try
{
auto bus = sdbusplus::bus::new_default();
- auto properties = bus.new_method_call(service.c_str(), object.c_str(),
- "org.freedesktop.DBus.Properties",
- "Get");
+ auto properties =
+ bus.new_method_call(service.c_str(), object.c_str(),
+ "org.freedesktop.DBus.Properties", "Get");
properties.append(inf);
properties.append(prop);
auto result = bus.call(properties);
@@ -383,10 +383,9 @@
* @param[in] bindOrUnbind - either bind or unbind
* @returns Command to bind or unbind the driver.
*/
-inline std::string createBindUnbindDriverCmnd(const std::string& devNameAddr,
- const std::string& busType,
- const std::string& driverType,
- const std::string& bindOrUnbind)
+inline std::string createBindUnbindDriverCmnd(
+ const std::string& devNameAddr, const std::string& busType,
+ const std::string& driverType, const std::string& bindOrUnbind)
{
return ("echo " + devNameAddr + " > /sys/bus/" + busType + "/drivers/" +
driverType + "/" + bindOrUnbind);
@@ -487,9 +486,9 @@
try
{
auto bus = sdbusplus::bus::new_default();
- auto method = bus.new_method_call(service.c_str(), object.c_str(),
- "org.freedesktop.DBus.Properties",
- "Set");
+ auto method =
+ bus.new_method_call(service.c_str(), object.c_str(),
+ "org.freedesktop.DBus.Properties", "Set");
method.append(interface);
method.append(propertyName);
method.append(propertyValue);
diff --git a/impl.cpp b/impl.cpp
index 1f1cb9e..4e43303 100644
--- a/impl.cpp
+++ b/impl.cpp
@@ -79,11 +79,11 @@
int rc = eccStatus::SUCCESS;
auto vpdPtr = vpd.cbegin();
- auto l_status =
- vpdecc_check_data(const_cast<uint8_t*>(&vpdPtr[offsets::VHDR_RECORD]),
- lengths::VHDR_RECORD_LENGTH,
- const_cast<uint8_t*>(&vpdPtr[offsets::VHDR_ECC]),
- lengths::VHDR_ECC_LENGTH);
+ auto l_status = vpdecc_check_data(
+ const_cast<uint8_t*>(&vpdPtr[offsets::VHDR_RECORD]),
+ lengths::VHDR_RECORD_LENGTH,
+ const_cast<uint8_t*>(&vpdPtr[offsets::VHDR_ECC]),
+ lengths::VHDR_ECC_LENGTH);
if (l_status == VPD_ECC_CORRECTABLE_DATA)
{
try
diff --git a/impl.hpp b/impl.hpp
index 280ba3b..b1aa060 100644
--- a/impl.hpp
+++ b/impl.hpp
@@ -74,13 +74,12 @@
*/
Impl(const Binary& vpdBuffer, const std::string& path,
const std::string& vpdFilePath, uint32_t vpdStartOffset) :
- vpd(vpdBuffer),
- inventoryPath(path), vpdFilePath(vpdFilePath),
+ vpd(vpdBuffer), inventoryPath(path), vpdFilePath(vpdFilePath),
vpdStartOffset(vpdStartOffset), out{}
{
#ifndef ManagerTest
- vpdFileStream.exceptions(std::ifstream::badbit |
- std::ifstream::failbit);
+ vpdFileStream.exceptions(
+ std::ifstream::badbit | std::ifstream::failbit);
#endif
try
{
diff --git a/test/keyword_vpd_parser_test/kw_vpd_test.cpp b/test/keyword_vpd_parser_test/kw_vpd_test.cpp
index becdd56..dc05358 100644
--- a/test/keyword_vpd_parser_test/kw_vpd_test.cpp
+++ b/test/keyword_vpd_parser_test/kw_vpd_test.cpp
@@ -49,10 +49,10 @@
0x50, 0x32, 0x2d, 0x44, 0x37, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x32, 0x53, 0x53, 0x43, 0x83, 0x50, 0x32, 0x2d, 0x44, 0x38, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x32, 0x53, 0x53, 0x43}},
- pair<std::string, Binary>{"B2",
- {0x50, 0x05, 0x07, 0x60, 0x73, 0x00, 0x72,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00}},
+ pair<std::string, Binary>{
+ "B2",
+ {0x50, 0x05, 0x07, 0x60, 0x73, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00}},
pair<std::string, Binary>{"MF", {0x00, 0x10}},
pair<std::string, Binary>{"VZ", {0x30, 0x33}},
pair<std::string, Binary>{"PN",
diff --git a/test/vpd-manager-test/reader_test.cpp b/test/vpd-manager-test/reader_test.cpp
index 54c98f0..dd576e6 100644
--- a/test/vpd-manager-test/reader_test.cpp
+++ b/test/vpd-manager-test/reader_test.cpp
@@ -152,8 +152,8 @@
MockUtilCalls uCalls;
ReaderImpl read(uCalls);
- ListOfPaths paths = read.getFrusAtLocation(LocationCode, nodeNumber,
- fruLocationCode);
+ ListOfPaths paths =
+ read.getFrusAtLocation(LocationCode, nodeNumber, fruLocationCode);
std::string expected =
"/xyz/openbmc_project/inventory/system/chassis/motherboard";
EXPECT_EQ(paths.at(0), expected);
@@ -168,8 +168,8 @@
ReaderImpl read(uCalls);
ListOfPaths paths;
EXPECT_ANY_THROW({
- paths = read.getFRUsByExpandedLocationCode(locationCode,
- fruLocationCode);
+ paths =
+ read.getFRUsByExpandedLocationCode(locationCode, fruLocationCode);
});
// unused variable warning
@@ -178,8 +178,8 @@
// length is les sthan 17 for expanded location code
locationCode = "U9105.22A.SIMP10";
EXPECT_ANY_THROW({
- paths = read.getFRUsByExpandedLocationCode(locationCode,
- fruLocationCode);
+ paths =
+ read.getFRUsByExpandedLocationCode(locationCode, fruLocationCode);
});
// Invalid location code. No "."
@@ -195,8 +195,8 @@
// unused variable warning
(void)paths;
EXPECT_ANY_THROW({
- paths = read.getFRUsByExpandedLocationCode(locationCode,
- fruLocationCode);
+ paths =
+ read.getFRUsByExpandedLocationCode(locationCode, fruLocationCode);
});
}
@@ -213,8 +213,8 @@
testing::Return("78DAPQRS")); // return a dummy value for FC keyword
ReaderImpl read(uCalls);
- ListOfPaths paths = read.getFRUsByExpandedLocationCode(validLocationCode,
- fruLocationCode);
+ ListOfPaths paths =
+ read.getFRUsByExpandedLocationCode(validLocationCode, fruLocationCode);
std::string expected =
"/xyz/openbmc_project/inventory/system/chassis/motherboard";
@@ -241,8 +241,8 @@
testing::Return("9105PQRS")); // return a dummy value for TM keyword
ReaderImpl read(uCalls);
- ListOfPaths paths = read.getFRUsByExpandedLocationCode(validLocationCode,
- fruLocationCode);
+ ListOfPaths paths =
+ read.getFRUsByExpandedLocationCode(validLocationCode, fruLocationCode);
std::string expected = "/xyz/openbmc_project/inventory/system";
EXPECT_EQ(paths.at(0), expected);
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
diff --git a/vpd-parser/ipz_parser.hpp b/vpd-parser/ipz_parser.hpp
index 1b1f034..c4a3e26 100644
--- a/vpd-parser/ipz_parser.hpp
+++ b/vpd-parser/ipz_parser.hpp
@@ -38,8 +38,7 @@
*/
IpzVpdParser(const Binary& VpdVector, const std::string& path,
const std::string& vpdFilePath, uint32_t vpdStartOffset) :
- vpd(VpdVector),
- inventoryPath(path), vpdFilePath(vpdFilePath),
+ vpd(VpdVector), inventoryPath(path), vpdFilePath(vpdFilePath),
vpdStartOffset(vpdStartOffset)
{}
diff --git a/vpd-parser/memory_vpd_parser.cpp b/vpd-parser/memory_vpd_parser.cpp
index c141da9..4a0ac7c 100644
--- a/vpd-parser/memory_vpd_parser.cpp
+++ b/vpd-parser/memory_vpd_parser.cpp
@@ -107,8 +107,8 @@
}
else
{
- l_DiePerPackage = pow(constants::VALUE_2,
- (l_ByteValue - constants::VALUE_1));
+ l_DiePerPackage =
+ pow(constants::VALUE_2, (l_ByteValue - constants::VALUE_1));
}
return l_DiePerPackage;
}
@@ -143,13 +143,14 @@
? constants::VALUE_1
: constants::VALUE_0));
- uint8_t l_channelsPerDdimm = (((iterator[constants::SPD_BYTE_235] &
- constants::MASK_BYTE_BITS_6) >>
- constants::VALUE_6) +
- ((iterator[constants::SPD_BYTE_235] &
- constants::MASK_BYTE_BITS_7) >>
- constants::VALUE_7)) *
- l_channelsPerPhy;
+ uint8_t l_channelsPerDdimm =
+ (((iterator[constants::SPD_BYTE_235] &
+ constants::MASK_BYTE_BITS_6) >>
+ constants::VALUE_6) +
+ ((iterator[constants::SPD_BYTE_235] &
+ constants::MASK_BYTE_BITS_7) >>
+ constants::VALUE_7)) *
+ l_channelsPerPhy;
if (!checkValidValue(iterator[constants::SPD_BYTE_235] &
constants::MASK_BYTE_BITS_012,
@@ -167,10 +168,10 @@
? PRIMARY_BUS_WIDTH_32_BITS
: PRIMARY_BUS_WIDTH_UNUSED;
- if (!checkValidValue(iterator[constants::SPD_BYTE_4] &
- constants::MASK_BYTE_BITS_567,
- constants::SHIFT_BITS_5, constants::VALUE_0,
- constants::VALUE_5))
+ if (!checkValidValue(
+ iterator[constants::SPD_BYTE_4] & constants::MASK_BYTE_BITS_567,
+ constants::SHIFT_BITS_5, constants::VALUE_0,
+ constants::VALUE_5))
{
std::cerr
<< "Capacity calculation failed for die per package. DDIMM "
@@ -231,20 +232,20 @@
constants::VALUE_6));
#endif
- if (!checkValidValue(iterator[constants::SPD_BYTE_6] &
- constants::MASK_BYTE_BITS_567,
- constants::SHIFT_BITS_5, constants::VALUE_0,
- constants::VALUE_3))
+ if (!checkValidValue(
+ iterator[constants::SPD_BYTE_6] & constants::MASK_BYTE_BITS_567,
+ constants::SHIFT_BITS_5, constants::VALUE_0,
+ constants::VALUE_3))
{
std::cout
<< "Capacity calculation failed for dram width DDIMM Byte 6 value ["
<< iterator[constants::SPD_BYTE_6] << "]";
break;
}
- uint8_t l_dramWidth = VALUE_4 *
- (VALUE_1 << ((iterator[constants::SPD_BYTE_6] &
- constants::MASK_BYTE_BITS_567) >>
- constants::VALUE_5));
+ uint8_t l_dramWidth =
+ VALUE_4 * (VALUE_1 << ((iterator[constants::SPD_BYTE_6] &
+ constants::MASK_BYTE_BITS_567) >>
+ constants::VALUE_5));
dimmSize = (l_channelsPerDdimm * l_busWidthPerChannel *
l_diePerPackage * l_densityPerDie * l_ranksPerChannel) /
diff --git a/vpd_tool.cpp b/vpd_tool.cpp
index 911ce7f..d23fe7f 100644
--- a/vpd_tool.cpp
+++ b/vpd_tool.cpp
@@ -24,10 +24,10 @@
string val{};
uint32_t offset = 0;
- auto object = app.add_option("--object, -O", objectPath,
- "Enter the Object Path");
- auto record = app.add_option("--record, -R", recordName,
- "Enter the Record Name");
+ auto object =
+ app.add_option("--object, -O", objectPath, "Enter the Object Path");
+ auto record =
+ app.add_option("--record, -R", recordName, "Enter the Record Name");
auto kw = app.add_option("--keyword, -K", keyword, "Enter the Keyword");
auto valOption = app.add_option(
"--value, -V", val,
@@ -92,9 +92,9 @@
"--fixSystemVPD", "Use this option to interactively fix critical "
"system VPD keywords {vpd-tool-exe --fixSystemVPD}");
- auto mfgClean = app.add_flag("--mfgClean",
- "Flag to clean and reset specific keywords "
- "on system VPD to its default value.");
+ auto mfgClean =
+ app.add_flag("--mfgClean", "Flag to clean and reset specific keywords "
+ "on system VPD to its default value.");
auto confirm =
app.add_flag("--yes", "Using this flag with --mfgClean option, assumes "
diff --git a/vpd_tool_impl.cpp b/vpd_tool_impl.cpp
index 885cd5e..30f7294 100644
--- a/vpd_tool_impl.cpp
+++ b/vpd_tool_impl.cpp
@@ -118,8 +118,8 @@
uint32_t vpdStartOffset = 0;
vpdVector = getVpdDataInVector(js, vpdPath);
- ParserInterface* parser = ParserFactory::getParser(vpdVector, invPath,
- vpdPath, vpdStartOffset);
+ ParserInterface* parser =
+ ParserFactory::getParser(vpdVector, invPath, vpdPath, vpdStartOffset);
auto parseResult = parser->parse();
ParserFactory::freeParser(parser);
@@ -129,8 +129,8 @@
}
else
{
- std::string err = vpdPath +
- " is not of type IPZ VPD. Unable to parse the VPD.";
+ std::string err =
+ vpdPath + " is not of type IPZ VPD. Unable to parse the VPD.";
throw std::runtime_error(err);
}
}
@@ -552,8 +552,8 @@
}
auto bus = sdbusplus::bus::new_default();
- auto properties = bus.new_method_call(BUSNAME, OBJPATH, IFACE,
- "WriteKeyword");
+ auto properties =
+ bus.new_method_call(BUSNAME, OBJPATH, IFACE, "WriteKeyword");
properties.append(static_cast<sdbusplus::message::object_path>(fruPath));
properties.append(recordName);
properties.append(keyword);
@@ -1332,9 +1332,9 @@
backupValStr = backupValue;
}
- recKwData.push_back(make_tuple(++num, primaryRecord, primaryKeyword,
- backupValStr, primaryValStr,
- mismatch));
+ recKwData.push_back(
+ make_tuple(++num, primaryRecord, primaryKeyword, backupValStr,
+ primaryValStr, mismatch));
std::string splitLine(191, '-');
cout << left << setw(6) << static_cast<int>(num) << left << setw(8)
diff --git a/vpd_tool_impl.hpp b/vpd_tool_impl.hpp
index 18070f8..47a555f 100644
--- a/vpd_tool_impl.hpp
+++ b/vpd_tool_impl.hpp
@@ -316,8 +316,7 @@
VpdTool(const std::string&& fru, const std::string&& recName,
const std::string&& kw, const std::string&& val) :
- fruPath(std::move(fru)),
- recordName(std::move(recName)), keyword(std::move(kw)),
- value(std::move(val))
+ fruPath(std::move(fru)), recordName(std::move(recName)),
+ keyword(std::move(kw)), value(std::move(val))
{}
};