summaryrefslogtreecommitdiff
path: root/redfish-core/lib/update_service.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2021-12-14 01:39:53 +0300
committerEd Tanous <ed@tanous.net>2021-12-28 00:42:41 +0300
commit168e20c1306e3e689907ba43e14ea679e2328611 (patch)
tree7c578ede3cf14ffaf06ad9fbc245a97b71b21cc9 /redfish-core/lib/update_service.hpp
parentb477fd4408bc0602cc86147121f03791d3f4824a (diff)
downloadbmcweb-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/lib/update_service.hpp')
-rw-r--r--redfish-core/lib/update_service.hpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index f3987d4c74..f5528e1a70 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -19,11 +19,10 @@
#include <app.hpp>
#include <boost/container/flat_map.hpp>
+#include <dbus_utility.hpp>
#include <registries/privilege_registry.hpp>
#include <utils/fw_utils.hpp>
-#include <variant>
-
namespace redfish
{
@@ -55,7 +54,7 @@ inline static void activateImage(const std::string& objPath,
},
service, objPath, "org.freedesktop.DBus.Properties", "Set",
"xyz.openbmc_project.Software.Activation", "RequestedActivation",
- std::variant<std::string>(
+ dbus::utility::DbusVariantType(
"xyz.openbmc_project.Software.Activation.RequestedActivations.Active"));
}
@@ -68,7 +67,7 @@ static void
{
std::vector<std::pair<
std::string,
- std::vector<std::pair<std::string, std::variant<std::string>>>>>
+ std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>>>
interfacesProperties;
sdbusplus::message::object_path objPath;
@@ -135,7 +134,7 @@ static void
std::string iface;
boost::container::flat_map<
std::string,
- std::variant<std::string, uint8_t>>
+ dbus::utility::DbusVariantType>
values;
std::string index =
@@ -321,7 +320,8 @@ static void monitorForSoftwareAvailable(
"arg0='xyz.openbmc_project.Logging.Entry'",
[asyncResp, url](sdbusplus::message::message& m) {
BMCWEB_LOG_DEBUG << "Error Match fired";
- boost::container::flat_map<std::string, std::variant<std::string>>
+ boost::container::flat_map<std::string,
+ dbus::utility::DbusVariantType>
values;
std::string objName;
m.read(objName, values);
@@ -544,7 +544,7 @@ inline void requestRoutesUpdateService(App& app)
// Get the current ApplyTime value
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::variant<std::string>& applyTime) {
+ const dbus::utility::DbusVariantType& applyTime) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -654,7 +654,7 @@ inline void requestRoutesUpdateService(App& app)
"org.freedesktop.DBus.Properties", "Set",
"xyz.openbmc_project.Software.ApplyTime",
"RequestedApplyTime",
- std::variant<std::string>{applyTimeNewVal});
+ dbus::utility::DbusVariantType{applyTimeNewVal});
}
}
}
@@ -825,18 +825,22 @@ inline void requestRoutesSoftwareInventory(App& app)
obj.second[0].first);
crow::connections::systemBus->async_method_call(
- [asyncResp, swId](
- const boost::system::error_code errorCode,
- const boost::container::flat_map<
- std::string, VariantType>& propertiesList) {
+ [asyncResp,
+ swId](const boost::system::error_code errorCode,
+ const boost::container::flat_map<
+ std::string,
+ dbus::utility::DbusVariantType>&
+ propertiesList) {
if (errorCode)
{
messages::internalError(asyncResp->res);
return;
}
boost::container::flat_map<
- std::string, VariantType>::const_iterator
- it = propertiesList.find("Purpose");
+ std::string,
+ dbus::utility::DbusVariantType>::
+ const_iterator it =
+ propertiesList.find("Purpose");
if (it == propertiesList.end())
{
BMCWEB_LOG_DEBUG