summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2019-04-09 11:44:36 -0700
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-04-18 22:40:32 +0000
commitf442e119aed2dc87f320bf230ad39e7dc5c72524 (patch)
treefe834d199e48249934b3c84aa92db536aea3ef25
parent5b2535f89023d0ea220ccc24200a9b51c142c08d (diff)
downloadphosphor-host-ipmid-master.zip
phosphor-host-ipmid-master.tar.gz
move variant to std namespaceHEADmaster
sdbusplus::message::variant_ns has been std for a while now. This moves ipmid away from sdbusplus::message::variant_ns to directly use std::variant. Tested-by: built, compiles, and runs the same as before. Change-Id: I8caa945f31c926c2721319f001b9d7f83fd3f1b7 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
-rw-r--r--app/watchdog_service.cpp24
-rw-r--r--apphandler.cpp25
-rw-r--r--chassishandler.cpp47
-rw-r--r--dcmihandler.cpp24
-rw-r--r--host-cmd-manager.cpp3
-rw-r--r--libipmid/utils.cpp3
-rw-r--r--read_fru_data.cpp7
-rw-r--r--selutility.cpp12
-rw-r--r--sensordatahandler.cpp14
-rw-r--r--sensordatahandler.hpp6
-rw-r--r--sensorhandler.cpp18
-rw-r--r--settings.cpp3
-rw-r--r--storagehandler.cpp4
-rw-r--r--transporthandler.cpp28
-rw-r--r--user_channel/channel_mgmt.cpp7
-rw-r--r--user_channel/user_mgmt.cpp20
16 files changed, 106 insertions, 139 deletions
diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
index 284964d..0b88369 100644
--- a/app/watchdog_service.cpp
+++ b/app/watchdog_service.cpp
@@ -16,8 +16,6 @@ using phosphor::logging::elog;
using phosphor::logging::entry;
using phosphor::logging::level;
using phosphor::logging::log;
-using sdbusplus::message::variant_ns::get;
-using sdbusplus::message::variant_ns::variant;
using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
using sdbusplus::xyz::openbmc_project::State::server::convertForMessage;
using sdbusplus::xyz::openbmc_project::State::server::Watchdog;
@@ -72,18 +70,20 @@ WatchdogService::Properties WatchdogService::getProperties()
}
try
{
- std::map<std::string, variant<bool, uint64_t, std::string>> properties;
+ std::map<std::string, std::variant<bool, uint64_t, std::string>>
+ properties;
response.read(properties);
Properties wd_prop;
- wd_prop.initialized = get<bool>(properties.at("Initialized"));
- wd_prop.enabled = get<bool>(properties.at("Enabled"));
+ wd_prop.initialized = std::get<bool>(properties.at("Initialized"));
+ wd_prop.enabled = std::get<bool>(properties.at("Enabled"));
wd_prop.expireAction = Watchdog::convertActionFromString(
- get<std::string>(properties.at("ExpireAction")));
+ std::get<std::string>(properties.at("ExpireAction")));
wd_prop.timerUse = Watchdog::convertTimerUseFromString(
- get<std::string>(properties.at("CurrentTimerUse")));
+ std::get<std::string>(properties.at("CurrentTimerUse")));
- wd_prop.interval = get<uint64_t>(properties.at("Interval"));
- wd_prop.timeRemaining = get<uint64_t>(properties.at("TimeRemaining"));
+ wd_prop.interval = std::get<uint64_t>(properties.at("Interval"));
+ wd_prop.timeRemaining =
+ std::get<uint64_t>(properties.at("TimeRemaining"));
return wd_prop;
}
catch (const std::exception& e)
@@ -121,9 +121,9 @@ T WatchdogService::getProperty(const std::string& key)
}
try
{
- variant<T> value;
+ std::variant<T> value;
response.read(value);
- return get<T>(value);
+ return std::get<T>(value);
}
catch (const std::exception& e)
{
@@ -145,7 +145,7 @@ void WatchdogService::setProperty(const std::string& key, const T& val)
{
bool wasValid = wd_service.isValid(bus);
auto request = wd_service.newMethodCall(bus, prop_intf, "Set");
- request.append(wd_intf, key, variant<T>(val));
+ request.append(wd_intf, key, std::variant<T>(val));
auto response = bus.call(request);
if (response.is_method_error())
{
diff --git a/apphandler.cpp b/apphandler.cpp
index 8be092c..87f45d2 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -57,7 +57,6 @@ using Activation =
sdbusplus::xyz::openbmc_project::Software::server::Activation;
using BMC = sdbusplus::xyz::openbmc_project::State::server::BMC;
namespace fs = std::filesystem;
-namespace variant_ns = sdbusplus::message::variant_ns;
/**
* @brief Returns the Version info from primary s/w object
@@ -106,14 +105,14 @@ std::string getActiveSoftwareVersionInfo()
auto& redundancyPriorityProps = intfMap.at(redundancyIntf);
auto& versionProps = intfMap.at(versionIntf);
auto& activationProps = intfMap.at(activationIntf);
- auto priority = variant_ns::get<uint8_t>(
- redundancyPriorityProps.at("Priority"));
+ auto priority =
+ std::get<uint8_t>(redundancyPriorityProps.at("Priority"));
auto purpose =
- variant_ns::get<std::string>(versionProps.at("Purpose"));
- auto activation = variant_ns::get<std::string>(
- activationProps.at("Activation"));
+ std::get<std::string>(versionProps.at("Purpose"));
+ auto activation =
+ std::get<std::string>(activationProps.at("Activation"));
auto version =
- variant_ns::get<std::string>(versionProps.at("Version"));
+ std::get<std::string>(versionProps.at("Version"));
if ((Version::convertVersionPurposeFromString(purpose) ==
Version::VersionPurpose::BMC) &&
(Activation::convertActivationsFromString(activation) ==
@@ -154,9 +153,9 @@ bool getCurrentBmcState()
ipmi::getDbusProperty(bus, bmcObject.second, bmcObject.first,
bmc_state_interface, bmc_state_property);
- return variant_ns::holds_alternative<std::string>(variant) &&
- BMC::convertBMCStateFromString(
- variant_ns::get<std::string>(variant)) == BMC::BMCState::Ready;
+ return std::holds_alternative<std::string>(variant) &&
+ BMC::convertBMCStateFromString(std::get<std::string>(variant)) ==
+ BMC::BMCState::Ready;
}
namespace acpi_state
@@ -407,7 +406,7 @@ ipmi_ret_t ipmi_app_get_acpi_power_state(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
bus, acpiObject.second, acpiObject.first, acpi_state::acpiInterface,
acpi_state::sysACPIProp);
auto sysACPI = acpi_state::ACPIPowerState::convertACPIFromString(
- variant_ns::get<std::string>(sysACPIVal));
+ std::get<std::string>(sysACPIVal));
res->sysACPIState =
static_cast<uint8_t>(acpi_state::dbusToIPMI.at(sysACPI));
@@ -415,7 +414,7 @@ ipmi_ret_t ipmi_app_get_acpi_power_state(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
bus, acpiObject.second, acpiObject.first, acpi_state::acpiInterface,
acpi_state::devACPIProp);
auto devACPI = acpi_state::ACPIPowerState::convertACPIFromString(
- variant_ns::get<std::string>(devACPIVal));
+ std::get<std::string>(devACPIVal));
res->devACPIState =
static_cast<uint8_t>(acpi_state::dbusToIPMI.at(devACPI));
@@ -803,7 +802,7 @@ ipmi_ret_t ipmi_app_get_sys_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
auto variant =
ipmi::getDbusProperty(bus, bmcObject.second, bmcObject.first,
bmc_guid_interface, bmc_guid_property);
- std::string guidProp = variant_ns::get<std::string>(variant);
+ std::string guidProp = std::get<std::string>(variant);
// Erase "-" characters from the property value
guidProp.erase(std::remove(guidProp.begin(), guidProp.end(), '-'),
diff --git a/chassishandler.cpp b/chassishandler.cpp
index f8a93b0..7aa3f98 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -136,7 +136,6 @@ namespace fs = std::filesystem;
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
using namespace sdbusplus::xyz::openbmc_project::Control::Boot::server;
-namespace variant_ns = sdbusplus::message::variant_ns;
namespace chassis
{
@@ -216,19 +215,19 @@ int getHostNetworkData(get_sys_boot_options_response_t* respptr)
macObjectInfo.first, MAC_INTERFACE,
"MACAddress");
- auto ipAddress = variant_ns::get<std::string>(properties["Address"]);
+ auto ipAddress = std::get<std::string>(properties["Address"]);
- auto gateway = variant_ns::get<std::string>(properties["Gateway"]);
+ auto gateway = std::get<std::string>(properties["Gateway"]);
- auto prefix = variant_ns::get<uint8_t>(properties["PrefixLength"]);
+ auto prefix = std::get<uint8_t>(properties["PrefixLength"]);
uint8_t isStatic =
- (variant_ns::get<std::string>(properties["Origin"]) ==
+ (std::get<std::string>(properties["Origin"]) ==
"xyz.openbmc_project.Network.IP.AddressOrigin.Static")
? 1
: 0;
- auto MACAddress = variant_ns::get<std::string>(variant);
+ auto MACAddress = std::get<std::string>(variant);
// it is expected here that we should get the valid data
// but we may also get the default values.
@@ -266,11 +265,10 @@ int getHostNetworkData(get_sys_boot_options_response_t* respptr)
std::memcpy(respptr->data + ADDRTYPE_OFFSET, &isStatic,
sizeof(isStatic));
- uint8_t addressFamily =
- (variant_ns::get<std::string>(properties["Type"]) ==
- "xyz.openbmc_project.Network.IP.Protocol.IPv4")
- ? AF_INET
- : AF_INET6;
+ uint8_t addressFamily = (std::get<std::string>(properties["Type"]) ==
+ "xyz.openbmc_project.Network.IP.Protocol.IPv4")
+ ? AF_INET
+ : AF_INET6;
addrSize = (addressFamily == AF_INET)
? ipmi::network::IPV4_ADDRESS_SIZE_BYTE
@@ -504,7 +502,7 @@ uint32_t getPOHCounter()
ipmi::getDbusProperty(bus, service, chassisStateObj.first,
chassisPOHStateIntf, pOHCounterProperty);
- return variant_ns::get<uint32_t>(propValue);
+ return std::get<uint32_t>(propValue);
}
ipmi_ret_t ipmi_chassis_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
@@ -558,38 +556,37 @@ ipmi_ret_t ipmi_get_chassis_cap(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi::Value variant = ipmi::getDbusProperty(
bus, chassisCapObject.second, chassisCapObject.first,
chassisCapIntf, chassisCapFlagsProp);
- chassis_cap.cap_flags = variant_ns::get<uint8_t>(variant);
+ chassis_cap.cap_flags = std::get<uint8_t>(variant);
variant = ipmi::getDbusProperty(bus, chassisCapObject.second,
chassisCapObject.first, chassisCapIntf,
chassisFRUDevAddrProp);
// Chassis FRU info Device Address.
- chassis_cap.fru_info_dev_addr = variant_ns::get<uint8_t>(variant);
+ chassis_cap.fru_info_dev_addr = std::get<uint8_t>(variant);
variant = ipmi::getDbusProperty(bus, chassisCapObject.second,
chassisCapObject.first, chassisCapIntf,
chassisSDRDevAddrProp);
// Chassis SDR Device Address.
- chassis_cap.sdr_dev_addr = variant_ns::get<uint8_t>(variant);
+ chassis_cap.sdr_dev_addr = std::get<uint8_t>(variant);
variant = ipmi::getDbusProperty(bus, chassisCapObject.second,
chassisCapObject.first, chassisCapIntf,
chassisSELDevAddrProp);
// Chassis SEL Device Address.
- chassis_cap.sel_dev_addr = variant_ns::get<uint8_t>(variant);
+ chassis_cap.sel_dev_addr = std::get<uint8_t>(variant);
variant = ipmi::getDbusProperty(bus, chassisCapObject.second,
chassisCapObject.first, chassisCapIntf,
chassisSMDevAddrProp);
// Chassis System Management Device Address.
- chassis_cap.system_management_dev_addr =
- variant_ns::get<uint8_t>(variant);
+ chassis_cap.system_management_dev_addr = std::get<uint8_t>(variant);
variant = ipmi::getDbusProperty(bus, chassisCapObject.second,
chassisCapObject.first, chassisCapIntf,
chassisBridgeDevAddrProp);
// Chassis Bridge Device Address.
- chassis_cap.bridge_dev_addr = variant_ns::get<uint8_t>(variant);
+ chassis_cap.bridge_dev_addr = std::get<uint8_t>(variant);
uint8_t* respP = reinterpret_cast<uint8_t*>(response);
uint8_t* chassisP = reinterpret_cast<uint8_t*>(&chassis_cap);
std::copy(chassisP, chassisP + *data_len, respP);
@@ -829,8 +826,8 @@ ipmi_ret_t ipmi_get_chassis_status(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
}
sdbusplus::message::variant<std::string> result;
resp.read(result);
- auto powerRestore = RestorePolicy::convertPolicyFromString(
- variant_ns::get<std::string>(result));
+ auto powerRestore =
+ RestorePolicy::convertPolicyFromString(std::get<std::string>(result));
*data_len = 4;
@@ -1366,8 +1363,8 @@ ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
}
sdbusplus::message::variant<std::string> result;
reply.read(result);
- auto bootSource = Source::convertSourcesFromString(
- variant_ns::get<std::string>(result));
+ auto bootSource =
+ Source::convertSourcesFromString(std::get<std::string>(result));
bootSetting = settings::boot::setting(objects, bootModeIntf);
const auto& bootModeSetting = std::get<settings::Path>(bootSetting);
@@ -1384,8 +1381,8 @@ ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
return IPMI_CC_UNSPECIFIED_ERROR;
}
reply.read(result);
- auto bootMode = Mode::convertModesFromString(
- variant_ns::get<std::string>(result));
+ auto bootMode =
+ Mode::convertModesFromString(std::get<std::string>(result));
bootOption = sourceDbusToIpmi.at(bootSource);
if ((Mode::Modes::Regular == bootMode) &&
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index 3188585..edbca8f 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -54,7 +54,6 @@ constexpr auto SENSOR_VALUE_PROP = "Value";
constexpr auto SENSOR_SCALE_PROP = "Scale";
using namespace phosphor::logging;
-namespace variant_ns = sdbusplus::message::variant_ns;
namespace dcmi
{
@@ -89,7 +88,7 @@ uint32_t getPcap(sdbusplus::bus::bus& bus)
sdbusplus::message::variant<uint32_t> pcap;
reply.read(pcap);
- return variant_ns::get<uint32_t>(pcap);
+ return std::get<uint32_t>(pcap);
}
bool getPcapEnabled(sdbusplus::bus::bus& bus)
@@ -110,7 +109,7 @@ bool getPcapEnabled(sdbusplus::bus::bus& bus)
sdbusplus::message::variant<bool> pcapEnabled;
reply.read(pcapEnabled);
- return variant_ns::get<bool>(pcapEnabled);
+ return std::get<bool>(pcapEnabled);
}
void setPcap(sdbusplus::bus::bus& bus, const uint32_t powerCap)
@@ -209,7 +208,7 @@ std::string readAssetTag()
sdbusplus::message::variant<std::string> assetTag;
reply.read(assetTag);
- return variant_ns::get<std::string>(assetTag);
+ return std::get<std::string>(assetTag);
}
void writeAssetTag(const std::string& assetTag)
@@ -244,7 +243,7 @@ std::string getHostName(void)
auto value = ipmi::getDbusProperty(bus, service, networkConfigObj,
networkConfigIntf, hostNameProp);
- return variant_ns::get<std::string>(value);
+ return std::get<std::string>(value);
}
bool getDHCPEnabled()
@@ -258,7 +257,7 @@ bool getDHCPEnabled()
auto value = ipmi::getDbusProperty(bus, service, ethernetObj.first,
ethernetIntf, "DHCPEnabled");
- return variant_ns::get<bool>(value);
+ return std::get<bool>(value);
}
bool getDHCPOption(std::string prop)
@@ -268,7 +267,7 @@ bool getDHCPOption(std::string prop)
auto service = ipmi::getService(bus, dhcpIntf, dhcpObj);
auto value = ipmi::getDbusProperty(bus, service, dhcpObj, dhcpIntf, prop);
- return variant_ns::get<bool>(value);
+ return std::get<bool>(value);
}
void setDHCPOption(std::string prop, bool value)
@@ -834,16 +833,15 @@ Temperature readTemp(const std::string& dbusService,
sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
auto result = ipmi::getAllDbusProperties(
bus, dbusService, dbusPath, "xyz.openbmc_project.Sensor.Value");
- auto temperature = sdbusplus::message::variant_ns::visit(
- ipmi::VariantToDoubleVisitor(), result.at("Value"));
+ auto temperature =
+ std::visit(ipmi::VariantToDoubleVisitor(), result.at("Value"));
double absTemp = std::abs(temperature);
auto findFactor = result.find("Scale");
double factor = 0.0;
if (findFactor != result.end())
{
- factor = sdbusplus::message::variant_ns::visit(
- ipmi::VariantToDoubleVisitor(), findFactor->second);
+ factor = std::visit(ipmi::VariantToDoubleVisitor(), findFactor->second);
}
double scale = std::pow(10, factor);
@@ -1084,8 +1082,8 @@ int64_t getPowerReading(sdbusplus::bus::bus& bus)
// Read the sensor value and scale properties
auto properties = ipmi::getAllDbusProperties(bus, service, objectPath,
SENSOR_VALUE_INTF);
- auto value = variant_ns::get<int64_t>(properties[SENSOR_VALUE_PROP]);
- auto scale = variant_ns::get<int64_t>(properties[SENSOR_SCALE_PROP]);
+ auto value = std::get<int64_t>(properties[SENSOR_VALUE_PROP]);
+ auto scale = std::get<int64_t>(properties[SENSOR_SCALE_PROP]);
// Power reading needs to be scaled with the Scale value using the
// formula Value * 10^Scale.
diff --git a/host-cmd-manager.cpp b/host-cmd-manager.cpp
index 9efb787..f3aba7f 100644
--- a/host-cmd-manager.cpp
+++ b/host-cmd-manager.cpp
@@ -33,7 +33,6 @@ using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
namespace sdbusRule = sdbusplus::bus::match::rules;
-namespace variant_ns = sdbusplus::message::variant_ns;
Manager::Manager(sdbusplus::bus::bus& bus) :
bus(bus), timer(std::bind(&Manager::hostTimeout, this)),
@@ -183,7 +182,7 @@ void Manager::clearQueueOnPowerOn(sdbusplus::message::message& msg)
}
auto& requestedState =
- variant_ns::get<std::string>(properties.at(HOST_TRANS_PROP));
+ std::get<std::string>(properties.at(HOST_TRANS_PROP));
if (server::Host::convertTransitionFromString(requestedState) ==
server::Host::Transition::On)
diff --git a/libipmid/utils.cpp b/libipmid/utils.cpp
index 3ff79ed..b8ba9a7 100644
--- a/libipmid/utils.cpp
+++ b/libipmid/utils.cpp
@@ -15,7 +15,6 @@ namespace ipmi
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-namespace variant_ns = sdbusplus::message::variant_ns;
namespace network
{
@@ -118,7 +117,7 @@ DbusObjectInfo getIPObject(sdbusplus::bus::bus& bus,
objectInfo = std::make_pair(object.first, object.second.begin()->first);
// if LinkLocalIP found look for Non-LinkLocalIP
- if (ipmi::network::isLinkLocalIP(variant_ns::get<std::string>(variant)))
+ if (ipmi::network::isLinkLocalIP(std::get<std::string>(variant)))
{
continue;
}
diff --git a/read_fru_data.cpp b/read_fru_data.cpp
index 1f99e20..1a1949d 100644
--- a/read_fru_data.cpp
+++ b/read_fru_data.cpp
@@ -17,8 +17,6 @@ namespace ipmi
namespace fru
{
-namespace variant_ns = sdbusplus::message::variant_ns;
-
using namespace phosphor::logging;
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
@@ -140,9 +138,8 @@ FruInventoryData readDataFromInventory(const FRUId& fruNum)
if (iter != allProp.end())
{
data[properties.second.section].emplace(
- properties.first,
- std::move(variant_ns::get<std::string>(
- allProp[properties.first])));
+ properties.first, std::move(std::get<std::string>(
+ allProp[properties.first])));
}
}
}
diff --git a/selutility.cpp b/selutility.cpp
index 97c2b2b..0d71a47 100644
--- a/selutility.cpp
+++ b/selutility.cpp
@@ -58,8 +58,7 @@ GetSELEntryResponse
elog<InternalFailure>();
}
- record.recordID = static_cast<uint16_t>(
- sdbusplus::message::variant_ns::get<uint32_t>(iterId->second));
+ record.recordID = static_cast<uint16_t>(std::get<uint32_t>(iterId->second));
// Read Timestamp from the log entry.
static constexpr auto propTimeStamp = "Timestamp";
@@ -71,7 +70,7 @@ GetSELEntryResponse
}
std::chrono::milliseconds chronoTimeStamp(
- sdbusplus::message::variant_ns::get<uint64_t>(iterTimeStamp->second));
+ std::get<uint64_t>(iterTimeStamp->second));
record.timeStamp = static_cast<uint32_t>(
std::chrono::duration_cast<std::chrono::seconds>(chronoTimeStamp)
.count());
@@ -100,7 +99,7 @@ GetSELEntryResponse
static constexpr auto deassertEvent = 0x80;
// Evaluate if the event is assertion or deassertion event
- if (sdbusplus::message::variant_ns::get<bool>(iterResolved->second))
+ if (std::get<bool>(iterResolved->second))
{
record.eventType = deassertEvent | iter->second.eventReadingType;
}
@@ -142,7 +141,7 @@ GetSELEntryResponse convertLogEntrytoSEL(const std::string& objPath)
sdbusplus::message::variant<AssociationList> list;
reply.read(list);
- auto& assocs = sdbusplus::message::variant_ns::get<AssociationList>(list);
+ auto& assocs = std::get<AssociationList>(list);
/*
* Check if the log entry has any callout associations, if there is a
@@ -204,8 +203,7 @@ std::chrono::seconds getEntryTimeStamp(const std::string& objPath)
sdbusplus::message::variant<uint64_t> timeStamp;
reply.read(timeStamp);
- std::chrono::milliseconds chronoTimeStamp(
- sdbusplus::message::variant_ns::get<uint64_t>(timeStamp));
+ std::chrono::milliseconds chronoTimeStamp(std::get<uint64_t>(timeStamp));
return std::chrono::duration_cast<std::chrono::seconds>(chronoTimeStamp);
}
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index 1de1540..76dad69 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -17,8 +17,6 @@ namespace ipmi
namespace sensor
{
-namespace variant_ns = sdbusplus::message::variant_ns;
-
using namespace phosphor::logging;
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
@@ -340,8 +338,7 @@ ipmi_ret_t assertion(const SetSensorReadingReq& cmdData, const Info& sensorInfo)
{
return IPMI_CC_OK;
}
- result =
- result && variant_ns::get<bool>(value.second.assert);
+ result = result && std::get<bool>(value.second.assert);
valid = true;
}
else if (deassertionSet.test(value.first))
@@ -351,8 +348,7 @@ ipmi_ret_t assertion(const SetSensorReadingReq& cmdData, const Info& sensorInfo)
{
return IPMI_CC_OK;
}
- result =
- result && variant_ns::get<bool>(value.second.deassert);
+ result = result && std::get<bool>(value.second.deassert);
valid = true;
}
}
@@ -361,13 +357,11 @@ ipmi_ret_t assertion(const SetSensorReadingReq& cmdData, const Info& sensorInfo)
{
if (assertionSet.test(value.first))
{
- result =
- result && variant_ns::get<bool>(value.second.assert);
+ result = result && std::get<bool>(value.second.assert);
}
else if (deassertionSet.test(value.first))
{
- result =
- result && variant_ns::get<bool>(value.second.deassert);
+ result = result && std::get<bool>(value.second.deassert);
}
}
if (valid)
diff --git a/sensordatahandler.hpp b/sensordatahandler.hpp
index 6d80f9a..a7eadda 100644
--- a/sensordatahandler.hpp
+++ b/sensordatahandler.hpp
@@ -13,8 +13,6 @@ namespace ipmi
namespace sensor
{
-namespace variant_ns = sdbusplus::message::variant_ns;
-
using Assertion = uint16_t;
using Deassertion = uint16_t;
using AssertionSet = std::pair<Assertion, Deassertion>;
@@ -166,7 +164,7 @@ GetSensorResponse readingAssertion(const Info& sensorInfo)
sensorInfo.propertyInterfaces.begin()->first,
sensorInfo.propertyInterfaces.begin()->second.begin()->first);
- setAssertionBytes(static_cast<uint16_t>(variant_ns::get<T>(propValue)),
+ setAssertionBytes(static_cast<uint16_t>(std::get<T>(propValue)),
responseData);
return response;
@@ -197,7 +195,7 @@ GetSensorResponse readingData(const Info& sensorInfo)
sensorInfo.propertyInterfaces.begin()->first,
sensorInfo.propertyInterfaces.begin()->second.begin()->first);
- double value = variant_ns::get<T>(propValue) *
+ double value = std::get<T>(propValue) *
std::pow(10, sensorInfo.scale - sensorInfo.exponentR);
auto rawData = static_cast<uint8_t>((value - sensorInfo.scaledOffset) /
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 48546af..4c0fe01 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -32,8 +32,6 @@ using namespace phosphor::logging;
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
-namespace variant_ns = sdbusplus::message::variant_ns;
-
void register_netfn_sen_functions() __attribute__((constructor));
struct sensorTypemap_t
@@ -443,10 +441,10 @@ void getSensorThresholds(uint8_t sensorNum,
auto warnThresholds = ipmi::getAllDbusProperties(
bus, service, info.sensorPath, warningThreshIntf);
- double warnLow = variant_ns::visit(ipmi::VariantToDoubleVisitor(),
- warnThresholds["WarningLow"]);
- double warnHigh = variant_ns::visit(ipmi::VariantToDoubleVisitor(),
- warnThresholds["WarningHigh"]);
+ double warnLow = std::visit(ipmi::VariantToDoubleVisitor(),
+ warnThresholds["WarningLow"]);
+ double warnHigh = std::visit(ipmi::VariantToDoubleVisitor(),
+ warnThresholds["WarningHigh"]);
if (warnLow != 0)
{
@@ -468,10 +466,10 @@ void getSensorThresholds(uint8_t sensorNum,
auto critThresholds = ipmi::getAllDbusProperties(
bus, service, info.sensorPath, criticalThreshIntf);
- double critLow = variant_ns::visit(ipmi::VariantToDoubleVisitor(),
- critThresholds["CriticalLow"]);
- double critHigh = variant_ns::visit(ipmi::VariantToDoubleVisitor(),
- critThresholds["CriticalHigh"]);
+ double critLow = std::visit(ipmi::VariantToDoubleVisitor(),
+ critThresholds["CriticalLow"]);
+ double critHigh = std::visit(ipmi::VariantToDoubleVisitor(),
+ critThresholds["CriticalHigh"]);
if (critLow != 0)
{
diff --git a/settings.cpp b/settings.cpp
index e8b8997..a51fa95 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -11,7 +11,6 @@ namespace settings
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-namespace variant_ns = sdbusplus::message::variant_ns;
constexpr auto mapperService = "xyz.openbmc_project.ObjectMapper";
constexpr auto mapperPath = "/xyz/openbmc_project/object_mapper";
@@ -132,7 +131,7 @@ std::tuple<Path, OneTimeEnabled> setting(const Objects& objects,
sdbusplus::message::variant<bool> enabled;
reply.read(enabled);
- auto oneTimeEnabled = variant_ns::get<bool>(enabled);
+ auto oneTimeEnabled = std::get<bool>(enabled);
const Path& setting = oneTimeEnabled ? oneTimeSetting : regularSetting;
return std::make_tuple(setting, oneTimeEnabled);
}
diff --git a/storagehandler.cpp b/storagehandler.cpp
index 18f1357..c225279 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -62,8 +62,6 @@ ipmi::sel::ObjectPaths paths;
} // namespace cache
-namespace variant_ns = sdbusplus::message::variant_ns;
-
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
using namespace phosphor::logging;
@@ -522,7 +520,7 @@ ipmi_ret_t ipmi_storage_get_sel_time(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
return IPMI_CC_UNSPECIFIED_ERROR;
}
reply.read(value);
- host_time_usec = variant_ns::get<uint64_t>(value);
+ host_time_usec = std::get<uint64_t>(value);
}
catch (InternalFailure& e)
{
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 59d933a..d0768ac 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -36,7 +36,6 @@ using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
namespace fs = std::filesystem;
-namespace variant_ns = sdbusplus::message::variant_ns;
void register_netfn_transport_functions() __attribute__((constructor));
@@ -88,7 +87,7 @@ ipmi_ret_t getNetworkData(uint8_t lan_param, uint8_t* data, int channel)
ipmi::network::IP_INTERFACE);
ipaddress =
- variant_ns::get<std::string>(properties["Address"]);
+ std::get<std::string>(properties["Address"]);
}
// ignore the exception, as it is a valid condition that
// the system is not configured with any IP.
@@ -162,7 +161,7 @@ ipmi_ret_t getNetworkData(uint8_t lan_param, uint8_t* data, int channel)
bus, ipmi::network::SERVICE, networkInterfacePath,
ipmi::network::ETHERNET_INTERFACE, "DHCPEnabled");
- auto dhcpEnabled = variant_ns::get<bool>(variant);
+ auto dhcpEnabled = std::get<bool>(variant);
// As per IPMI spec 2=>DHCP, 1=STATIC
auto ipsrc = dhcpEnabled ? ipmi::network::IPOrigin::DHCP
: ipmi::network::IPOrigin::STATIC;
@@ -192,8 +191,8 @@ ipmi_ret_t getNetworkData(uint8_t lan_param, uint8_t* data, int channel)
bus, ipObjectInfo.second, ipObjectInfo.first,
ipmi::network::IP_INTERFACE);
- auto prefix = variant_ns::get<uint8_t>(
- properties["PrefixLength"]);
+ auto prefix =
+ std::get<uint8_t>(properties["PrefixLength"]);
mask = ipmi::network::MASK_32_BIT;
mask = htonl(mask << (ipmi::network::BITS_32 - prefix));
}
@@ -230,7 +229,7 @@ ipmi_ret_t getNetworkData(uint8_t lan_param, uint8_t* data, int channel)
bus, systemObject.second, systemObject.first,
ipmi::network::SYSTEMCONFIG_INTERFACE);
- gateway = variant_ns::get<std::string>(
+ gateway = std::get<std::string>(
systemProperties["DefaultGateway"]);
}
// ignore the exception, as it is a valid condition that
@@ -263,7 +262,7 @@ ipmi_ret_t getNetworkData(uint8_t lan_param, uint8_t* data, int channel)
bus, macObjectInfo.second, macObjectInfo.first,
ipmi::network::MAC_INTERFACE, "MACAddress");
- macAddress = variant_ns::get<std::string>(variant);
+ macAddress = std::get<std::string>(variant);
}
else if (channelConf->lan_set_in_progress == SET_IN_PROGRESS)
{
@@ -799,7 +798,7 @@ void applyChanges(int channel)
}
// get the configured mode on the system.
- auto enableDHCP = variant_ns::get<bool>(ipmi::getDbusProperty(
+ auto enableDHCP = std::get<bool>(ipmi::getDbusProperty(
bus, ipmi::network::SERVICE, networkInterfacePath,
ipmi::network::ETHERNET_INTERFACE, "DHCPEnabled"));
@@ -843,14 +842,13 @@ void applyChanges(int channel)
bus, ipObject.second, ipObject.first,
ipmi::network::IP_INTERFACE);
- ipaddress = channelConf->ipaddr.empty()
- ? variant_ns::get<std::string>(
- properties["Address"])
- : channelConf->ipaddr;
+ ipaddress =
+ channelConf->ipaddr.empty()
+ ? std::get<std::string>(properties["Address"])
+ : channelConf->ipaddr;
prefix = channelConf->netmask.empty()
- ? variant_ns::get<uint8_t>(
- properties["PrefixLength"])
+ ? std::get<uint8_t>(properties["PrefixLength"])
: ipmi::network::toPrefix(
AF_INET, channelConf->netmask);
}
@@ -867,7 +865,7 @@ void applyChanges(int channel)
ipmi::network::SYSTEMCONFIG_INTERFACE);
gateway = channelConf->gateway.empty()
- ? variant_ns::get<std::string>(
+ ? std::get<std::string>(
systemProperties["DefaultGateway"])
: channelConf->gateway;
}
diff --git a/user_channel/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp
index 3fb19b2..6be7d9a 100644
--- a/user_channel/channel_mgmt.cpp
+++ b/user_channel/channel_mgmt.cpp
@@ -34,7 +34,6 @@
namespace ipmi
{
-namespace variant_ns = sdbusplus::message::variant_ns;
using namespace phosphor::logging;
static constexpr const char* channelAccessDefaultFilename =
@@ -204,7 +203,7 @@ void ChannelConfig::processChAccessPropChange(
if (prop.first == privilegePropertyString)
{
propName = privilegePropertyString;
- intfPrivStr = variant_ns::get<std::string>(prop.second);
+ intfPrivStr = std::get<std::string>(prop.second);
break;
}
}
@@ -1309,9 +1308,9 @@ int ChannelConfig::syncNetworkChannelConfig()
channelData[chNum].chName.c_str()));
continue;
}
- intfPrivStr = variant_ns::get<std::string>(variant);
+ intfPrivStr = std::get<std::string>(variant);
}
- catch (const variant_ns::bad_variant_access& e)
+ catch (const std::bad_variant_access& e)
{
log<level::DEBUG>(
"exception: Network interface does not exist");
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index f0cd7ad..6f4a79f 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -103,8 +103,6 @@ static std::array<std::string, (PRIVILEGE_OEM + 1)> ipmiPrivIndex = {
"priv-custom" // PRIVILEGE_OEM - 5
};
-namespace variant_ns = sdbusplus::message::variant_ns;
-
using namespace phosphor::logging;
using Json = nlohmann::json;
@@ -376,17 +374,17 @@ void userUpdatedSignalHandler(UserAccess& usrAccess,
std::string member = prop.first;
if (member == userPrivProperty)
{
- priv = variant_ns::get<std::string>(prop.second);
+ priv = std::get<std::string>(prop.second);
userEvent = UserUpdateEvent::userPrivUpdated;
}
else if (member == userGrpProperty)
{
- groups = variant_ns::get<std::vector<std::string>>(prop.second);
+ groups = std::get<std::vector<std::string>>(prop.second);
userEvent = UserUpdateEvent::userGrpUpdated;
}
else if (member == userEnabledProperty)
{
- enabled = variant_ns::get<bool>(prop.second);
+ enabled = std::get<bool>(prop.second);
userEvent = UserUpdateEvent::userStateUpdated;
}
// Process based on event type.
@@ -1252,13 +1250,11 @@ void UserAccess::getSystemPrivAndGroups()
auto key = t.first;
if (key == allPrivProperty)
{
- availablePrivileges =
- variant_ns::get<std::vector<std::string>>(t.second);
+ availablePrivileges = std::get<std::vector<std::string>>(t.second);
}
else if (key == allGrpProperty)
{
- availableGroups =
- variant_ns::get<std::vector<std::string>>(t.second);
+ availableGroups = std::get<std::vector<std::string>>(t.second);
}
}
// TODO: Implement Supported Privilege & Groups verification logic
@@ -1285,15 +1281,15 @@ void UserAccess::getUserProperties(const DbusUserObjProperties& properties,
std::string key = t.first;
if (key == userPrivProperty)
{
- usrPriv = variant_ns::get<std::string>(t.second);
+ usrPriv = std::get<std::string>(t.second);
}
else if (key == userGrpProperty)
{
- usrGrps = variant_ns::get<std::vector<std::string>>(t.second);
+ usrGrps = std::get<std::vector<std::string>>(t.second);
}
else if (key == userEnabledProperty)
{
- usrEnabled = variant_ns::get<bool>(t.second);
+ usrEnabled = std::get<bool>(t.second);
}
}
return;
OpenPOWER on IntegriCloud