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: I01547e98d27910919e09ebf7907c86292a6c825d
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/user_channel/channel_layer.cpp b/user_channel/channel_layer.cpp
index 02dd055..26bc3fa 100644
--- a/user_channel/channel_layer.cpp
+++ b/user_channel/channel_layer.cpp
@@ -104,8 +104,8 @@
Cc getChannelAccessPersistData(const uint8_t chNum, ChannelAccess& chAccessData)
{
- return getChannelConfigObject().getChannelAccessPersistData(chNum,
- chAccessData);
+ return getChannelConfigObject().getChannelAccessPersistData(
+ chNum, chAccessData);
}
Cc setChannelAccessPersistData(const uint8_t chNum,
@@ -125,8 +125,8 @@
Cc getChannelEnabledAuthType(const uint8_t chNum, const uint8_t priv,
EAuthType& authType)
{
- return getChannelConfigObject().getChannelEnabledAuthType(chNum, priv,
- authType);
+ return getChannelConfigObject().getChannelEnabledAuthType(
+ chNum, priv, authType);
}
std::string getChannelName(const uint8_t chNum)
diff --git a/user_channel/channel_layer.hpp b/user_channel/channel_layer.hpp
index 37d2b90..551b0b6 100644
--- a/user_channel/channel_layer.hpp
+++ b/user_channel/channel_layer.hpp
@@ -284,8 +284,8 @@
* @return same channel number or proper channel number for current channel
* number (0xE).
*/
-static inline uint8_t convertCurrentChannelNum(const uint8_t chNum,
- const uint8_t devChannel)
+static inline uint8_t
+ convertCurrentChannelNum(const uint8_t chNum, const uint8_t devChannel)
{
if (chNum == currentChNum)
{
diff --git a/user_channel/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp
index 13ea55b..ed95271 100644
--- a/user_channel/channel_mgmt.cpp
+++ b/user_channel/channel_mgmt.cpp
@@ -346,12 +346,12 @@
dBusPropertiesInterface) +
sdbusplus::bus::match::rules::argN(0, networkChConfigIntfName),
[&](sdbusplus::message_t& msg) {
- DbusChObjProperties props;
- std::string iface;
- std::string path = msg.get_path();
- msg.read(iface, props);
- processChAccessPropChange(path, props);
- });
+ DbusChObjProperties props;
+ std::string iface;
+ std::string path = msg.get_path();
+ msg.read(iface, props);
+ processChAccessPropChange(path, props);
+ });
signalHndlrObjectState = true;
chInterfaceAddedSignal = std::make_unique<sdbusplus::bus::match_t>(
@@ -676,9 +676,8 @@
return ccSuccess;
}
-Cc ChannelConfig::getChannelEnabledAuthType(const uint8_t chNum,
- const uint8_t priv,
- EAuthType& authType)
+Cc ChannelConfig::getChannelEnabledAuthType(
+ const uint8_t chNum, const uint8_t priv, EAuthType& authType)
{
if (!isValidChannel(chNum))
{
@@ -767,8 +766,8 @@
EChannelSessSupported
ChannelConfig::convertToSessionSupportIndex(const std::string& value)
{
- auto iter = std::find(sessionSupportList.begin(), sessionSupportList.end(),
- value);
+ auto iter =
+ std::find(sessionSupportList.begin(), sessionSupportList.end(), value);
if (iter == sessionSupportList.end())
{
lg2::error("Invalid session supported: {SESS_STR}", "SESS_STR", value);
@@ -972,8 +971,8 @@
chData.isChValid = channelFound &&
jsonChData[isValidString].get<bool>();
chData.activeSessCount = jsonChData.value(activeSessionsString, 0);
- chData.maxTransferSize = jsonChData.value(maxTransferSizeString,
- smallChannelSize);
+ chData.maxTransferSize =
+ jsonChData.value(maxTransferSizeString, smallChannelSize);
if (jsonChData.count(isManagementNIC) != 0)
{
chData.isManagementNIC =
@@ -1287,17 +1286,16 @@
return ret;
}
-int ChannelConfig::setDbusProperty(const std::string& service,
- const std::string& objPath,
- const std::string& interface,
- const std::string& property,
- const DbusVariant& value)
+int ChannelConfig::setDbusProperty(
+ const std::string& service, const std::string& objPath,
+ const std::string& interface, const std::string& property,
+ const DbusVariant& value)
{
try
{
- auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
- "org.freedesktop.DBus.Properties",
- "Set");
+ auto method =
+ bus.new_method_call(service.c_str(), objPath.c_str(),
+ "org.freedesktop.DBus.Properties", "Set");
method.append(interface, property, value);
diff --git a/user_channel/channelcommands.cpp b/user_channel/channelcommands.cpp
index 321526f..f98a5e7 100644
--- a/user_channel/channelcommands.cpp
+++ b/user_channel/channelcommands.cpp
@@ -40,11 +40,10 @@
*
* @ returns IPMI completion code
**/
-RspType<> ipmiSetChannelAccess(Context::ptr ctx, uint4_t channel,
- uint4_t reserved1, uint3_t accessMode,
- bool usrAuth, bool msgAuth, bool alertDisabled,
- uint2_t chanAccess, uint4_t channelPrivLimit,
- uint2_t reserved2, uint2_t channelPrivMode)
+RspType<> ipmiSetChannelAccess(
+ Context::ptr ctx, uint4_t channel, uint4_t reserved1, uint3_t accessMode,
+ bool usrAuth, bool msgAuth, bool alertDisabled, uint2_t chanAccess,
+ uint4_t channelPrivLimit, uint2_t reserved2, uint2_t channelPrivMode)
{
if (reserved1 || reserved2 ||
!isValidPrivLimit(static_cast<uint8_t>(channelPrivLimit)))
@@ -256,8 +255,8 @@
return responseInvalidFieldRequest();
}
- uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
- ctx->channel);
+ uint8_t chNum =
+ convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
if (!isValidChannel(chNum))
{
lg2::debug("Get channel Info - No support on channel: {CHANNEL}",
@@ -325,8 +324,8 @@
ipmiGetChannelPayloadSupport(Context::ptr ctx, uint4_t channel,
uint4_t reserved)
{
- uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
- ctx->channel);
+ uint8_t chNum =
+ convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
if (!doesDeviceExist(chNum) || !isValidChannel(chNum) || reserved)
{
@@ -369,8 +368,8 @@
ipmiGetChannelPayloadVersion(Context::ptr ctx, uint4_t chNum,
uint4_t reserved, uint8_t payloadTypeNum)
{
- uint8_t channel = convertCurrentChannelNum(static_cast<uint8_t>(chNum),
- ctx->channel);
+ uint8_t channel =
+ convertCurrentChannelNum(static_cast<uint8_t>(chNum), ctx->channel);
constexpr uint8_t payloadTypeNotSupported = 0x80;
if (reserved || !isValidChannel(channel))
diff --git a/user_channel/cipher_mgmt.cpp b/user_channel/cipher_mgmt.cpp
index f1bc543..c954f65 100644
--- a/user_channel/cipher_mgmt.cpp
+++ b/user_channel/cipher_mgmt.cpp
@@ -118,8 +118,8 @@
int CipherConfig::writeCSPrivilegeLevels(const Json& jsonData)
{
- std::string tmpFile = static_cast<std::string>(cipherSuitePrivFileName) +
- "_tmpXXXXXX";
+ std::string tmpFile =
+ static_cast<std::string>(cipherSuitePrivFileName) + "_tmpXXXXXX";
std::vector<char> tmpRandomFile(tmpFile.length() + 1);
strncpy(tmpRandomFile.data(), tmpFile.c_str(), tmpFile.length() + 1);
diff --git a/user_channel/file.hpp b/user_channel/file.hpp
index 76a03c7..204cfef 100644
--- a/user_channel/file.hpp
+++ b/user_channel/file.hpp
@@ -42,9 +42,7 @@
* @param[in] removeOnExit - File to be removed at exit or no
*/
File(const std::string& name, const std::string& mode,
- bool removeOnExit = false) :
- name(name),
- removeOnExit(removeOnExit)
+ bool removeOnExit = false) : name(name), removeOnExit(removeOnExit)
{
fp = fopen(name.c_str(), mode.c_str());
}
@@ -57,9 +55,7 @@
* @param[in] removeOnExit - File to be removed at exit or no
*/
File(int fd, const std::string& name, const std::string& mode,
- bool removeOnExit = false) :
- name(name),
- removeOnExit(removeOnExit)
+ bool removeOnExit = false) : name(name), removeOnExit(removeOnExit)
{
fp = fdopen(fd, mode.c_str());
}
diff --git a/user_channel/passwd_mgr.cpp b/user_channel/passwd_mgr.cpp
index 9b35ac7..f712779 100644
--- a/user_channel/passwd_mgr.cpp
+++ b/user_channel/passwd_mgr.cpp
@@ -141,12 +141,10 @@
}
}
-int PasswdMgr::encryptDecryptData(bool doEncrypt, const EVP_CIPHER* cipher,
- uint8_t* key, size_t keyLen, uint8_t* iv,
- size_t ivLen, uint8_t* inBytes,
- size_t inBytesLen, uint8_t* mac,
- size_t* macLen, unsigned char* outBytes,
- size_t* outBytesLen)
+int PasswdMgr::encryptDecryptData(
+ bool doEncrypt, const EVP_CIPHER* cipher, uint8_t* key, size_t keyLen,
+ uint8_t* iv, size_t ivLen, uint8_t* inBytes, size_t inBytesLen,
+ uint8_t* mac, size_t* macLen, unsigned char* outBytes, size_t* outBytesLen)
{
if (cipher == NULL || key == NULL || iv == NULL || inBytes == NULL ||
outBytes == NULL || mac == NULL || inBytesLen == 0 ||
@@ -163,9 +161,9 @@
std::array<uint8_t, EVP_MAX_MD_SIZE> calMac;
size_t calMacLen = calMac.size();
// calculate MAC for the encrypted message.
- if (NULL == HMAC(EVP_sha256(), key, keyLen, inBytes, inBytesLen,
- calMac.data(),
- reinterpret_cast<unsigned int*>(&calMacLen)))
+ if (NULL ==
+ HMAC(EVP_sha256(), key, keyLen, inBytes, inBytesLen, calMac.data(),
+ reinterpret_cast<unsigned int*>(&calMacLen)))
{
lg2::debug("Error: Failed to calculate MAC");
return -EIO;
@@ -203,8 +201,8 @@
inBytes, inBytesLen)))
{
outLen += outEVPLen;
- if ((retval = EVP_CipherFinal(ctx.get(), outBytes + outLen,
- &outEVPLen)))
+ if ((retval =
+ EVP_CipherFinal(ctx.get(), outBytes + outLen, &outEVPLen)))
{
outLen += outEVPLen;
*outBytesLen = outLen;
@@ -503,9 +501,9 @@
lg2::debug("Hash genertion failed, bailing out");
return -EIO;
}
- if (NULL == HMAC(digest, keyBuff.data(), keyBuff.size(), hash.data(),
- hashLen, key.data(),
- reinterpret_cast<unsigned int*>(&keyLen)))
+ if (NULL ==
+ HMAC(digest, keyBuff.data(), keyBuff.size(), hash.data(), hashLen,
+ key.data(), reinterpret_cast<unsigned int*>(&keyLen)))
{
lg2::debug("Failed to create MAC for authentication");
return -EIO;
diff --git a/user_channel/passwd_mgr.hpp b/user_channel/passwd_mgr.hpp
index 338f249..8932ac5 100644
--- a/user_channel/passwd_mgr.hpp
+++ b/user_channel/passwd_mgr.hpp
@@ -118,11 +118,10 @@
*
* @return error response
*/
- int encryptDecryptData(bool doEncrypt, const EVP_CIPHER* cipher,
- uint8_t* key, size_t keyLen, uint8_t* iv,
- size_t ivLen, uint8_t* inBytes, size_t inBytesLen,
- uint8_t* mac, size_t* macLen, uint8_t* outBytes,
- size_t* outBytesLen);
+ int encryptDecryptData(
+ bool doEncrypt, const EVP_CIPHER* cipher, uint8_t* key, size_t keyLen,
+ uint8_t* iv, size_t ivLen, uint8_t* inBytes, size_t inBytesLen,
+ uint8_t* mac, size_t* macLen, uint8_t* outBytes, size_t* outBytesLen);
/** @brief returns updated file time of passwd file entry.
*
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index 979aaa6..81e409e 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -158,9 +158,9 @@
{
try
{
- auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
- dBusPropertiesInterface,
- setPropertiesMethod);
+ auto method =
+ bus.new_method_call(service.c_str(), objPath.c_str(),
+ dBusPropertiesInterface, setPropertiesMethod);
method.append(interface, property, value);
bus.call(method);
}
@@ -182,8 +182,8 @@
{
try
{
- userMgmtService = ipmi::getUserService(bus, userMgrInterface,
- userMgrObjBasePath);
+ userMgmtService =
+ ipmi::getUserService(bus, userMgrInterface, userMgrObjBasePath);
}
catch (const sdbusplus::exception_t& e)
{
@@ -653,8 +653,8 @@
return PAM_BUF_ERR;
}
- void* ptr = calloc(static_cast<size_t>(numMsg),
- sizeof(struct pam_response));
+ void* ptr =
+ calloc(static_cast<size_t>(numMsg), sizeof(struct pam_response));
if (ptr == nullptr)
{
free(pass);
@@ -687,8 +687,8 @@
const_cast<char*>(password)};
pam_handle_t* localAuthHandle = NULL; // this gets set by pam_start
- int retval = pam_start("passwd", username, &localConversation,
- &localAuthHandle);
+ int retval =
+ pam_start("passwd", username, &localConversation, &localAuthHandle);
if (retval != PAM_SUCCESS)
{
@@ -831,10 +831,9 @@
return ccSuccess;
}
-Cc UserAccess::setUserPayloadAccess(const uint8_t chNum,
- const uint8_t operation,
- const uint8_t userId,
- const PayloadAccess& payloadAccess)
+Cc UserAccess::setUserPayloadAccess(
+ const uint8_t chNum, const uint8_t operation, const uint8_t userId,
+ const PayloadAccess& payloadAccess)
{
constexpr uint8_t enable = 0x0;
constexpr uint8_t disable = 0x1;
@@ -1390,8 +1389,8 @@
readPayloadAccessFromUserInfo(usersTbl.user[usrIndex], stdPayload,
oemPayload);
- Json jsonPayloadEnabledInfo = constructJsonPayloadEnables(stdPayload,
- oemPayload);
+ Json jsonPayloadEnabledInfo =
+ constructJsonPayloadEnables(stdPayload, oemPayload);
jsonUserInfo[payloadEnabledStr] = jsonPayloadEnabledInfo;
jsonUsersTbl.push_back(jsonUserInfo);
@@ -1652,16 +1651,16 @@
sdbusplus::bus::match::rules::interface(dBusObjManager) +
sdbusplus::bus::match::rules::path(userMgrObjBasePath),
[&](sdbusplus::message_t& msg) {
- userUpdatedSignalHandler(*this, msg);
- });
+ userUpdatedSignalHandler(*this, msg);
+ });
userMgrRenamedSignal = std::make_unique<sdbusplus::bus::match_t>(
bus,
sdbusplus::bus::match::rules::type::signal() +
sdbusplus::bus::match::rules::interface(userMgrInterface) +
sdbusplus::bus::match::rules::path(userMgrObjBasePath),
[&](sdbusplus::message_t& msg) {
- userUpdatedSignalHandler(*this, msg);
- });
+ userUpdatedSignalHandler(*this, msg);
+ });
userPropertiesSignal = std::make_unique<sdbusplus::bus::match_t>(
bus,
sdbusplus::bus::match::rules::type::signal() +
@@ -1671,8 +1670,8 @@
sdbusplus::bus::match::rules::member(propertiesChangedSignal) +
sdbusplus::bus::match::rules::argN(0, usersInterface),
[&](sdbusplus::message_t& msg) {
- userUpdatedSignalHandler(*this, msg);
- });
+ userUpdatedSignalHandler(*this, msg);
+ });
signalHndlrObject = true;
}
std::map<DbusUserObjPath, DbusUserObjValue> managedObjs;
diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp
index 53b34f8..cc7174f 100644
--- a/user_channel/usercommands.cpp
+++ b/user_channel/usercommands.cpp
@@ -48,15 +48,15 @@
*
* @returns ipmi completion code
*/
-ipmi::RspType<> ipmiSetUserAccess(ipmi::Context::ptr ctx, uint4_t channel,
- uint1_t ipmiEnabled, uint1_t linkAuthEnabled,
- uint1_t accessCallback, uint1_t bitsUpdate,
+ipmi::RspType<> ipmiSetUserAccess(
+ ipmi::Context::ptr ctx, uint4_t channel, uint1_t ipmiEnabled,
+ uint1_t linkAuthEnabled, uint1_t accessCallback, uint1_t bitsUpdate,
- uint6_t userId, uint2_t reserved1,
+ uint6_t userId, uint2_t reserved1,
- uint4_t privilege, uint4_t reserved2,
+ uint4_t privilege, uint4_t reserved2,
- std::optional<uint8_t> sessionLimit)
+ std::optional<uint8_t> sessionLimit)
{
uint8_t sessLimit = sessionLimit.value_or(0);
if (reserved1 || reserved2 || sessLimit ||
@@ -66,8 +66,8 @@
return ipmi::responseInvalidFieldRequest();
}
- uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
- ctx->channel);
+ uint8_t chNum =
+ convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
if (!isValidChannel(chNum))
{
lg2::debug("Set user access - Invalid channel request");
@@ -137,8 +137,8 @@
uint6_t userId, uint2_t reserved2)
{
- uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
- ctx->channel);
+ uint8_t chNum =
+ convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
if (reserved1 || reserved2 || !isValidChannel(chNum))
{
@@ -166,8 +166,8 @@
}
bool enabledState = false;
- retStatus = ipmiUserCheckEnabled(static_cast<uint8_t>(userId),
- enabledState);
+ retStatus =
+ ipmiUserCheckEnabled(static_cast<uint8_t>(userId), enabledState);
if (retStatus != ccSuccess)
{
return ipmi::response(retStatus);
@@ -205,10 +205,9 @@
* @returns ipmi response
*/
-ipmi::RspType<>
- ipmiSetUserName([[maybe_unused]] ipmi::Context::ptr ctx, uint6_t id,
- uint2_t reserved,
- const std::array<uint8_t, ipmi::ipmiMaxUserName>& name)
+ipmi::RspType<> ipmiSetUserName(
+ [[maybe_unused]] ipmi::Context::ptr ctx, uint6_t id, uint2_t reserved,
+ const std::array<uint8_t, ipmi::ipmiMaxUserName>& name)
{
if (reserved)
{
@@ -319,8 +318,8 @@
}
else if (operation == opEnableUser || operation == opDisableUser)
{
- ipmi::Cc res = ipmiUserUpdateEnabledState(userId,
- static_cast<bool>(operation));
+ ipmi::Cc res =
+ ipmiUserUpdateEnabledState(userId, static_cast<bool>(operation));
return ipmi::response(res);
}
else if (operation == opTestPassword)
@@ -405,14 +404,12 @@
uint24_t, // oemID
uint8_t // oemAuxillary
>
- ipmiGetChannelAuthenticationCapabilities(ipmi::Context::ptr ctx,
- uint4_t chNum, uint3_t reserved1,
- [[maybe_unused]] bool extData,
- uint4_t privLevel,
- uint4_t reserved2)
+ ipmiGetChannelAuthenticationCapabilities(
+ ipmi::Context::ptr ctx, uint4_t chNum, uint3_t reserved1,
+ [[maybe_unused]] bool extData, uint4_t privLevel, uint4_t reserved2)
{
- uint8_t channel = convertCurrentChannelNum(static_cast<uint8_t>(chNum),
- ctx->channel);
+ uint8_t channel =
+ convertCurrentChannelNum(static_cast<uint8_t>(chNum), ctx->channel);
if (reserved1 || reserved2 || !isValidChannel(channel) ||
!isValidPrivLimit(static_cast<uint8_t>(privLevel)))
@@ -498,8 +495,8 @@
uint8_t oemPayloadEnables2Reserved)
{
- auto chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
- ctx->channel);
+ auto chNum =
+ convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
// Validate the reserved args. Only SOL payload is supported as on date.
if (reserved || stdPayload0ipmiReserved || stdPayload2 || stdPayload3 ||
stdPayload4 || stdPayload5 || stdPayload6 || stdPayload7 ||
@@ -593,8 +590,8 @@
uint6_t userId, uint2_t reserved2)
{
- uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
- ctx->channel);
+ uint8_t chNum =
+ convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
if (reserved1 || reserved2 || !isValidChannel(chNum))
{
@@ -618,27 +615,28 @@
return ipmi::response(retStatus);
}
constexpr uint8_t res8bits = 0;
- return ipmi::responseSuccess(payloadAccess.stdPayloadEnables1.test(0),
- payloadAccess.stdPayloadEnables1.test(1),
- payloadAccess.stdPayloadEnables1.test(2),
- payloadAccess.stdPayloadEnables1.test(3),
- payloadAccess.stdPayloadEnables1.test(4),
- payloadAccess.stdPayloadEnables1.test(5),
- payloadAccess.stdPayloadEnables1.test(6),
- payloadAccess.stdPayloadEnables1.test(7),
+ return ipmi::responseSuccess(
+ payloadAccess.stdPayloadEnables1.test(0),
+ payloadAccess.stdPayloadEnables1.test(1),
+ payloadAccess.stdPayloadEnables1.test(2),
+ payloadAccess.stdPayloadEnables1.test(3),
+ payloadAccess.stdPayloadEnables1.test(4),
+ payloadAccess.stdPayloadEnables1.test(5),
+ payloadAccess.stdPayloadEnables1.test(6),
+ payloadAccess.stdPayloadEnables1.test(7),
- res8bits,
+ res8bits,
- payloadAccess.oemPayloadEnables1.test(0),
- payloadAccess.oemPayloadEnables1.test(1),
- payloadAccess.oemPayloadEnables1.test(2),
- payloadAccess.oemPayloadEnables1.test(3),
- payloadAccess.oemPayloadEnables1.test(4),
- payloadAccess.oemPayloadEnables1.test(5),
- payloadAccess.oemPayloadEnables1.test(6),
- payloadAccess.oemPayloadEnables1.test(7),
+ payloadAccess.oemPayloadEnables1.test(0),
+ payloadAccess.oemPayloadEnables1.test(1),
+ payloadAccess.oemPayloadEnables1.test(2),
+ payloadAccess.oemPayloadEnables1.test(3),
+ payloadAccess.oemPayloadEnables1.test(4),
+ payloadAccess.oemPayloadEnables1.test(5),
+ payloadAccess.oemPayloadEnables1.test(6),
+ payloadAccess.oemPayloadEnables1.test(7),
- res8bits);
+ res8bits);
}
void registerUserIpmiFunctions() __attribute__((constructor));