move variant to std namespace
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>
diff --git a/chassishandler.cpp b/chassishandler.cpp
index f8a93b0..7aa3f98 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -136,7 +136,6 @@
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 @@
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 @@
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 @@
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::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 @@
}
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 @@
}
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 @@
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) &&