diff options
author | Ed Tanous <edtanous@google.com> | 2021-12-14 01:39:53 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2021-12-28 00:42:41 +0300 |
commit | 168e20c1306e3e689907ba43e14ea679e2328611 (patch) | |
tree | 7c578ede3cf14ffaf06ad9fbc245a97b71b21cc9 /redfish-core/include/utils/fw_utils.hpp | |
parent | b477fd4408bc0602cc86147121f03791d3f4824a (diff) | |
download | bmcweb-168e20c1306e3e689907ba43e14ea679e2328611.tar.xz |
Move to common variant
This saves approximately 34kB in the compressed binary size of bmcweb
due to reduced template instantiations. This amounts to a 2.5%
reduction in the overall size.
Note, there were a few places where we broke const-correctness in the
form of pulling a non-const reference out of a const variant. This
new variant now requires const correctness, so some consts are
added where required.
Tested: Code compiles.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I6a60c8881c1268627eedb4ffddf16689dc5f6ed2
Diffstat (limited to 'redfish-core/include/utils/fw_utils.hpp')
-rw-r--r-- | redfish-core/include/utils/fw_utils.hpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/redfish-core/include/utils/fw_utils.hpp b/redfish-core/include/utils/fw_utils.hpp index c990023b84..658ca4d6d7 100644 --- a/redfish-core/include/utils/fw_utils.hpp +++ b/redfish-core/include/utils/fw_utils.hpp @@ -1,9 +1,9 @@ #pragma once #include <async_resp.hpp> +#include <dbus_utility.hpp> #include <algorithm> #include <string> -#include <variant> #include <vector> namespace redfish @@ -39,9 +39,9 @@ inline void { // Used later to determine running (known on Redfish as active) FW images crow::connections::systemBus->async_method_call( - [aResp, fwVersionPurpose, activeVersionPropName, populateLinkToImages]( - const boost::system::error_code ec, - const std::variant<std::vector<std::string>>& resp) { + [aResp, fwVersionPurpose, activeVersionPropName, + populateLinkToImages](const boost::system::error_code ec, + const dbus::utility::DbusVariantType& resp) { BMCWEB_LOG_DEBUG << "populateFirmwareInformation enter"; if (ec) { @@ -132,8 +132,8 @@ inline void const boost::system::error_code ec3, const boost::container::flat_map< std::string, - std::variant<bool, std::string, uint64_t, - uint32_t>>& propertiesList) { + dbus::utility::DbusVariantType>& + propertiesList) { if (ec3) { BMCWEB_LOG_ERROR << "error_code = " << ec3; @@ -150,9 +150,9 @@ inline void boost::container::flat_map< std::string, - std::variant<bool, std::string, uint64_t, - uint32_t>>::const_iterator it = - propertiesList.find("Purpose"); + dbus::utility::DbusVariantType>:: + const_iterator it = + propertiesList.find("Purpose"); if (it == propertiesList.end()) { BMCWEB_LOG_ERROR @@ -331,11 +331,10 @@ inline void getFwStatus(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, BMCWEB_LOG_DEBUG << "getFwStatus: swId " << *swId << " svc " << dbusSvc; crow::connections::systemBus->async_method_call( - [asyncResp, - swId](const boost::system::error_code errorCode, - const boost::container::flat_map< - std::string, std::variant<bool, std::string, uint64_t, - uint32_t>>& propertiesList) { + [asyncResp, swId]( + const boost::system::error_code errorCode, + const boost::container::flat_map< + std::string, dbus::utility::DbusVariantType>& propertiesList) { if (errorCode) { // not all fwtypes are updateable, this is ok @@ -343,9 +342,8 @@ inline void getFwStatus(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, return; } boost::container::flat_map< - std::string, std::variant<bool, std::string, uint64_t, - uint32_t>>::const_iterator it = - propertiesList.find("Activation"); + std::string, dbus::utility::DbusVariantType>::const_iterator + it = propertiesList.find("Activation"); if (it == propertiesList.end()) { BMCWEB_LOG_DEBUG << "Can't find property \"Activation\"!"; @@ -388,7 +386,7 @@ inline void { crow::connections::systemBus->async_method_call( [asyncResp, fwId](const boost::system::error_code ec, - const std::variant<std::vector<std::string>>& resp) { + dbus::utility::DbusVariantType& resp) { if (ec) { BMCWEB_LOG_DEBUG << " error_code = " << ec |