diff options
Diffstat (limited to 'redfish-core/include')
-rw-r--r-- | redfish-core/include/error_messages.hpp | 4 | ||||
-rw-r--r-- | redfish-core/include/event_service_manager.hpp | 10 | ||||
-rw-r--r-- | redfish-core/include/node.hpp | 10 | ||||
-rw-r--r-- | redfish-core/include/privileges.hpp | 8 | ||||
-rw-r--r-- | redfish-core/include/utils/fw_utils.hpp | 41 | ||||
-rw-r--r-- | redfish-core/include/utils/json_utils.hpp | 36 |
6 files changed, 55 insertions, 54 deletions
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp index 6e280c04c6..ca921e95dd 100644 --- a/redfish-core/include/error_messages.hpp +++ b/redfish-core/include/error_messages.hpp @@ -22,10 +22,10 @@ * ids can be retrieved from Base.__ver__.json file. ***************************************************************/ #pragma once -#include <nlohmann/json.hpp> - #include "http_response.h" +#include <nlohmann/json.hpp> + namespace redfish { diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp index 569c307977..fb0cfbc518 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -18,13 +18,14 @@ #include <boost/asio/io_context.hpp> #include <boost/container/flat_map.hpp> +#include <error_messages.hpp> +#include <http_client.hpp> +#include <utils/json_utils.hpp> + #include <cstdlib> #include <ctime> -#include <error_messages.hpp> #include <fstream> -#include <http_client.hpp> #include <memory> -#include <utils/json_utils.hpp> #include <variant> namespace redfish @@ -69,8 +70,7 @@ class Subscription crow::connections::systemBus->get_io_context(), host, port, path); } ~Subscription() - { - } + {} void sendEvent(const std::string& msg) { diff --git a/redfish-core/include/node.hpp b/redfish-core/include/node.hpp index a6e1e27ed9..c2c10d5d1d 100644 --- a/redfish-core/include/node.hpp +++ b/redfish-core/include/node.hpp @@ -15,15 +15,16 @@ */ #pragma once +#include "http_request.h" +#include "http_response.h" + #include "privileges.hpp" #include "token_authorization_middleware.hpp" #include "webserver_common.hpp" #include <error_messages.hpp> -#include <vector> -#include "http_request.h" -#include "http_response.h" +#include <vector> namespace redfish { @@ -36,8 +37,7 @@ class AsyncResp { public: AsyncResp(crow::Response& response) : res(response) - { - } + {} ~AsyncResp() { diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp index 35f619b77a..0282f35ea3 100644 --- a/redfish-core/include/privileges.hpp +++ b/redfish-core/include/privileges.hpp @@ -17,10 +17,11 @@ #include <logging.h> -#include <array> -#include <bitset> #include <boost/beast/http/verb.hpp> #include <boost/container/flat_map.hpp> + +#include <array> +#include <bitset> #include <cstdint> #include <vector> @@ -211,8 +212,7 @@ class Privileges private: Privileges(const std::bitset<maxPrivilegeCount>& p) : privilegeBitset{p} - { - } + {} std::bitset<maxPrivilegeCount> privilegeBitset = 0; }; diff --git a/redfish-core/include/utils/fw_utils.hpp b/redfish-core/include/utils/fw_utils.hpp index 653b0675c4..0fd02c75ad 100644 --- a/redfish-core/include/utils/fw_utils.hpp +++ b/redfish-core/include/utils/fw_utils.hpp @@ -1,5 +1,6 @@ #pragma once #include <async_resp.hpp> + #include <string> namespace redfish @@ -7,11 +8,11 @@ namespace redfish namespace fw_util { /* @brief String that indicates a bios firmware instance */ -constexpr const char *biosPurpose = +constexpr const char* biosPurpose = "xyz.openbmc_project.Software.Version.VersionPurpose.Host"; /* @brief String that indicates a BMC firmware instance */ -constexpr const char *bmcPurpose = +constexpr const char* bmcPurpose = "xyz.openbmc_project.Software.Version.VersionPurpose.BMC"; /** @@ -24,14 +25,14 @@ constexpr const char *bmcPurpose = * @return void */ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp, - const std::string &fwVersionPurpose, - const std::string &jsonIdxStr) + const std::string& fwVersionPurpose, + const std::string& jsonIdxStr) { // Get active FW images crow::connections::systemBus->async_method_call( [aResp, fwVersionPurpose, jsonIdxStr](const boost::system::error_code ec, - const std::variant<std::vector<std::string>> &resp) { + const std::variant<std::vector<std::string>>& resp) { if (ec) { BMCWEB_LOG_ERROR << "error_code = " << ec; @@ -39,7 +40,7 @@ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp, messages::internalError(aResp->res); return; } - const std::vector<std::string> *functionalFw = + const std::vector<std::string>* functionalFw = std::get_if<std::vector<std::string>>(&resp); if ((functionalFw == nullptr) || (functionalFw->size() == 0)) { @@ -50,7 +51,7 @@ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp, // example functionalFw: // v as 2 "/xyz/openbmc_project/software/ace821ef" // "/xyz/openbmc_project/software/230fb078" - for (auto &fw : *functionalFw) + for (auto& fw : *functionalFw) { // if can't parse fw id then return std::string::size_type idPos = fw.rfind("/"); @@ -74,7 +75,7 @@ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp, [aResp, fw, swId, fwVersionPurpose, jsonIdxStr]( const boost::system::error_code ec, const std::vector<std::pair< - std::string, std::vector<std::string>>> &objInfo) { + std::string, std::vector<std::string>>>& objInfo) { if (ec) { BMCWEB_LOG_DEBUG << "error_code = " << ec; @@ -109,7 +110,7 @@ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp, [aResp, swId, fwVersionPurpose, jsonIdxStr]( const boost::system::error_code ec, const boost::container::flat_map< - std::string, VariantType> &propertiesList) { + std::string, VariantType>& propertiesList) { if (ec) { BMCWEB_LOG_ERROR << "error_code = " << ec; @@ -134,7 +135,7 @@ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp, messages::internalError(aResp->res); return; } - const std::string *swInvPurpose = + const std::string* swInvPurpose = std::get_if<std::string>(&it->second); if (swInvPurpose == nullptr) { @@ -157,7 +158,7 @@ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp, messages::internalError(aResp->res); return; } - const std::string *version = + const std::string* version = std::get_if<std::string>(&it->second); if (version == nullptr) { @@ -175,7 +176,7 @@ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp, "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetObject", fw, - std::array<const char *, 1>{ + std::array<const char*, 1>{ "xyz.openbmc_project.Software.Activation"}); } }, @@ -196,7 +197,7 @@ void getActiveFwVersion(std::shared_ptr<AsyncResp> aResp, * * @return The corresponding Redfish state */ -std::string getRedfishFWState(const std::string &fwState) +std::string getRedfishFWState(const std::string& fwState) { if (fwState == "xyz.openbmc_project.Software.Activation.Activations.Active") { @@ -228,7 +229,7 @@ std::string getRedfishFWState(const std::string &fwState) * * @return The corresponding Redfish health state */ -std::string getRedfishFWHealth(const std::string &fwState) +std::string getRedfishFWHealth(const std::string& fwState) { if ((fwState == "xyz.openbmc_project.Software.Activation.Activations.Active") || @@ -260,15 +261,15 @@ std::string getRedfishFWHealth(const std::string &fwState) */ void getFwStatus(std::shared_ptr<AsyncResp> asyncResp, const std::shared_ptr<std::string> swId, - const std::string &dbusSvc) + const std::string& dbusSvc) { BMCWEB_LOG_DEBUG << "getFwStatus: swId " << *swId << " svc " << dbusSvc; crow::connections::systemBus->async_method_call( [asyncResp, swId](const boost::system::error_code error_code, - const boost::container::flat_map<std::string, VariantType> - &propertiesList) { + const boost::container::flat_map<std::string, VariantType>& + propertiesList) { if (error_code) { // not all fwtypes are updateable, this is ok @@ -283,7 +284,7 @@ void getFwStatus(std::shared_ptr<AsyncResp> asyncResp, messages::propertyMissing(asyncResp->res, "Activation"); return; } - const std::string *swInvActivation = + const std::string* swInvActivation = std::get_if<std::string>(&it->second); if (swInvActivation == nullptr) { @@ -318,7 +319,7 @@ void getFwUpdateableStatus(std::shared_ptr<AsyncResp> asyncResp, { crow::connections::systemBus->async_method_call( [asyncResp, fwId](const boost::system::error_code ec, - const std::variant<std::vector<std::string>> &resp) { + const std::variant<std::vector<std::string>>& resp) { if (ec) { BMCWEB_LOG_DEBUG << __FUNCTION__ << " error_code = " << ec @@ -327,7 +328,7 @@ void getFwUpdateableStatus(std::shared_ptr<AsyncResp> asyncResp, // so don't throw error here. return; } - const std::vector<std::string> *objPaths = + const std::vector<std::string>* objPaths = std::get_if<std::vector<std::string>>(&resp); if (objPaths) { diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp index de732ce74a..d578de4c46 100644 --- a/redfish-core/include/utils/json_utils.hpp +++ b/redfish-core/include/utils/json_utils.hpp @@ -18,10 +18,11 @@ #include <http_request.h> #include <http_response.h> -#include <bitset> #include <error_messages.hpp> #include <nlohmann/json.hpp> +#include <bitset> + namespace redfish { @@ -44,36 +45,35 @@ bool processJsonFromRequest(crow::Response& res, const crow::Request& req, namespace details { -template <typename Type> struct is_optional : std::false_type -{ -}; +template <typename Type> +struct is_optional : std::false_type +{}; template <typename Type> struct is_optional<std::optional<Type>> : std::true_type -{ -}; +{}; template <typename Type> constexpr bool is_optional_v = is_optional<Type>::value; -template <typename Type> struct is_vector : std::false_type -{ -}; +template <typename Type> +struct is_vector : std::false_type +{}; -template <typename Type> struct is_vector<std::vector<Type>> : std::true_type -{ -}; +template <typename Type> +struct is_vector<std::vector<Type>> : std::true_type +{}; -template <typename Type> constexpr bool is_vector_v = is_vector<Type>::value; +template <typename Type> +constexpr bool is_vector_v = is_vector<Type>::value; -template <typename Type> struct is_std_array : std::false_type -{ -}; +template <typename Type> +struct is_std_array : std::false_type +{}; template <typename Type, std::size_t size> struct is_std_array<std::array<Type, size>> : std::true_type -{ -}; +{}; template <typename Type> constexpr bool is_std_array_v = is_std_array<Type>::value; |