cleanup: Remove all warning errors for the Meson build support
Remove all the build warning to prepare for the meson build.
Meson build will be in
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-host-ipmid/+/47748
Tested:
Ipmi command works fine the cleanup.
```
$ systemctl status phosphor-ipmi-host
● phosphor-ipmi-host.service - Phosphor Inband IPMI
Loaded: loaded (/lib/systemd/system/phosphor-ipmi-host.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 1970-01-08 21:20:56 UTC; 21s ago
Main PID: 24987 (ipmid)
CGroup: /system.slice/phosphor-ipmi-host.service
└─24987 /tmp/ipmid
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X002B79], Cmd:[0X30] for Ethstats Commands
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X00C2CF], Cmd:[0X30] for Ethstats Commands
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X002B79], Cmd:[0X32] for Sys Commands
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X002B79], Cmd:[0X02] for I2C
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X00C2CF], Cmd:[0X02] for I2C
Jan 08 21:20:56 $HOST ipmid[24987]: I2C_WHITELIST_CHECK is disabled, do not populate whitelist
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X00C2CF], Cmd:[0X04] for Manual Zone Control
Jan 08 21:20:56 $HOST systemd[1]: Started Phosphor Inband IPMI.
Jan 08 21:20:56 $HOST ipmid[24987]: Loading whitelist filter
Jan 08 21:20:56 $HOST ipmid[24987]: Set restrictedMode = true
(reverse-i-search)`ipmi': systemctl status phosphor-^Cmi-host
$ ipmitool mc info
Device ID : 32
Device Revision : 1
Firmware Revision : 0.00
IPMI Version : 2.0
Manufacturer ID : 7244
Manufacturer Name : Quanta Computer Inc.
Product ID : 14426 (0x385a)
Product Name : Unknown (0x385A)
Device Available : yes
Provides Device SDRs : yes
Additional Device Support :
Sensor Device
SEL Device
FRU Inventory Device
Chassis Device
Aux Firmware Rev Info :
0x00
0x00
0x00
0x00
```
Change-Id: I372c9433a274bc633a24d213b7a1bc205531e33d
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/user_channel/channel_layer.cpp b/user_channel/channel_layer.cpp
index 03b1729..fb70f1e 100644
--- a/user_channel/channel_layer.cpp
+++ b/user_channel/channel_layer.cpp
@@ -29,7 +29,7 @@
// TODO: This is not the reliable way to find the device
// associated with ethernet interface as the channel number to
// eth association is not done. Need to revisit later
- struct stat fileStat = {0};
+ struct stat fileStat = {};
std::string devName("/sys/class/net/" + getChannelName(chNum));
if (stat(devName.data(), &fileStat) != 0)
diff --git a/user_channel/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp
index aa746fd..afdf062 100644
--- a/user_channel/channel_mgmt.cpp
+++ b/user_channel/channel_mgmt.cpp
@@ -364,9 +364,7 @@
sdbusplus::bus::match::rules::member(interfaceAddedSignal) +
sdbusplus::bus::match::rules::argNpath(
0, std::string(networkIntfObjectBasePath) + "/"),
- [&](sdbusplus::message::message& msg) {
- initChannelPersistData();
- });
+ [&](sdbusplus::message::message&) { initChannelPersistData(); });
chInterfaceRemovedSignal = std::make_unique<sdbusplus::bus::match_t>(
bus,
@@ -374,9 +372,7 @@
sdbusplus::bus::match::rules::member(interfaceRemovedSignal) +
sdbusplus::bus::match::rules::argNpath(
0, std::string(networkIntfObjectBasePath) + "/"),
- [&](sdbusplus::message::message& msg) {
- initChannelPersistData();
- });
+ [&](sdbusplus::message::message&) { initChannelPersistData(); });
}
}
diff --git a/user_channel/cipher_mgmt.cpp b/user_channel/cipher_mgmt.cpp
index 8355865..5f50c86 100644
--- a/user_channel/cipher_mgmt.cpp
+++ b/user_channel/cipher_mgmt.cpp
@@ -120,10 +120,10 @@
std::string tmpFile =
static_cast<std::string>(cipherSuitePrivFileName) + "_tmpXXXXXX";
- char tmpRandomFile[tmpFile.length() + 1];
- strncpy(tmpRandomFile, tmpFile.c_str(), tmpFile.length() + 1);
+ std::vector<char> tmpRandomFile(tmpFile.length() + 1);
+ strncpy(tmpRandomFile.data(), tmpFile.c_str(), tmpFile.length() + 1);
- int fd = mkstemp(tmpRandomFile);
+ int fd = mkstemp(tmpRandomFile.data());
fchmod(fd, 0644);
if (fd < 0)
@@ -139,16 +139,16 @@
close(fd);
log<level::ERR>("Error writing CS privilege level config file",
entry("FILE_NAME=%s", tmpFile.c_str()));
- unlink(tmpRandomFile);
+ unlink(tmpRandomFile.data());
return -EIO;
}
close(fd);
- if (std::rename(tmpRandomFile, cipherSuitePrivFileName.c_str()))
+ if (std::rename(tmpRandomFile.data(), cipherSuitePrivFileName.c_str()))
{
log<level::ERR>("Error renaming CS privilege level config file",
entry("FILE_NAME=%s", tmpFile.c_str()));
- unlink(tmpRandomFile);
+ unlink(tmpRandomFile.data());
return -EIO;
}
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index 1644154..c205fea 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -1204,8 +1204,7 @@
void UserAccess::updatePayloadAccessInUserInfo(
const std::array<std::array<bool, ipmiMaxChannels>, payloadsPerByte>&
stdPayload,
- const std::array<std::array<bool, ipmiMaxChannels>, payloadsPerByte>&
- oemPayload,
+ const std::array<std::array<bool, ipmiMaxChannels>, payloadsPerByte>&,
UserInfo& userInfo)
{
for (size_t chIndex = 0; chIndex < ipmiMaxChannels; ++chIndex)
diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp
index 7af38b9..901e4a6 100644
--- a/user_channel/usercommands.cpp
+++ b/user_channel/usercommands.cpp
@@ -85,7 +85,7 @@
return ipmi::responseParmOutOfRange();
}
- PrivAccess privAccess = {0};
+ PrivAccess privAccess = {};
if (bitsUpdate)
{
privAccess.ipmiEnabled = static_cast<uint8_t>(ipmiEnabled);
@@ -207,7 +207,8 @@
* @returns ipmi response
*/
ipmi::RspType<>
- ipmiSetUserName(ipmi::Context::ptr ctx, uint6_t id, uint2_t reserved,
+ ipmiSetUserName([[maybe_unused]] ipmi::Context::ptr ctx, uint6_t id,
+ uint2_t reserved,
const std::array<uint8_t, ipmi::ipmiMaxUserName>& name)
{
if (reserved)
@@ -238,7 +239,8 @@
* @returns ipmi response with 16-byte username
*/
ipmi::RspType<std::array<uint8_t, ipmi::ipmiMaxUserName>> // user name
- ipmiGetUserName(ipmi::Context::ptr ctx, uint6_t id, uint2_t reserved)
+ ipmiGetUserName([[maybe_unused]] ipmi::Context::ptr ctx, uint6_t id,
+ uint2_t reserved)
{
if (reserved)
{
@@ -271,9 +273,9 @@
* @returns ipmi response with 16-byte username
*/
ipmi::RspType<> // user name
- ipmiSetUserPassword(ipmi::Context::ptr ctx, uint6_t id, bool reserved1,
- bool pwLen20, uint2_t operation, uint6_t reserved2,
- SecureBuffer& userPassword)
+ ipmiSetUserPassword([[maybe_unused]] ipmi::Context::ptr ctx, uint6_t id,
+ bool reserved1, bool pwLen20, uint2_t operation,
+ uint6_t reserved2, SecureBuffer& userPassword)
{
if (reserved1 || reserved2)
{
@@ -404,7 +406,8 @@
>
ipmiGetChannelAuthenticationCapabilities(ipmi::Context::ptr ctx,
uint4_t chNum, uint3_t reserved1,
- bool extData, uint4_t privLevel,
+ [[maybe_unused]] bool extData,
+ uint4_t privLevel,
uint4_t reserved2)
{
uint8_t channel =
@@ -522,7 +525,7 @@
return ipmi::responseParmOutOfRange();
}
- PayloadAccess payloadAccess = {0};
+ PayloadAccess payloadAccess = {};
payloadAccess.stdPayloadEnables1[1] = stdPayload1SOL;
return ipmi::response(ipmiUserSetUserPayloadAccess(