summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2020-07-25 07:45:05 +0300
committerEd Tanous <ed@tanous.net>2020-08-17 23:54:37 +0300
commit23a21a1cbed23ace4174664950e595df961e9e69 (patch)
tree12e7cc9d9301642fc1e48332a0e0834c54e8c8af /redfish-core
parent52cc112d962920b035c870127784bcbd98948fad (diff)
downloadbmcweb-23a21a1cbed23ace4174664950e595df961e9e69.tar.xz
Enable clang warnings
This commit enables clang warnings, and fixes all warnings that were found. Most of these fall into a couple categories: Variable shadow issues were fixed by renaming variables unused parameter warnings were resolved by either checking error codes that had been ignored, or removing the name of the variable from the scope. Other various warnings were fixed in the best way I was able to come up with. Note, the redfish Node class is especially insidious, as it causes all imlementers to have variables for parameters, regardless of whether or not they are used. Deprecating the Node class is on my list of things to do, as it adds extra overhead, and in general isn't a useful abstraction. For now, I have simply fixed all the handlers. Tested: Added the current meta-clang meta layer into bblayers.conf, and added TOOLCHAIN_pn-bmcweb = "clang" to my local.conf Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/include/event_service_manager.hpp59
-rw-r--r--redfish-core/include/node.hpp10
-rw-r--r--redfish-core/include/privileges.hpp26
-rw-r--r--redfish-core/include/server_sent_events.hpp4
-rw-r--r--redfish-core/include/task_messages.hpp19
-rw-r--r--redfish-core/include/utils/fw_utils.hpp38
-rw-r--r--redfish-core/include/utils/systemd_utils.hpp2
-rw-r--r--redfish-core/lib/account_service.hpp73
-rw-r--r--redfish-core/lib/certificate_service.hpp12
-rw-r--r--redfish-core/lib/chassis.hpp31
-rw-r--r--redfish-core/lib/cpudimm.hpp44
-rw-r--r--redfish-core/lib/ethernet.hpp12
-rw-r--r--redfish-core/lib/event_service.hpp16
-rw-r--r--redfish-core/lib/health.hpp16
-rw-r--r--redfish-core/lib/led.hpp24
-rw-r--r--redfish-core/lib/log_services.hpp12
-rw-r--r--redfish-core/lib/managers.hpp38
-rw-r--r--redfish-core/lib/network_protocol.hpp10
-rw-r--r--redfish-core/lib/power.hpp6
-rw-r--r--redfish-core/lib/sensors.hpp53
-rw-r--r--redfish-core/lib/storage.hpp16
-rw-r--r--redfish-core/lib/systems.hpp55
-rw-r--r--redfish-core/lib/task.hpp8
-rw-r--r--redfish-core/ut/privileges_test.cpp12
24 files changed, 292 insertions, 304 deletions
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index 9c42e06d4e..64c3b7f574 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -48,7 +48,7 @@ static constexpr const char* eventServiceFile =
"/var/lib/bmcweb/eventservice_config.json";
#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
-std::shared_ptr<boost::asio::posix::stream_descriptor> inotifyConn = nullptr;
+static std::optional<boost::asio::posix::stream_descriptor> inotifyConn;
static constexpr const char* redfishEventLogDir = "/var/log";
static constexpr const char* redfishEventLogFile = "/var/log/redfish";
static constexpr const size_t iEventSize = sizeof(inotify_event);
@@ -113,8 +113,8 @@ static const Message* formatMessage(const std::string_view& messageID)
namespace event_log
{
-bool getUniqueEntryID(const std::string& logEntry, std::string& entryID,
- const bool firstEntry = true)
+inline bool getUniqueEntryID(const std::string& logEntry, std::string& entryID,
+ const bool firstEntry = true)
{
static time_t prevTs = 0;
static int index = 0;
@@ -149,9 +149,9 @@ bool getUniqueEntryID(const std::string& logEntry, std::string& entryID,
return true;
}
-int getEventLogParams(const std::string& logEntry, std::string& timestamp,
- std::string& messageID,
- std::vector<std::string>& messageArgs)
+inline int getEventLogParams(const std::string& logEntry,
+ std::string& timestamp, std::string& messageID,
+ std::vector<std::string>& messageArgs)
{
// The redfish log format is "<Timestamp> <MessageId>,<MessageArgs>"
// First get the Timestamp
@@ -195,9 +195,9 @@ int getEventLogParams(const std::string& logEntry, std::string& timestamp,
return 0;
}
-void getRegistryAndMessageKey(const std::string& messageID,
- std::string& registryName,
- std::string& messageKey)
+inline void getRegistryAndMessageKey(const std::string& messageID,
+ std::string& registryName,
+ std::string& messageKey)
{
// Redfish MessageIds are in the form
// RegistryName.MajorVersion.MinorVersion.MessageKey, so parse it to find
@@ -212,11 +212,12 @@ void getRegistryAndMessageKey(const std::string& messageID,
}
}
-int formatEventLogEntry(const std::string& logEntryID,
- const std::string& messageID,
- const std::vector<std::string>& messageArgs,
- std::string timestamp, const std::string customText,
- nlohmann::json& logEntryJson)
+inline int formatEventLogEntry(const std::string& logEntryID,
+ const std::string& messageID,
+ const std::vector<std::string>& messageArgs,
+ std::string timestamp,
+ const std::string customText,
+ nlohmann::json& logEntryJson)
{
// Get the Message from the MessageRegistry
const message_registries::Message* message =
@@ -267,7 +268,7 @@ int formatEventLogEntry(const std::string& logEntryID,
} // namespace event_log
#endif
-bool isFilterQuerySpecialChar(char c)
+inline bool isFilterQuerySpecialChar(char c)
{
switch (c)
{
@@ -280,10 +281,11 @@ bool isFilterQuerySpecialChar(char c)
}
}
-bool readSSEQueryParams(std::string sseFilter, std::string& formatType,
- std::vector<std::string>& messageIds,
- std::vector<std::string>& registryPrefixes,
- std::vector<std::string>& metricReportDefinitions)
+inline bool
+ readSSEQueryParams(std::string sseFilter, std::string& formatType,
+ std::vector<std::string>& messageIds,
+ std::vector<std::string>& registryPrefixes,
+ std::vector<std::string>& metricReportDefinitions)
{
sseFilter.erase(std::remove_if(sseFilter.begin(), sseFilter.end(),
isFilterQuerySpecialChar),
@@ -508,12 +510,12 @@ class Subscription
}
#endif
- void filterAndSendReports(const std::string& id,
+ void filterAndSendReports(const std::string& id2,
const std::string& readingsTs,
const ReadingsObjType& readings)
{
std::string metricReportDef =
- "/redfish/v1/TelemetryService/MetricReportDefinitions/" + id;
+ "/redfish/v1/TelemetryService/MetricReportDefinitions/" + id2;
// Empty list means no filter. Send everything.
if (metricReportDefinitions.size())
@@ -541,8 +543,8 @@ class Subscription
nlohmann::json msg = {
{"@odata.id", "/redfish/v1/TelemetryService/MetricReports/" + id},
{"@odata.type", "#MetricReport.v1_3_0.MetricReport"},
- {"Id", id},
- {"Name", id},
+ {"Id", id2},
+ {"Name", id2},
{"Timestamp", readingsTs},
{"MetricReportDefinition", {{"@odata.id", metricReportDef}}},
{"MetricValues", metricValuesArray}};
@@ -924,7 +926,7 @@ class EventServiceManager
std::string addSubscription(const std::shared_ptr<Subscription> subValue,
const bool updateFile = true)
{
- std::srand(static_cast<uint32_t>(std::time(0)));
+ std::srand(static_cast<uint32_t>(std::time(nullptr)));
std::string id;
int retry = 3;
@@ -937,7 +939,7 @@ class EventServiceManager
break;
}
--retry;
- };
+ }
if (retry <= 0)
{
@@ -1199,7 +1201,7 @@ class EventServiceManager
static void watchRedfishEventLogFile()
{
- if (inotifyConn == nullptr)
+ if (inotifyConn)
{
return;
}
@@ -1295,8 +1297,7 @@ class EventServiceManager
static int startEventLogMonitor(boost::asio::io_context& ioc)
{
- inotifyConn =
- std::make_shared<boost::asio::posix::stream_descriptor>(ioc);
+ inotifyConn.emplace(ioc);
inotifyFd = inotify_init1(IN_NONBLOCK);
if (inotifyFd == -1)
{
@@ -1486,6 +1487,6 @@ class EventServiceManager
}
return true;
}
-}; // namespace redfish
+};
} // namespace redfish
diff --git a/redfish-core/include/node.hpp b/redfish-core/include/node.hpp
index be098ca8be..b21fba542b 100644
--- a/redfish-core/include/node.hpp
+++ b/redfish-core/include/node.hpp
@@ -108,7 +108,7 @@ class Node
{
if (getRule != nullptr)
{
- getRule->requires(it->second);
+ getRule->privileges(it->second);
}
}
it = entityPrivileges.find(boost::beast::http::verb::post);
@@ -116,7 +116,7 @@ class Node
{
if (postRule != nullptr)
{
- postRule->requires(it->second);
+ postRule->privileges(it->second);
}
}
it = entityPrivileges.find(boost::beast::http::verb::patch);
@@ -124,7 +124,7 @@ class Node
{
if (patchRule != nullptr)
{
- patchRule->requires(it->second);
+ patchRule->privileges(it->second);
}
}
it = entityPrivileges.find(boost::beast::http::verb::put);
@@ -132,7 +132,7 @@ class Node
{
if (putRule != nullptr)
{
- putRule->requires(it->second);
+ putRule->privileges(it->second);
}
}
it = entityPrivileges.find(boost::beast::http::verb::delete_);
@@ -140,7 +140,7 @@ class Node
{
if (deleteRule != nullptr)
{
- deleteRule->requires(it->second);
+ deleteRule->privileges(it->second);
}
}
}
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index 0282f35ea3..d9bf1fc458 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -45,8 +45,9 @@ constexpr const size_t basePrivilegeCount = basePrivileges.size();
constexpr const size_t maxPrivilegeCount = 32;
/** @brief A vector of all privilege names and their indexes */
-static const std::vector<std::string> privilegeNames{basePrivileges.begin(),
- basePrivileges.end()};
+static const std::array<std::string, maxPrivilegeCount> privilegeNames{
+ "Login", "ConfigureManager", "ConfigureComponents", "ConfigureSelf",
+ "ConfigureUsers"};
/**
* @brief Redfish privileges
@@ -100,7 +101,7 @@ class Privileges
* @return None
*
*/
- bool setSinglePrivilege(const char* privilege)
+ bool setSinglePrivilege(const std::string_view privilege)
{
for (size_t searchIndex = 0; searchIndex < privilegeNames.size();
searchIndex++)
@@ -116,19 +117,6 @@ class Privileges
}
/**
- * @brief Sets given privilege in the bitset
- *
- * @param[in] privilege Privilege to be set
- *
- * @return None
- *
- */
- bool setSinglePrivilege(const std::string& privilege)
- {
- return setSinglePrivilege(privilege.c_str());
- }
-
- /**
* @brief Resets the given privilege in the bitset
*
* @param[in] privilege Privilege to be reset
@@ -159,10 +147,10 @@ class Privileges
* the setSinglePrivilege is called, or the Privilege structure is destroyed
*
*/
- std::vector<const std::string*>
+ std::vector<std::string>
getActivePrivilegeNames(const PrivilegeType type) const
{
- std::vector<const std::string*> activePrivileges;
+ std::vector<std::string> activePrivileges;
size_t searchIndex = 0;
size_t endIndex = basePrivilegeCount;
@@ -176,7 +164,7 @@ class Privileges
{
if (privilegeBitset.test(searchIndex))
{
- activePrivileges.emplace_back(&privilegeNames[searchIndex]);
+ activePrivileges.emplace_back(privilegeNames[searchIndex]);
}
}
diff --git a/redfish-core/include/server_sent_events.hpp b/redfish-core/include/server_sent_events.hpp
index 1c4d2a51fc..9f0da8ff02 100644
--- a/redfish-core/include/server_sent_events.hpp
+++ b/redfish-core/include/server_sent_events.hpp
@@ -229,6 +229,8 @@ class ServerSentEvents : public std::enable_shared_from_this<ServerSentEvents>
case SseConnState::initInProgress:
case SseConnState::sendInProgress:
case SseConnState::suspended:
+ case SseConnState::startInit:
+ case SseConnState::closed:
// do nothing
break;
case SseConnState::initFailed:
@@ -245,8 +247,6 @@ class ServerSentEvents : public std::enable_shared_from_this<ServerSentEvents>
sendEvent(std::to_string(reqData.first), reqData.second);
break;
}
- default:
- break;
}
return;
diff --git a/redfish-core/include/task_messages.hpp b/redfish-core/include/task_messages.hpp
index 050cc63c56..33c2db54bc 100644
--- a/redfish-core/include/task_messages.hpp
+++ b/redfish-core/include/task_messages.hpp
@@ -20,7 +20,7 @@ namespace redfish
namespace messages
{
-nlohmann::json taskAborted(const std::string& arg1)
+inline nlohmann::json taskAborted(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -31,7 +31,7 @@ nlohmann::json taskAborted(const std::string& arg1)
{"Resolution", "None."}};
}
-nlohmann::json taskCancelled(const std::string& arg1)
+inline nlohmann::json taskCancelled(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -42,7 +42,7 @@ nlohmann::json taskCancelled(const std::string& arg1)
{"Resolution", "None."}};
}
-nlohmann::json taskCompletedOK(const std::string& arg1)
+inline nlohmann::json taskCompletedOK(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -53,7 +53,7 @@ nlohmann::json taskCompletedOK(const std::string& arg1)
{"Resolution", "None."}};
}
-nlohmann::json taskCompletedWarning(const std::string& arg1)
+inline nlohmann::json taskCompletedWarning(const std::string& arg1)
{
return nlohmann::json{{"@odata.type", "#Message.v1_0_0.Message"},
{"MessageId", "TaskEvent.1.0.1.TaskCompletedWarning"},
@@ -64,7 +64,7 @@ nlohmann::json taskCompletedWarning(const std::string& arg1)
{"Resolution", "None."}};
}
-nlohmann::json taskPaused(const std::string& arg1)
+inline nlohmann::json taskPaused(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -75,7 +75,8 @@ nlohmann::json taskPaused(const std::string& arg1)
{"Resolution", "None."}};
}
-nlohmann::json taskProgressChanged(const std::string& arg1, const size_t arg2)
+inline nlohmann::json taskProgressChanged(const std::string& arg1,
+ const size_t arg2)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -87,7 +88,7 @@ nlohmann::json taskProgressChanged(const std::string& arg1, const size_t arg2)
{"Resolution", "None."}};
}
-nlohmann::json taskRemoved(const std::string& arg1)
+inline nlohmann::json taskRemoved(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -98,7 +99,7 @@ nlohmann::json taskRemoved(const std::string& arg1)
{"Resolution", "None."}};
}
-nlohmann::json taskResumed(const std::string& arg1)
+inline nlohmann::json taskResumed(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -109,7 +110,7 @@ nlohmann::json taskResumed(const std::string& arg1)
{"Resolution", "None."}};
}
-nlohmann::json taskStarted(const std::string& arg1)
+inline nlohmann::json taskStarted(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
diff --git a/redfish-core/include/utils/fw_utils.hpp b/redfish-core/include/utils/fw_utils.hpp
index 95d684fccc..65f19ca08b 100644
--- a/redfish-core/include/utils/fw_utils.hpp
+++ b/redfish-core/include/utils/fw_utils.hpp
@@ -28,10 +28,10 @@ constexpr const char* bmcPurpose =
*
* @return void
*/
-void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp,
- const std::string& fwVersionPurpose,
- const std::string& activeVersionPropName,
- const bool populateLinkToActiveImage)
+inline void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp,
+ const std::string& fwVersionPurpose,
+ const std::string& activeVersionPropName,
+ const bool populateLinkToActiveImage)
{
// Get active FW images
crow::connections::systemBus->async_method_call(
@@ -80,13 +80,13 @@ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp,
crow::connections::systemBus->async_method_call(
[aResp, fw, swId, fwVersionPurpose, activeVersionPropName,
populateLinkToActiveImage](
- const boost::system::error_code ec,
+ const boost::system::error_code ec2,
const std::vector<std::pair<
std::string, std::vector<std::string>>>& objInfo) {
- if (ec)
+ if (ec2)
{
- BMCWEB_LOG_DEBUG << "error_code = " << ec;
- BMCWEB_LOG_DEBUG << "error msg = " << ec.message();
+ BMCWEB_LOG_DEBUG << "error_code = " << ec2;
+ BMCWEB_LOG_DEBUG << "error msg = " << ec2.message();
messages::internalError(aResp->res);
return;
}
@@ -116,16 +116,16 @@ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp,
crow::connections::systemBus->async_method_call(
[aResp, swId, fwVersionPurpose,
activeVersionPropName, populateLinkToActiveImage](
- const boost::system::error_code ec,
+ const boost::system::error_code ec3,
const boost::container::flat_map<
std::string,
std::variant<bool, std::string, uint64_t,
uint32_t>>& propertiesList) {
- if (ec)
+ if (ec3)
{
- BMCWEB_LOG_ERROR << "error_code = " << ec;
+ BMCWEB_LOG_ERROR << "error_code = " << ec3;
BMCWEB_LOG_ERROR << "error msg = "
- << ec.message();
+ << ec3.message();
messages::internalError(aResp->res);
return;
}
@@ -230,7 +230,7 @@ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp,
*
* @return The corresponding Redfish state
*/
-std::string getRedfishFWState(const std::string& fwState)
+inline std::string getRedfishFWState(const std::string& fwState)
{
if (fwState == "xyz.openbmc_project.Software.Activation.Activations.Active")
{
@@ -262,7 +262,7 @@ std::string getRedfishFWState(const std::string& fwState)
*
* @return The corresponding Redfish health state
*/
-std::string getRedfishFWHealth(const std::string& fwState)
+inline std::string getRedfishFWHealth(const std::string& fwState)
{
if ((fwState ==
"xyz.openbmc_project.Software.Activation.Activations.Active") ||
@@ -292,9 +292,9 @@ std::string getRedfishFWHealth(const std::string& fwState)
*
* @return void
*/
-void getFwStatus(std::shared_ptr<AsyncResp> asyncResp,
- const std::shared_ptr<std::string> swId,
- const std::string& dbusSvc)
+inline void getFwStatus(std::shared_ptr<AsyncResp> asyncResp,
+ const std::shared_ptr<std::string> swId,
+ const std::string& dbusSvc)
{
BMCWEB_LOG_DEBUG << "getFwStatus: swId " << *swId << " svc " << dbusSvc;
@@ -350,8 +350,8 @@ void getFwStatus(std::shared_ptr<AsyncResp> asyncResp,
* @param[i,o] asyncResp Async response object
* @param[i] fwId The firmware ID
*/
-void getFwUpdateableStatus(std::shared_ptr<AsyncResp> asyncResp,
- const std::shared_ptr<std::string> fwId)
+inline void getFwUpdateableStatus(std::shared_ptr<AsyncResp> asyncResp,
+ const std::shared_ptr<std::string> fwId)
{
crow::connections::systemBus->async_method_call(
[asyncResp, fwId](const boost::system::error_code ec,
diff --git a/redfish-core/include/utils/systemd_utils.hpp b/redfish-core/include/utils/systemd_utils.hpp
index da1b4e25bc..0db1d94000 100644
--- a/redfish-core/include/utils/systemd_utils.hpp
+++ b/redfish-core/include/utils/systemd_utils.hpp
@@ -29,7 +29,7 @@ namespace systemd_utils
* @return Service root UUID
*/
-const std::string getUuid()
+inline const std::string getUuid()
{
std::string ret;
// This ID needs to match the one in ipmid
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 052214985d..b8517b4a35 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -27,7 +27,7 @@
namespace redfish
{
-constexpr const char* ldapConfigObject =
+constexpr const char* ldapConfigObjectName =
"/xyz/openbmc_project/user/ldap/openldap";
constexpr const char* ADConfigObject =
"/xyz/openbmc_project/user/ldap/active_directory";
@@ -118,10 +118,10 @@ inline std::string getPrivilegeFromRoleId(std::string_view role)
return "";
}
-void userErrorMessageHandler(const sd_bus_error* e,
- std::shared_ptr<AsyncResp> asyncResp,
- const std::string& newUser,
- const std::string& username)
+inline void userErrorMessageHandler(const sd_bus_error* e,
+ std::shared_ptr<AsyncResp> asyncResp,
+ const std::string& newUser,
+ const std::string& username)
{
const char* errorMessage = e->name;
if (e == nullptr)
@@ -166,9 +166,9 @@ void userErrorMessageHandler(const sd_bus_error* e,
return;
}
-void parseLDAPConfigData(nlohmann::json& json_response,
- const LDAPConfigData& confData,
- const std::string& ldapType)
+inline void parseLDAPConfigData(nlohmann::json& json_response,
+ const LDAPConfigData& confData,
+ const std::string& ldapType)
{
std::string service =
(ldapType == "LDAP") ? "LDAPService" : "ActiveDirectoryService";
@@ -207,7 +207,7 @@ void parseLDAPConfigData(nlohmann::json& json_response,
* create, to delete or to set Rolemapping object based on the given input.
*
*/
-static void handleRoleMapPatch(
+inline void handleRoleMapPatch(
const std::shared_ptr<AsyncResp>& asyncResp,
const std::vector<std::pair<std::string, LDAPRoleMapData>>& roleMapObjData,
const std::string& serverType, std::vector<nlohmann::json>& input)
@@ -344,7 +344,7 @@ static void handleRoleMapPatch(
}
else if (serverType == "LDAP")
{
- dbusObjectPath = ldapConfigObject;
+ dbusObjectPath = ldapConfigObjectName;
}
BMCWEB_LOG_DEBUG << "Remote Group=" << *remoteGroup
@@ -389,13 +389,13 @@ inline void getLDAPConfigData(const std::string& ldapType,
crow::connections::systemBus->async_method_call(
[callback, ldapType](const boost::system::error_code ec,
const GetObjectType& resp) {
- LDAPConfigData confData{};
if (ec || resp.empty())
{
BMCWEB_LOG_ERROR << "DBUS response error during getting of "
"service name: "
<< ec;
- callback(false, confData, ldapType);
+ LDAPConfigData empty{};
+ callback(false, empty, ldapType);
return;
}
std::string service = resp.begin()->first;
@@ -551,14 +551,13 @@ inline void getLDAPConfigData(const std::string& ldapType,
"GetManagedObjects");
},
mapperBusName, mapperObjectPath, mapperIntf, "GetObject",
- ldapConfigObject, interfaces);
+ ldapConfigObjectName, interfaces);
}
class AccountService : public Node
{
public:
- AccountService(App& app) :
- Node(app, "/redfish/v1/AccountService/"), app(app)
+ AccountService(App& app) : Node(app, "/redfish/v1/AccountService/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -977,7 +976,7 @@ class AccountService : public Node
}
else if (serverType == "LDAP")
{
- dbusObjectPath = ldapConfigObject;
+ dbusObjectPath = ldapConfigObjectName;
}
std::optional<nlohmann::json> authentication;
@@ -1045,51 +1044,51 @@ class AccountService : public Node
serviceEnabled, dbusObjectPath,
remoteRoleMapData](
bool success, LDAPConfigData confData,
- const std::string& serverType) {
+ const std::string& serverT) {
if (!success)
{
messages::internalError(asyncResp->res);
return;
}
- parseLDAPConfigData(asyncResp->res.jsonValue, confData, serverType);
+ parseLDAPConfigData(asyncResp->res.jsonValue, confData, serverT);
if (confData.serviceEnabled)
{
// Disable the service first and update the rest of
// the properties.
- handleServiceEnablePatch(false, asyncResp, serverType,
+ handleServiceEnablePatch(false, asyncResp, serverT,
dbusObjectPath);
}
if (serviceAddressList)
{
handleServiceAddressPatch(*serviceAddressList, asyncResp,
- serverType, dbusObjectPath);
+ serverT, dbusObjectPath);
}
if (userName)
{
- handleUserNamePatch(*userName, asyncResp, serverType,
+ handleUserNamePatch(*userName, asyncResp, serverT,
dbusObjectPath);
}
if (password)
{
- handlePasswordPatch(*password, asyncResp, serverType,
+ handlePasswordPatch(*password, asyncResp, serverT,
dbusObjectPath);
}
if (baseDNList)
{
- handleBaseDNPatch(*baseDNList, asyncResp, serverType,
+ handleBaseDNPatch(*baseDNList, asyncResp, serverT,
dbusObjectPath);
}
if (userNameAttribute)
{
- handleUserNameAttrPatch(*userNameAttribute, asyncResp,
- serverType, dbusObjectPath);
+ handleUserNameAttrPatch(*userNameAttribute, asyncResp, serverT,
+ dbusObjectPath);
}
if (groupsAttribute)
{
- handleGroupNameAttrPatch(*groupsAttribute, asyncResp,
- serverType, dbusObjectPath);
+ handleGroupNameAttrPatch(*groupsAttribute, asyncResp, serverT,
+ dbusObjectPath);
}
if (serviceEnabled)
{
@@ -1099,7 +1098,7 @@ class AccountService : public Node
if (*serviceEnabled)
{
handleServiceEnablePatch(*serviceEnabled, asyncResp,
- serverType, dbusObjectPath);
+ serverT, dbusObjectPath);
}
}
else
@@ -1108,7 +1107,7 @@ class AccountService : public Node
// then revert it to the same state as it was
// before.
handleServiceEnablePatch(confData.serviceEnabled, asyncResp,
- serverType, dbusObjectPath);
+ serverT, dbusObjectPath);
}
if (remoteRoleMapData)
@@ -1116,8 +1115,8 @@ class AccountService : public Node
std::vector<nlohmann::json> remoteRoleMap =
std::move(*remoteRoleMapData);
- handleRoleMapPatch(asyncResp, confData.groupRoleList,
- serverType, remoteRoleMap);
+ handleRoleMapPatch(asyncResp, confData.groupRoleList, serverT,
+ remoteRoleMap);
}
});
}
@@ -1312,8 +1311,6 @@ class AccountService : public Node
std::variant<uint16_t>(*lockoutThreshold));
}
}
-
- App& app;
};
class AccountsCollection : public Node
@@ -1453,9 +1450,9 @@ class AccountsCollection : public Node
crow::connections::systemBus->async_method_call(
[asyncResp, username, password{std::move(password)}](
- const boost::system::error_code ec,
+ const boost::system::error_code ec2,
sdbusplus::message::message& m) {
- if (ec)
+ if (ec2)
{
userErrorMessageHandler(m.get_error(), asyncResp,
username, "");
@@ -1469,9 +1466,9 @@ class AccountsCollection : public Node
// but the password set failed.Something is wrong,
// so delete the user that we've already created
crow::connections::systemBus->async_method_call(
- [asyncResp,
- password](const boost::system::error_code ec) {
- if (ec)
+ [asyncResp, password](
+ const boost::system::error_code ec3) {
+ if (ec3)
{
messages::internalError(asyncResp->res);
return;
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 6ade4e5e3a..e237fd35f2 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -97,7 +97,7 @@ class CertificateService : public Node
* @param[in] path URL
* @return -1 on failure and number on success
*/
-long getIDFromURL(const std::string_view url)
+inline long getIDFromURL(const std::string_view url)
{
std::size_t found = url.rfind("/");
if (found == std::string::npos)
@@ -115,7 +115,7 @@ long getIDFromURL(const std::string_view url)
return -1;
}
-std::string
+inline std::string
getCertificateFromReqBody(const std::shared_ptr<AsyncResp>& asyncResp,
const crow::Request& req)
{
@@ -180,11 +180,9 @@ class CertificateFile
if (std::filesystem::exists(certDirectory))
{
BMCWEB_LOG_DEBUG << "Removing certificate file" << certificateFile;
- try
- {
- std::filesystem::remove_all(certDirectory);
- }
- catch (const std::filesystem::filesystem_error& e)
+ std::error_code ec;
+ std::filesystem::remove_all(certDirectory, ec);
+ if (ec)
{
BMCWEB_LOG_ERROR << "Failed to remove temp directory"
<< certDirectory;
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index ce0a8c1269..10b07980e0 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -33,7 +33,7 @@ namespace redfish
*
* @return None.
*/
-void getChassisState(std::shared_ptr<AsyncResp> aResp)
+inline void getChassisState(std::shared_ptr<AsyncResp> aResp)
{
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)}](
@@ -85,9 +85,9 @@ using ManagedObjectsType = std::vector<std::pair<
using PropertiesType = boost::container::flat_map<std::string, VariantType>;
-void getIntrusionByService(std::shared_ptr<AsyncResp> aResp,
- const std::string& service,
- const std::string& objPath)
+inline void getIntrusionByService(std::shared_ptr<AsyncResp> aResp,
+ const std::string& service,
+ const std::string& objPath)
{
BMCWEB_LOG_DEBUG << "Get intrusion status by service \n";
@@ -120,7 +120,7 @@ void getIntrusionByService(std::shared_ptr<AsyncResp> aResp,
/**
* Retrieves physical security properties over dbus
*/
-void getPhysicalSecurityData(std::shared_ptr<AsyncResp> aResp)
+inline void getPhysicalSecurityData(std::shared_ptr<AsyncResp> aResp)
{
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)}](
@@ -289,9 +289,9 @@ class Chassis : public Node
auto health = std::make_shared<HealthPopulate>(asyncResp);
crow::connections::systemBus->async_method_call(
- [health](const boost::system::error_code ec,
+ [health](const boost::system::error_code ec2,
std::variant<std::vector<std::string>>& resp) {
- if (ec)
+ if (ec2)
{
return; // no sensors = no failures
}
@@ -335,7 +335,7 @@ class Chassis : public Node
const std::string& connectionName =
connectionNames[0].first;
- const std::vector<std::string>& interfaces =
+ const std::vector<std::string>& interfaces2 =
connectionNames[0].second;
const std::array<const char*, 2> hasIndicatorLed = {
"xyz.openbmc_project.Inventory.Item.Panel",
@@ -343,8 +343,8 @@ class Chassis : public Node
for (const char* interface : hasIndicatorLed)
{
- if (std::find(interfaces.begin(), interfaces.end(),
- interface) != interfaces.end())
+ if (std::find(interfaces2.begin(), interfaces2.end(),
+ interface) != interfaces2.end())
{
getIndicatorLedState(asyncResp);
break;
@@ -353,7 +353,7 @@ class Chassis : public Node
crow::connections::systemBus->async_method_call(
[asyncResp, chassisId(std::string(chassisId))](
- const boost::system::error_code ec,
+ const boost::system::error_code ec2,
const std::vector<std::pair<
std::string, VariantType>>& propertiesList) {
for (const std::pair<std::string, VariantType>&
@@ -480,7 +480,7 @@ class Chassis : public Node
continue;
}
- const std::vector<std::string>& interfaces =
+ const std::vector<std::string>& interfaces3 =
connectionNames[0].second;
if (indicatorLed)
@@ -492,8 +492,9 @@ class Chassis : public Node
bool indicatorChassis = false;
for (const char* interface : hasIndicatorLed)
{
- if (std::find(interfaces.begin(), interfaces.end(),
- interface) != interfaces.end())
+ if (std::find(interfaces3.begin(),
+ interfaces3.end(),
+ interface) != interfaces3.end())
{
indicatorChassis = true;
break;
@@ -523,7 +524,7 @@ class Chassis : public Node
}
};
-void doChassisPowerCycle(std::shared_ptr<AsyncResp> asyncResp)
+inline void doChassisPowerCycle(std::shared_ptr<AsyncResp> asyncResp)
{
const char* processName = "xyz.openbmc_project.State.Chassis";
const char* objectPath = "/xyz/openbmc_project/state/chassis0";
diff --git a/redfish-core/lib/cpudimm.hpp b/redfish-core/lib/cpudimm.hpp
index 0510f2b611..b4178b41bc 100644
--- a/redfish-core/lib/cpudimm.hpp
+++ b/redfish-core/lib/cpudimm.hpp
@@ -29,9 +29,9 @@ using InterfacesProperties = boost::container::flat_map<
std::string,
boost::container::flat_map<std::string, dbus::utility::DbusVariantType>>;
-void getResourceList(std::shared_ptr<AsyncResp> aResp,
- const std::string& subclass,
- const std::vector<const char*>& collectionName)
+inline void getResourceList(std::shared_ptr<AsyncResp> aResp,
+ const std::string& subclass,
+ const std::vector<const char*>& collectionName)
{
BMCWEB_LOG_DEBUG << "Get available system cpu/mem resources.";
crow::connections::systemBus->async_method_call(
@@ -69,8 +69,9 @@ void getResourceList(std::shared_ptr<AsyncResp> aResp,
"/xyz/openbmc_project/inventory", 0, collectionName);
}
-void getCpuDataByInterface(std::shared_ptr<AsyncResp> aResp,
- const InterfacesProperties& cpuInterfacesProperties)
+inline void
+ getCpuDataByInterface(std::shared_ptr<AsyncResp> aResp,
+ const InterfacesProperties& cpuInterfacesProperties)
{
BMCWEB_LOG_DEBUG << "Get CPU resources by interface.";
@@ -193,9 +194,10 @@ void getCpuDataByInterface(std::shared_ptr<AsyncResp> aResp,
return;
}
-void getCpuDataByService(std::shared_ptr<AsyncResp> aResp,
- const std::string& cpuId, const std::string& service,
- const std::string& objPath)
+inline void getCpuDataByService(std::shared_ptr<AsyncResp> aResp,
+ const std::string& cpuId,
+ const std::string& service,
+ const std::string& objPath)
{
BMCWEB_LOG_DEBUG << "Get available system cpu resources by service.";
@@ -263,8 +265,9 @@ void getCpuDataByService(std::shared_ptr<AsyncResp> aResp,
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
}
-void getCpuAssetData(std::shared_ptr<AsyncResp> aResp,
- const std::string& service, const std::string& objPath)
+inline void getCpuAssetData(std::shared_ptr<AsyncResp> aResp,
+ const std::string& service,
+ const std::string& objPath)
{
BMCWEB_LOG_DEBUG << "Get Cpu Asset Data";
crow::connections::systemBus->async_method_call(
@@ -306,10 +309,10 @@ void getCpuAssetData(std::shared_ptr<AsyncResp> aResp,
"xyz.openbmc_project.Inventory.Decorator.Asset");
}
-void getAcceleratorDataByService(std::shared_ptr<AsyncResp> aResp,
- const std::string& acclrtrId,
- const std::string& service,
- const std::string& objPath)
+inline void getAcceleratorDataByService(std::shared_ptr<AsyncResp> aResp,
+ const std::string& acclrtrId,
+ const std::string& service,
+ const std::string& objPath)
{
BMCWEB_LOG_DEBUG
<< "Get available system Accelerator resources by service.";
@@ -365,8 +368,9 @@ void getAcceleratorDataByService(std::shared_ptr<AsyncResp> aResp,
service, objPath, "org.freedesktop.DBus.Properties", "GetAll", "");
}
-void getCpuData(std::shared_ptr<AsyncResp> aResp, const std::string& cpuId,
- const std::vector<const char*> inventoryItems)
+inline void getCpuData(std::shared_ptr<AsyncResp> aResp,
+ const std::string& cpuId,
+ const std::vector<const char*> inventoryItems)
{
BMCWEB_LOG_DEBUG << "Get available system cpu resources.";
@@ -891,8 +895,9 @@ void getDimmDataByService(std::shared_ptr<AsyncResp> aResp,
service, objPath, "org.freedesktop.DBus.Properties", "GetAll", "");
}
-void getDimmPartitionData(std::shared_ptr<AsyncResp> aResp,
- const std::string& service, const std::string& path)
+inline void getDimmPartitionData(std::shared_ptr<AsyncResp> aResp,
+ const std::string& service,
+ const std::string& path)
{
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)}](
@@ -958,7 +963,8 @@ void getDimmPartitionData(std::shared_ptr<AsyncResp> aResp,
"xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition");
}
-void getDimmData(std::shared_ptr<AsyncResp> aResp, const std::string& dimmId)
+inline void getDimmData(std::shared_ptr<AsyncResp> aResp,
+ const std::string& dimmId)
{
BMCWEB_LOG_DEBUG << "Get available system dimm resources.";
crow::connections::systemBus->async_method_call(
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index a47d4b1052..852b3b72c4 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -669,9 +669,9 @@ inline bool ipv4VerifyIpAndGetBitcount(const std::string& ip,
firstZeroInByteHit = false;
// Count bits
- for (int bitIdx = 7; bitIdx >= 0; bitIdx--)
+ for (long bitIdx = 7; bitIdx >= 0; bitIdx--)
{
- if (value & (1 << bitIdx))
+ if (value & (1L << bitIdx))
{
if (firstZeroInByteHit)
{
@@ -777,8 +777,8 @@ inline void deleteAndCreateIPv4(const std::string& ifaceId,
messages::internalError(asyncResp->res);
}
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec) {
- if (ec)
+ [asyncResp](const boost::system::error_code ec2) {
+ if (ec2)
{
messages::internalError(asyncResp->res);
}
@@ -843,8 +843,8 @@ inline void deleteAndCreateIPv6(const std::string& ifaceId,
messages::internalError(asyncResp->res);
}
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec) {
- if (ec)
+ [asyncResp](const boost::system::error_code ec2) {
+ if (ec2)
{
messages::internalError(asyncResp->res);
}
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index 26cd80a665..fa06fcf0b8 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -233,7 +233,7 @@ class EventDestinationCollection : public Node
std::string protocol;
std::optional<std::string> context;
std::optional<std::string> subscriptionType;
- std::optional<std::string> eventFormatType;
+ std::optional<std::string> eventFormatType2;
std::optional<std::string> retryPolicy;
std::optional<std::vector<std::string>> msgIds;
std::optional<std::vector<std::string>> regPrefixes;
@@ -244,7 +244,7 @@ class EventDestinationCollection : public Node
if (!json_util::readJson(
req, res, "Destination", destUrl, "Context", context,
"Protocol", protocol, "SubscriptionType", subscriptionType,
- "EventFormatType", eventFormatType, "HttpHeaders", headers,
+ "EventFormatType", eventFormatType2, "HttpHeaders", headers,
"RegistryPrefixes", regPrefixes, "MessageIds", msgIds,
"DeliveryRetryPolicy", retryPolicy, "MetricReportDefinitions",
mrdJsonArray, "ResourceTypes", resTypes))
@@ -328,22 +328,22 @@ class EventDestinationCollection : public Node
}
subValue->protocol = protocol;
- if (eventFormatType)
+ if (eventFormatType2)
{
if (std::find(supportedEvtFormatTypes.begin(),
supportedEvtFormatTypes.end(),
- *eventFormatType) == supportedEvtFormatTypes.end())
+ *eventFormatType2) == supportedEvtFormatTypes.end())
{
messages::propertyValueNotInList(
- asyncResp->res, *eventFormatType, "EventFormatType");
+ asyncResp->res, *eventFormatType2, "EventFormatType");
return;
}
- subValue->eventFormatType = *eventFormatType;
+ subValue->eventFormatType = *eventFormatType2;
}
else
{
// If not specified, use default "Event"
- subValue->eventFormatType.assign({"Event"});
+ subValue->eventFormatType = "Event";
}
if (context)
@@ -522,7 +522,7 @@ class EventServiceSSE : public Node
else
{
// If nothing specified, using default "Event"
- subValue->eventFormatType.assign({"Event"});
+ subValue->eventFormatType = "Event";
}
if (!subValue->registryPrefixes.empty())
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index 59c8a27a5c..4f21b3e438 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -28,13 +28,13 @@ namespace redfish
struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
{
- HealthPopulate(const std::shared_ptr<AsyncResp>& asyncResp) :
- asyncResp(asyncResp), jsonStatus(asyncResp->res.jsonValue["Status"])
+ HealthPopulate(const std::shared_ptr<AsyncResp>& asyncRespIn) :
+ asyncResp(asyncRespIn), jsonStatus(asyncResp->res.jsonValue["Status"])
{}
- HealthPopulate(const std::shared_ptr<AsyncResp>& asyncResp,
+ HealthPopulate(const std::shared_ptr<AsyncResp>& asyncRespIn,
nlohmann::json& status) :
- asyncResp(asyncResp),
+ asyncResp(asyncRespIn),
jsonStatus(status)
{}
@@ -46,10 +46,10 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
health = "OK";
rollup = "OK";
- for (const std::shared_ptr<HealthPopulate>& health : children)
+ for (const std::shared_ptr<HealthPopulate>& healthChild : children)
{
- health->globalInventoryPath = globalInventoryPath;
- health->statuses = statuses;
+ healthChild->globalInventoryPath = globalInventoryPath;
+ healthChild->statuses = statuses;
}
for (const auto& [path, interfaces] : statuses)
@@ -232,4 +232,4 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
std::string globalInventoryPath = "-"; // default to illegal dbus path
bool populated = false;
};
-} // namespace redfish \ No newline at end of file
+} // namespace redfish
diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp
index 25248f8979..a2a5bc9bc7 100644
--- a/redfish-core/lib/led.hpp
+++ b/redfish-core/lib/led.hpp
@@ -30,7 +30,7 @@ namespace redfish
*
* @return None.
*/
-void getIndicatorLedState(std::shared_ptr<AsyncResp> aResp)
+inline void getIndicatorLedState(std::shared_ptr<AsyncResp> aResp)
{
BMCWEB_LOG_DEBUG << "Get led groups";
crow::connections::systemBus->async_method_call(
@@ -55,11 +55,11 @@ void getIndicatorLedState(std::shared_ptr<AsyncResp> aResp)
}
}
crow::connections::systemBus->async_method_call(
- [aResp](const boost::system::error_code ec,
- const std::variant<bool> asserted) {
- if (!ec)
+ [aResp](const boost::system::error_code ec2,
+ const std::variant<bool> asserted2) {
+ if (!ec2)
{
- const bool* ledOn = std::get_if<bool>(&asserted);
+ const bool* ledOn = std::get_if<bool>(&asserted2);
if (!ledOn)
{
BMCWEB_LOG_DEBUG
@@ -98,8 +98,8 @@ void getIndicatorLedState(std::shared_ptr<AsyncResp> aResp)
*
* @return None.
*/
-void setIndicatorLedState(std::shared_ptr<AsyncResp> aResp,
- const std::string& ledState)
+inline void setIndicatorLedState(std::shared_ptr<AsyncResp> aResp,
+ const std::string& ledState)
{
BMCWEB_LOG_DEBUG << "Set led groups";
bool ledOn = false;
@@ -133,11 +133,11 @@ void setIndicatorLedState(std::shared_ptr<AsyncResp> aResp,
}
}
crow::connections::systemBus->async_method_call(
- [aResp](const boost::system::error_code ec,
- const std::variant<bool> asserted) {
- if (ec)
+ [aResp](const boost::system::error_code ec2,
+ const std::variant<bool> asserted2) {
+ if (ec2)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
messages::internalError(aResp->res);
return;
}
@@ -154,4 +154,4 @@ void setIndicatorLedState(std::shared_ptr<AsyncResp> aResp,
"xyz.openbmc_project.Led.Group", "Asserted",
std::variant<bool>(ledBlinkng));
}
-} // namespace redfish \ No newline at end of file
+} // namespace redfish
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index a884290ff0..a4a873a28e 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -989,13 +989,13 @@ class SystemLogServiceCollection : public Node
{
if (pathStr.find("PostCode") != std::string::npos)
{
- nlohmann::json& logServiceArray =
+ nlohmann::json& logServiceArrayLocal =
asyncResp->res.jsonValue["Members"];
- logServiceArray.push_back(
+ logServiceArrayLocal.push_back(
{{"@odata.id", "/redfish/v1/Systems/system/"
"LogServices/PostCodes"}});
asyncResp->res.jsonValue["Members@odata.count"] =
- logServiceArray.size();
+ logServiceArrayLocal.size();
return;
}
}
@@ -1152,7 +1152,7 @@ static int fillEventLogEntryJson(const std::string& logEntryID,
messageArgsSize = logEntryFields.size() - 1;
}
- messageArgs = boost::beast::span(&messageArgsStart, messageArgsSize);
+ messageArgs = {&messageArgsStart, messageArgsSize};
// Fill the MessageArgs into the Message
int i = 0;
@@ -3476,8 +3476,8 @@ class PostCodesEntry : public Node
codeIndexStr.remove_prefix(dashPos + 1);
bootIndex = static_cast<uint16_t>(
- strtoul(std::string(bootIndexStr).c_str(), NULL, 0));
- codeIndex = strtoul(std::string(codeIndexStr).c_str(), NULL, 0);
+ strtoul(std::string(bootIndexStr).c_str(), nullptr, 0));
+ codeIndex = strtoul(std::string(codeIndexStr).c_str(), nullptr, 0);
if (bootIndex == 0 || codeIndex == 0)
{
BMCWEB_LOG_DEBUG << "Get Post Code invalid entry string "
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 552c264d0b..a113ba169f 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -38,7 +38,7 @@ namespace redfish
*
* @param[in] asyncResp - Shared pointer for completing asynchronous calls
*/
-void doBMCGracefulRestart(std::shared_ptr<AsyncResp> asyncResp)
+inline void doBMCGracefulRestart(std::shared_ptr<AsyncResp> asyncResp)
{
const char* processName = "xyz.openbmc_project.State.BMC";
const char* objectPath = "/xyz/openbmc_project/state/bmc0";
@@ -238,7 +238,7 @@ static constexpr const char* stepwiseConfigurationIface =
static constexpr const char* thermalModeIface =
"xyz.openbmc_project.Control.ThermalMode";
-static void asyncPopulatePid(const std::string& connection,
+inline void asyncPopulatePid(const std::string& connection,
const std::string& path,
const std::string& currentProfile,
const std::vector<std::string>& supportedProfiles,
@@ -655,7 +655,7 @@ enum class CreatePIDRet
patch
};
-static bool getZonesFromJsonReq(const std::shared_ptr<AsyncResp>& response,
+inline bool getZonesFromJsonReq(const std::shared_ptr<AsyncResp>& response,
std::vector<nlohmann::json>& config,
std::vector<std::string>& zones)
{
@@ -693,7 +693,7 @@ static bool getZonesFromJsonReq(const std::shared_ptr<AsyncResp>& response,
return true;
}
-static const dbus::utility::ManagedItem*
+inline const dbus::utility::ManagedItem*
findChassis(const dbus::utility::ManagedObjectType& managedObj,
const std::string& value, std::string& chassis)
{
@@ -725,7 +725,7 @@ static const dbus::utility::ManagedItem*
return nullptr;
}
-static CreatePIDRet createPidInterface(
+inline CreatePIDRet createPidInterface(
const std::shared_ptr<AsyncResp>& response, const std::string& type,
nlohmann::json::iterator it, const std::string& path,
const dbus::utility::ManagedObjectType& managedObj, bool createNewObject,
@@ -1052,10 +1052,10 @@ static CreatePIDRet createPidInterface(
for (auto& step : *steps)
{
double target;
- double output;
+ double out;
if (!redfish::json_util::readJson(step, response->res, "Target",
- target, "Output", output))
+ target, "Output", out))
{
BMCWEB_LOG_ERROR << "Line:" << __LINE__
<< ", Illegal Property "
@@ -1063,7 +1063,7 @@ static CreatePIDRet createPidInterface(
return CreatePIDRet::fail;
}
readings.emplace_back(target);
- outputs.emplace_back(output);
+ outputs.emplace_back(out);
}
output["Reading"] = std::move(readings);
output["Output"] = std::move(outputs);
@@ -1109,8 +1109,8 @@ static CreatePIDRet createPidInterface(
struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
{
- GetPIDValues(const std::shared_ptr<AsyncResp>& asyncResp) :
- asyncResp(asyncResp)
+ GetPIDValues(const std::shared_ptr<AsyncResp>& asyncRespIn) :
+ asyncResp(asyncRespIn)
{}
@@ -1121,14 +1121,14 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
// get all configurations
crow::connections::systemBus->async_method_call(
[self](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtree) {
+ const crow::openbmc_mapper::GetSubTreeType& subtreeLocal) {
if (ec)
{
BMCWEB_LOG_ERROR << ec;
messages::internalError(self->asyncResp->res);
return;
}
- self->subtree = subtree;
+ self->subtree = subtreeLocal;
},
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
@@ -1140,12 +1140,12 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
// at the same time get the selected profile
crow::connections::systemBus->async_method_call(
[self](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtree) {
- if (ec || subtree.empty())
+ const crow::openbmc_mapper::GetSubTreeType& subtreeLocal) {
+ if (ec || subtreeLocal.empty())
{
return;
}
- if (subtree[0].second.size() != 1)
+ if (subtreeLocal[0].second.size() != 1)
{
// invalid mapper response, should never happen
BMCWEB_LOG_ERROR << "GetPIDValues: Mapper Error";
@@ -1153,15 +1153,15 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
return;
}
- const std::string& path = subtree[0].first;
- const std::string& owner = subtree[0].second[0].first;
+ const std::string& path = subtreeLocal[0].first;
+ const std::string& owner = subtreeLocal[0].second[0].first;
crow::connections::systemBus->async_method_call(
[path, owner, self](
- const boost::system::error_code ec,
+ const boost::system::error_code ec2,
const boost::container::flat_map<
std::string, std::variant<std::vector<std::string>,
std::string>>& resp) {
- if (ec)
+ if (ec2)
{
BMCWEB_LOG_ERROR << "GetPIDValues: Can't get "
"thermalModeIface "
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 3e48efb113..4d612fc037 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -452,9 +452,8 @@ class NetworkProtocol : public Node
netipmidBasePath))
{
crow::connections::systemBus->async_method_call(
- [ipmiProtocolEnabled,
- asyncResp](const boost::system::error_code ec) {
- if (ec)
+ [asyncResp](const boost::system::error_code ec2) {
+ if (ec2)
{
messages::internalError(asyncResp->res);
return;
@@ -466,9 +465,8 @@ class NetworkProtocol : public Node
"Running", std::variant<bool>{ipmiProtocolEnabled});
crow::connections::systemBus->async_method_call(
- [ipmiProtocolEnabled,
- asyncResp](const boost::system::error_code ec) {
- if (ec)
+ [asyncResp](const boost::system::error_code ec2) {
+ if (ec2)
{
messages::internalError(asyncResp->res);
return;
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index 544c42b7cf..031657ae59 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -114,11 +114,11 @@ class Power : public Node
}
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec) {
- if (ec)
+ [asyncResp](const boost::system::error_code ec2) {
+ if (ec2)
{
BMCWEB_LOG_DEBUG
- << "Power Limit Set: Dbus error: " << ec;
+ << "Power Limit Set: Dbus error: " << ec2;
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 99a03c9bf6..d1895c45fb 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -320,7 +320,7 @@ void getConnections(
* allSensors list. Eliminate Thermal sensors when a Power request is
* made, and eliminate Power sensors when a Thermal request is made.
*/
-void reduceSensorList(
+inline void reduceSensorList(
std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp,
const std::vector<std::string>* allSensors,
std::shared_ptr<boost::container::flat_set<std::string>> activeSensors)
@@ -623,7 +623,7 @@ void getObjectManagerPaths(std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp,
* @param inventoryItem D-Bus inventory item associated with a sensor.
* @return State value for inventory item.
*/
-static std::string getState(const InventoryItem* inventoryItem)
+inline std::string getState(const InventoryItem* inventoryItem)
{
if ((inventoryItem != nullptr) && !(inventoryItem->isPresent))
{
@@ -641,7 +641,7 @@ static std::string getState(const InventoryItem* inventoryItem)
* be nullptr if no associated inventory item was found.
* @return Health value for sensor.
*/
-static std::string getHealth(
+inline std::string getHealth(
nlohmann::json& sensorJson,
const boost::container::flat_map<
std::string, boost::container::flat_map<std::string, SensorVariant>>&
@@ -759,7 +759,7 @@ static std::string getHealth(
return "OK";
}
-static void setLedState(nlohmann::json& sensorJson,
+inline void setLedState(nlohmann::json& sensorJson,
const InventoryItem* inventoryItem)
{
if (inventoryItem != nullptr && !inventoryItem->ledObjectPath.empty())
@@ -775,7 +775,7 @@ static void setLedState(nlohmann::json& sensorJson,
case LedState::BLINK:
sensorJson["IndicatorLED"] = "Blinking";
break;
- default:
+ case LedState::UNKNOWN:
break;
}
}
@@ -793,7 +793,7 @@ static void setLedState(nlohmann::json& sensorJson,
* @param inventoryItem D-Bus inventory item associated with the sensor. Will
* be nullptr if no associated inventory item was found.
*/
-void objectInterfacesToJson(
+inline void objectInterfacesToJson(
const std::string& sensorName, const std::string& sensorType,
std::shared_ptr<SensorsAsyncResp> sensorsAsyncResp,
const boost::container::flat_map<
@@ -1043,7 +1043,7 @@ void objectInterfacesToJson(
BMCWEB_LOG_DEBUG << "Added sensor " << sensorName;
}
-static void
+inline void
populateFanRedundancy(std::shared_ptr<SensorsAsyncResp> sensorsAsyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -1250,7 +1250,7 @@ static void
"xyz.openbmc_project.Control.FanRedundancy"});
}
-void sortJSONResponse(std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp)
+inline void sortJSONResponse(std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp)
{
nlohmann::json& response = SensorsAsyncResp->res.jsonValue;
std::array<std::string, 2> sensorHeaders{"Temperatures", "Fans"};
@@ -1295,7 +1295,7 @@ void sortJSONResponse(std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp)
* @param invItemObjPath D-Bus object path of inventory item.
* @return Inventory item within vector, or nullptr if no match found.
*/
-static InventoryItem* findInventoryItem(
+inline InventoryItem* findInventoryItem(
std::shared_ptr<std::vector<InventoryItem>> inventoryItems,
const std::string& invItemObjPath)
{
@@ -1315,7 +1315,7 @@ static InventoryItem* findInventoryItem(
* @param sensorObjPath D-Bus object path of sensor.
* @return Inventory item within vector, or nullptr if no match found.
*/
-static InventoryItem* findInventoryItemForSensor(
+inline InventoryItem* findInventoryItemForSensor(
std::shared_ptr<std::vector<InventoryItem>> inventoryItems,
const std::string& sensorObjPath)
{
@@ -1363,7 +1363,7 @@ inline InventoryItem*
* @param invItemObjPath D-Bus object path of inventory item.
* @param sensorObjPath D-Bus object path of sensor
*/
-static void
+inline void
addInventoryItem(std::shared_ptr<std::vector<InventoryItem>> inventoryItems,
const std::string& invItemObjPath,
const std::string& sensorObjPath)
@@ -1396,7 +1396,7 @@ static void
* @param interfacesDict Map containing D-Bus interfaces and their properties
* for the specified inventory item.
*/
-static void storeInventoryItemData(
+inline void storeInventoryItemData(
InventoryItem& inventoryItem,
const boost::container::flat_map<
std::string, boost::container::flat_map<std::string, SensorVariant>>&
@@ -2348,7 +2348,7 @@ static void getInventoryItems(
* @param chassisId Chassis that contains the power supply.
* @return JSON PowerSupply object for the specified inventory item.
*/
-static nlohmann::json& getPowerSupply(nlohmann::json& powerSupplyArray,
+inline nlohmann::json& getPowerSupply(nlohmann::json& powerSupplyArray,
const InventoryItem& inventoryItem,
const std::string& chassisId)
{
@@ -2416,7 +2416,7 @@ static nlohmann::json& getPowerSupply(nlohmann::json& powerSupplyArray,
* implements ObjectManager.
* @param inventoryItems Inventory items associated with the sensors.
*/
-void getSensorData(
+inline void getSensorData(
std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp,
const std::shared_ptr<boost::container::flat_set<std::string>> sensorNames,
const boost::container::flat_set<std::string>& connections,
@@ -2596,11 +2596,11 @@ void getSensorData(
crow::connections::systemBus->async_method_call(
getManagedObjectsCb, connection, objectMgrPath,
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
- };
+ }
BMCWEB_LOG_DEBUG << "getSensorData exit";
}
-void processSensorList(
+inline void processSensorList(
std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp,
std::shared_ptr<boost::container::flat_set<std::string>> sensorNames)
{
@@ -2651,7 +2651,7 @@ void processSensorList(
* chassis.
* @param SensorsAsyncResp Pointer to object holding response data
*/
-void getChassisData(std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp)
+inline void getChassisData(std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp)
{
BMCWEB_LOG_DEBUG << "getChassisData enter";
auto getChassisCb =
@@ -2678,7 +2678,7 @@ void getChassisData(std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp)
* @param sensorsModified The list of sensors that were found as a result of
* repeated calls to this function
*/
-bool findSensorNameUsingSensorPath(
+inline bool findSensorNameUsingSensorPath(
std::string_view sensorName,
boost::container::flat_set<std::string>& sensorsList,
boost::container::flat_set<std::string>& sensorsModified)
@@ -2707,7 +2707,7 @@ bool findSensorNameUsingSensorPath(
* @param allCollections Collections extract from sensors' request patch info
* @param chassisSubNode Chassis Node for which the query has to happen
*/
-void setSensorsOverride(
+inline void setSensorsOverride(
std::shared_ptr<SensorsAsyncResp> sensorAsyncResp,
std::unordered_map<std::string, std::vector<nlohmann::json>>&
allCollections)
@@ -2832,7 +2832,7 @@ void setSensorsOverride(
getChassis(sensorAsyncResp, std::move(getChassisSensorListCb));
}
-bool isOverridingAllowed(const std::string& manufacturingModeStatus)
+inline bool isOverridingAllowed(const std::string& manufacturingModeStatus)
{
if (manufacturingModeStatus ==
"xyz.openbmc_project.Control.Security.SpecialMode.Modes.Manufacturing")
@@ -2860,7 +2860,7 @@ bool isOverridingAllowed(const std::string& manufacturingModeStatus)
* @param allCollections Collections extract from sensors' request patch info
* @param chassisSubNode Chassis Node for which the query has to happen
*/
-void checkAndDoSensorsOverride(
+inline void checkAndDoSensorsOverride(
std::shared_ptr<SensorsAsyncResp> sensorAsyncResp,
std::unordered_map<std::string, std::vector<nlohmann::json>>&
allCollections)
@@ -2872,13 +2872,13 @@ void checkAndDoSensorsOverride(
"xyz.openbmc_project.Security.SpecialMode"};
crow::connections::systemBus->async_method_call(
- [sensorAsyncResp, allCollections](const boost::system::error_code ec,
+ [sensorAsyncResp, allCollections](const boost::system::error_code ec2,
const GetSubTreeType& resp) mutable {
- if (ec)
+ if (ec2)
{
BMCWEB_LOG_DEBUG
<< "Error in querying GetSubTree with Object Mapper. "
- << ec;
+ << ec2;
messages::internalError(sensorAsyncResp->res);
return;
}
@@ -2972,8 +2972,9 @@ void checkAndDoSensorsOverride(
* @param node Node (group) of sensors. See sensors::node for supported values
* @param mapComplete Callback to be called with retrieval result
*/
-void retrieveUriToDbusMap(const std::string& chassis, const std::string& node,
- SensorsAsyncResp::DataCompleteCb&& mapComplete)
+inline void retrieveUriToDbusMap(const std::string& chassis,
+ const std::string& node,
+ SensorsAsyncResp::DataCompleteCb&& mapComplete)
{
auto typesIt = sensors::dbus::types.find(node);
if (typesIt == sensors::dbus::types.end())
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 0114c4e167..9b1e2d7e33 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -176,11 +176,11 @@ class Storage : public Node
storageController["Status"]["State"] = "Enabled";
crow::connections::systemBus->async_method_call(
- [asyncResp, index](const boost::system::error_code ec,
+ [asyncResp, index](const boost::system::error_code ec2,
const std::variant<bool> present) {
// this interface isn't necessary, only check it if
// we get a good return
- if (ec)
+ if (ec2)
{
return;
}
@@ -203,12 +203,12 @@ class Storage : public Node
crow::connections::systemBus->async_method_call(
[asyncResp,
- index](const boost::system::error_code ec,
+ index](const boost::system::error_code ec2,
const std::vector<std::pair<
std::string,
std::variant<bool, std::string, uint64_t>>>&
propertiesList) {
- if (ec)
+ if (ec2)
{
// this interface isn't necessary
return;
@@ -311,23 +311,23 @@ class Drive : public Node
return;
}
- auto object = std::find_if(
+ auto object2 = std::find_if(
subtree.begin(), subtree.end(), [&driveId](auto& object) {
const std::string& path = object.first;
return boost::ends_with(path, "/" + driveId);
});
- if (object == subtree.end())
+ if (object2 == subtree.end())
{
messages::resourceNotFound(asyncResp->res, "Drive",
driveId);
return;
}
- const std::string& path = object->first;
+ const std::string& path = object2->first;
const std::vector<
std::pair<std::string, std::vector<std::string>>>&
- connectionNames = object->second;
+ connectionNames = object2->second;
asyncResp->res.jsonValue["@odata.type"] = "#Drive.v1_7_0.Drive";
asyncResp->res.jsonValue["@odata.id"] =
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 9ca95d5405..c4bc3d4863 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -38,8 +38,8 @@ namespace redfish
*
* @return None.
*/
-void updateDimmProperties(std::shared_ptr<AsyncResp> aResp,
- const std::variant<bool>& dimmState)
+inline void updateDimmProperties(std::shared_ptr<AsyncResp> aResp,
+ const std::variant<bool>& dimmState)
{
const bool* isDimmFunctional = std::get_if<bool>(&dimmState);
if (isDimmFunctional == nullptr)
@@ -72,8 +72,8 @@ void updateDimmProperties(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-void modifyCpuPresenceState(std::shared_ptr<AsyncResp> aResp,
- const std::variant<bool>& cpuPresenceState)
+inline void modifyCpuPresenceState(std::shared_ptr<AsyncResp> aResp,
+ const std::variant<bool>& cpuPresenceState)
{
const bool* isCpuPresent = std::get_if<bool>(&cpuPresenceState);
@@ -107,8 +107,9 @@ void modifyCpuPresenceState(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-void modifyCpuFunctionalState(std::shared_ptr<AsyncResp> aResp,
- const std::variant<bool>& cpuFunctionalState)
+inline void
+ modifyCpuFunctionalState(std::shared_ptr<AsyncResp> aResp,
+ const std::variant<bool>& cpuFunctionalState)
{
const bool* isCpuFunctional = std::get_if<bool>(&cpuFunctionalState);
@@ -143,8 +144,8 @@ void modifyCpuFunctionalState(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-void getComputerSystem(std::shared_ptr<AsyncResp> aResp,
- std::shared_ptr<HealthPopulate> systemHealth)
+inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp,
+ std::shared_ptr<HealthPopulate> systemHealth)
{
BMCWEB_LOG_DEBUG << "Get available system components.";
@@ -590,7 +591,7 @@ void getComputerSystem(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-void getHostState(std::shared_ptr<AsyncResp> aResp)
+inline void getHostState(std::shared_ptr<AsyncResp> aResp)
{
BMCWEB_LOG_DEBUG << "Get host information.";
crow::connections::systemBus->async_method_call(
@@ -645,7 +646,7 @@ void getHostState(std::shared_ptr<AsyncResp> aResp)
* @return Returns as a string, the boot source in Redfish terms. If translation
* cannot be done, returns an empty string.
*/
-static std::string dbusToRfBootSource(const std::string& dbusSource)
+inline std::string dbusToRfBootSource(const std::string& dbusSource)
{
if (dbusSource == "xyz.openbmc_project.Control.Boot.Source.Sources.Default")
{
@@ -685,7 +686,7 @@ static std::string dbusToRfBootSource(const std::string& dbusSource)
* @return Returns as a string, the boot mode in Redfish terms. If translation
* cannot be done, returns an empty string.
*/
-static std::string dbusToRfBootMode(const std::string& dbusMode)
+inline std::string dbusToRfBootMode(const std::string& dbusMode)
{
if (dbusMode == "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular")
{
@@ -714,7 +715,7 @@ static std::string dbusToRfBootMode(const std::string& dbusMode)
*
* @return Integer error code.
*/
-static int assignBootParameters(std::shared_ptr<AsyncResp> aResp,
+inline int assignBootParameters(std::shared_ptr<AsyncResp> aResp,
const std::string& rfSource,
std::string& bootSource, std::string& bootMode)
{
@@ -774,7 +775,7 @@ static int assignBootParameters(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-static void getBootMode(std::shared_ptr<AsyncResp> aResp,
+inline void getBootMode(std::shared_ptr<AsyncResp> aResp,
std::string bootDbusObj)
{
crow::connections::systemBus->async_method_call(
@@ -838,7 +839,7 @@ static void getBootMode(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-static void getBootSource(std::shared_ptr<AsyncResp> aResp, bool oneTimeEnabled)
+inline void getBootSource(std::shared_ptr<AsyncResp> aResp, bool oneTimeEnabled)
{
std::string bootDbusObj =
oneTimeEnabled ? "/xyz/openbmc_project/control/host0/boot/one_time"
@@ -889,7 +890,7 @@ static void getBootSource(std::shared_ptr<AsyncResp> aResp, bool oneTimeEnabled)
*
* @return None.
*/
-static void getBootProperties(std::shared_ptr<AsyncResp> aResp)
+inline void getBootProperties(std::shared_ptr<AsyncResp> aResp)
{
BMCWEB_LOG_DEBUG << "Get boot information.";
@@ -930,7 +931,7 @@ static void getBootProperties(std::shared_ptr<AsyncResp> aResp)
*
* @return None.
*/
-void getLastResetTime(std::shared_ptr<AsyncResp> aResp)
+inline void getLastResetTime(std::shared_ptr<AsyncResp> aResp)
{
BMCWEB_LOG_DEBUG << "Getting System Last Reset Time";
@@ -973,7 +974,7 @@ void getLastResetTime(std::shared_ptr<AsyncResp> aResp)
*
* @return None.
*/
-void getAutomaticRetry(std::shared_ptr<AsyncResp> aResp)
+inline void getAutomaticRetry(std::shared_ptr<AsyncResp> aResp)
{
BMCWEB_LOG_DEBUG << "Get Automatic Retry policy";
@@ -1064,7 +1065,7 @@ void getAutomaticRetry(std::shared_ptr<AsyncResp> aResp)
*
* @return None.
*/
-void getPowerRestorePolicy(std::shared_ptr<AsyncResp> aResp)
+inline void getPowerRestorePolicy(std::shared_ptr<AsyncResp> aResp)
{
BMCWEB_LOG_DEBUG << "Get power restore policy";
@@ -1123,7 +1124,7 @@ void getPowerRestorePolicy(std::shared_ptr<AsyncResp> aResp)
*
* @return Integer error code.
*/
-static void setBootModeOrSource(std::shared_ptr<AsyncResp> aResp,
+inline void setBootModeOrSource(std::shared_ptr<AsyncResp> aResp,
bool oneTimeEnabled,
std::optional<std::string> bootSource,
std::optional<std::string> bootEnable)
@@ -1244,7 +1245,7 @@ static void setBootModeOrSource(std::shared_ptr<AsyncResp> aResp,
*
* @return Integer error code.
*/
-static void setBootSourceProperties(std::shared_ptr<AsyncResp> aResp,
+inline void setBootSourceProperties(std::shared_ptr<AsyncResp> aResp,
std::optional<std::string> bootSource,
std::optional<std::string> bootEnable)
{
@@ -1288,7 +1289,7 @@ static void setBootSourceProperties(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-static void setAutomaticRetry(std::shared_ptr<AsyncResp> aResp,
+inline void setAutomaticRetry(std::shared_ptr<AsyncResp> aResp,
const std::string&& automaticRetryConfig)
{
BMCWEB_LOG_DEBUG << "Set Automatic Retry.";
@@ -1337,7 +1338,7 @@ static void setAutomaticRetry(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-static void setPowerRestorePolicy(std::shared_ptr<AsyncResp> aResp,
+inline void setPowerRestorePolicy(std::shared_ptr<AsyncResp> aResp,
std::optional<std::string> policy)
{
BMCWEB_LOG_DEBUG << "Set power restore policy.";
@@ -1384,7 +1385,7 @@ static void setPowerRestorePolicy(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-void getProvisioningStatus(std::shared_ptr<AsyncResp> aResp)
+inline void getProvisioningStatus(std::shared_ptr<AsyncResp> aResp)
{
BMCWEB_LOG_DEBUG << "Get OEM information.";
crow::connections::systemBus->async_method_call(
@@ -1453,7 +1454,7 @@ void getProvisioningStatus(std::shared_ptr<AsyncResp> aResp)
* @return Returns as a string, the timeout action in Redfish terms. If
* translation cannot be done, returns an empty string.
*/
-static std::string dbusToRfWatchdogAction(const std::string& dbusAction)
+inline std::string dbusToRfWatchdogAction(const std::string& dbusAction)
{
if (dbusAction == "xyz.openbmc_project.State.Watchdog.Action.None")
{
@@ -1486,7 +1487,7 @@ static std::string dbusToRfWatchdogAction(const std::string& dbusAction)
*If translation cannot be done, returns an empty string.
*/
-static std::string rfToDbusWDTTimeOutAct(const std::string& rfAction)
+inline std::string rfToDbusWDTTimeOutAct(const std::string& rfAction)
{
if (rfAction == "None")
{
@@ -1515,7 +1516,7 @@ static std::string rfToDbusWDTTimeOutAct(const std::string& rfAction)
*
* @return None.
*/
-void getHostWatchdogTimer(std::shared_ptr<AsyncResp> aResp)
+inline void getHostWatchdogTimer(std::shared_ptr<AsyncResp> aResp)
{
BMCWEB_LOG_DEBUG << "Get host watchodg";
crow::connections::systemBus->async_method_call(
@@ -1586,7 +1587,7 @@ void getHostWatchdogTimer(std::shared_ptr<AsyncResp> aResp)
*
* @return None.
*/
-static void setWDTProperties(std::shared_ptr<AsyncResp> aResp,
+inline void setWDTProperties(std::shared_ptr<AsyncResp> aResp,
const std::optional<bool> wdtEnable,
const std::optional<std::string>& wdtTimeOutAction)
{
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index 1b9077dec0..d6c479f069 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -93,9 +93,9 @@ struct TaskData : std::enable_shared_from_this<TaskData>
TaskData(std::function<bool(boost::system::error_code,
sdbusplus::message::message&,
const std::shared_ptr<TaskData>&)>&& handler,
- const std::string& match, size_t idx) :
+ const std::string& matchIn, size_t idx) :
callback(std::move(handler)),
- matchStr(match), index(idx),
+ matchStr(matchIn), index(idx),
startTime(std::chrono::system_clock::to_time_t(
std::chrono::system_clock::now())),
status("OK"), state("Running"), messages(nlohmann::json::array()),
@@ -118,8 +118,8 @@ struct TaskData : std::enable_shared_from_this<TaskData>
std::function<bool(boost::system::error_code,
sdbusplus::message::message&,
const std::shared_ptr<TaskData>&)>&& handler,
- const std::string& match, size_t idx) :
- TaskData(std::move(handler), match, idx)
+ const std::string& match2, size_t idx) :
+ TaskData(std::move(handler), match2, idx)
{}
};
diff --git a/redfish-core/ut/privileges_test.cpp b/redfish-core/ut/privileges_test.cpp
index d857290250..1613fbb8cf 100644
--- a/redfish-core/ut/privileges_test.cpp
+++ b/redfish-core/ut/privileges_test.cpp
@@ -13,9 +13,7 @@ TEST(PrivilegeTest, PrivilegeConstructor)
Privileges privileges{"Login", "ConfigureManager"};
EXPECT_THAT(privileges.getActivePrivilegeNames(PrivilegeType::BASE),
- ::testing::UnorderedElementsAre(
- ::testing::Pointee(&"Login"[0]),
- ::testing::Pointee(&"ConfigureManager"[0])));
+ ::testing::UnorderedElementsAre("Login", "ConfigureManager"));
}
TEST(PrivilegeTest, PrivilegeCheckForNoPrivilegesRequired)
@@ -119,9 +117,7 @@ TEST(PrivilegeTest, GetActivePrivilegeNames)
EXPECT_THAT(privileges.getActivePrivilegeNames(PrivilegeType::BASE),
::testing::UnorderedElementsAre(
- ::testing::Pointee(expectedPrivileges[0]),
- ::testing::Pointee(expectedPrivileges[1]),
- ::testing::Pointee(expectedPrivileges[2]),
- ::testing::Pointee(expectedPrivileges[3]),
- ::testing::Pointee(expectedPrivileges[4])));
+ expectedPrivileges[0], expectedPrivileges[1],
+ expectedPrivileges[2], expectedPrivileges[3],
+ expectedPrivileges[4]));
}