Fix IBM management console to match coding standard
Lots of missing inline definitions, a case where a RVO move is not
guaranteed when returning a variant, and removing the header checks,
which means that these types of build errors wont happen in the future.
Tested:
Should be no impact, but could someone from the IBM team grab these
changes and sanity check them?
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: Iea0a06b8e744542a7d08e38217718e7a969f2827
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index cb9191f..162abee 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -303,7 +303,7 @@
// we may have found at least one entry with the given session id
// return the json list of lock records pertaining to the given
// session id, or send an empty list if lock table is empty
- return lockList;
+ return {lockList};
}
inline RcReleaseLockApi Lock::releaseLock(const ListOfTransactionIds& p,
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 61a4b84..e789bda 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -39,7 +39,7 @@
constexpr size_t maxBroadcastMsgSize =
1000; // Allow Broadcast message size upto 1KB
-bool createSaveAreaPath(crow::Response& res)
+inline bool createSaveAreaPath(crow::Response& res)
{
// The path /var/lib/obmc will be created by initrdscripts
// Create the directories for the save-area files, when we get
@@ -76,8 +76,9 @@
}
return true;
}
-void handleFilePut(const crow::Request& req, crow::Response& res,
- const std::string& fileID)
+
+inline void handleFilePut(const crow::Request& req, crow::Response& res,
+ const std::string& fileID)
{
// Check the content-type of the request
std::string_view contentType = req.getHeaderValue("content-type");
@@ -156,7 +157,7 @@
}
}
-void handleConfigFileList(crow::Response& res)
+inline void handleConfigFileList(crow::Response& res)
{
std::vector<std::string> pathObjList;
std::filesystem::path loc("/var/lib/obmc/bmc-console-mgmt/save-area");
@@ -181,7 +182,7 @@
res.end();
}
-void deleteConfigFiles(crow::Response& res)
+inline void deleteConfigFiles(crow::Response& res)
{
std::vector<std::string> pathObjList;
std::error_code ec;
@@ -201,7 +202,7 @@
res.end();
}
-void getLockServiceData(crow::Response& res)
+inline void getLockServiceData(crow::Response& res)
{
res.jsonValue["@odata.type"] = "#LockService.v1_0_0.LockService";
res.jsonValue["@odata.id"] = "/ibm/v1/HMC/LockService/";
@@ -217,7 +218,7 @@
res.end();
}
-void handleFileGet(crow::Response& res, const std::string& fileID)
+inline void handleFileGet(crow::Response& res, const std::string& fileID)
{
BMCWEB_LOG_DEBUG << "HandleGet on SaveArea files on path: " << fileID;
std::filesystem::path loc("/var/lib/obmc/bmc-console-mgmt/save-area/" +
@@ -249,7 +250,7 @@
return;
}
-void handleFileDelete(crow::Response& res, const std::string& fileID)
+inline void handleFileDelete(crow::Response& res, const std::string& fileID)
{
std::string filePath("/var/lib/obmc/bmc-console-mgmt/save-area/" + fileID);
BMCWEB_LOG_DEBUG << "Removing the file : " << filePath << "\n";
@@ -321,8 +322,8 @@
}
}
-void handleAcquireLockAPI(const crow::Request& req, crow::Response& res,
- std::vector<nlohmann::json> body)
+inline void handleAcquireLockAPI(const crow::Request& req, crow::Response& res,
+ std::vector<nlohmann::json> body)
{
LockRequests lockRequestStructure;
for (auto& element : body)
@@ -457,7 +458,7 @@
}
}
}
-void handleRelaseAllAPI(const crow::Request& req, crow::Response& res)
+inline void handleRelaseAllAPI(const crow::Request& req, crow::Response& res)
{
crow::ibm_mc_lock::Lock::getInstance().releaseLock(req.session->uniqueId);
res.result(boost::beast::http::status::ok);
@@ -465,8 +466,9 @@
return;
}
-void handleReleaseLockAPI(const crow::Request& req, crow::Response& res,
- const std::vector<uint32_t>& listTransactionIds)
+inline void
+ handleReleaseLockAPI(const crow::Request& req, crow::Response& res,
+ const std::vector<uint32_t>& listTransactionIds)
{
BMCWEB_LOG_DEBUG << listTransactionIds.size();
BMCWEB_LOG_DEBUG << "Data is present";
@@ -531,8 +533,8 @@
}
}
-void handleGetLockListAPI(crow::Response& res,
- const ListOfSessionIds& listSessionIds)
+inline void handleGetLockListAPI(crow::Response& res,
+ const ListOfSessionIds& listSessionIds)
{
BMCWEB_LOG_DEBUG << listSessionIds.size();
@@ -573,7 +575,7 @@
res.end();
}
-void requestRoutes(App& app)
+inline void requestRoutes(App& app)
{
// allowed only for admin