ethernet_interface: Remove optional signal emission
We don't ever need to turn this off anymore, so we can simplify creation
arguments.
Change-Id: Idb1bde35041f16d409753ff661bfb248cfd4591e
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index 1abcad2..8476136 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -73,9 +73,9 @@
const InterfaceInfo& info,
std::string_view objRoot,
const config::Parser& config,
- bool emitSignal, bool enabled) :
+ bool enabled) :
EthernetInterface(bus, manager, info, makeObjPath(objRoot, *info.name),
- config, emitSignal, enabled)
+ config, enabled)
{
}
@@ -83,10 +83,8 @@
const InterfaceInfo& info,
std::string&& objPath,
const config::Parser& config,
- bool emitSignal, bool enabled) :
- Ifaces(bus, objPath.c_str(),
- emitSignal ? Ifaces::action::defer_emit
- : Ifaces::action::emit_no_signals),
+ bool enabled) :
+ Ifaces(bus, objPath.c_str(), Ifaces::action::defer_emit),
manager(manager), bus(bus), objPath(std::move(objPath)), ifIdx(info.idx)
{
interfaceName(*info.name);
@@ -107,14 +105,10 @@
{
std::runtime_error("Missing parent link");
}
- vlan.emplace(bus, this->objPath.c_str(), info, *this, emitSignal);
+ vlan.emplace(bus, this->objPath.c_str(), info, *this);
}
- // Emit deferred signal.
- if (emitSignal)
- {
- this->emit_object_added();
- }
+ this->emit_object_added();
}
void EthernetInterface::updateInfo(const InterfaceInfo& info)
@@ -559,8 +553,7 @@
// Pass the parents nicEnabled property, so that the child
// VLAN interface can inherit.
auto vlanIntf = std::make_unique<EthernetInterface>(
- bus, manager, info, objRoot, config::Parser(), /*emit=*/true,
- nicEnabled());
+ bus, manager, info, objRoot, config::Parser(), nicEnabled());
ObjectPath ret = vlanIntf->objPath;
manager.interfaces.emplace(intfName, std::move(vlanIntf));
@@ -860,17 +853,12 @@
EthernetInterface::VlanProperties::VlanProperties(
sdbusplus::bus_t& bus, stdplus::const_zstring objPath,
- const InterfaceInfo& info, EthernetInterface& eth, bool emitSignal) :
- VlanIfaces(bus, objPath.c_str(),
- emitSignal ? VlanIfaces::action::defer_emit
- : VlanIfaces::action::emit_no_signals),
+ const InterfaceInfo& info, EthernetInterface& eth) :
+ VlanIfaces(bus, objPath.c_str(), VlanIfaces::action::defer_emit),
parentIdx(*info.parent_idx), eth(eth)
{
VlanIntf::id(*info.vlan_id);
- if (emitSignal)
- {
- this->emit_object_added();
- }
+ this->emit_object_added();
}
void EthernetInterface::VlanProperties::delete_()
diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp
index f29efa2..2ef2f95 100644
--- a/src/ethernet_interface.hpp
+++ b/src/ethernet_interface.hpp
@@ -77,14 +77,11 @@
* @param[in] objRoot - Path to attach at.
* @param[in] config - The parsed configuation file.
* @param[in] vlan - The id of the vlan if configured
- * @param[in] emitSignal - true if the object added signal needs to be
- * send.
* @param[in] enabled - Determine if systemd-networkd is managing this link
*/
EthernetInterface(sdbusplus::bus_t& bus, Manager& manager,
const InterfaceInfo& info, std::string_view objRoot,
- const config::Parser& config, bool emitSignal,
- bool enabled);
+ const config::Parser& config, bool enabled);
/** @brief Network Manager object. */
Manager& manager;
@@ -234,8 +231,7 @@
struct VlanProperties : VlanIfaces
{
VlanProperties(sdbusplus::bus_t& bus, stdplus::const_zstring objPath,
- const InterfaceInfo& info, EthernetInterface& eth,
- bool emitSignal = true);
+ const InterfaceInfo& info, EthernetInterface& eth);
void delete_() override;
unsigned parentIdx;
EthernetInterface& eth;
@@ -248,8 +244,7 @@
private:
EthernetInterface(sdbusplus::bus_t& bus, Manager& manager,
const InterfaceInfo& info, std::string&& objPath,
- const config::Parser& config, bool emitSignal,
- bool enabled);
+ const config::Parser& config, bool enabled);
/** @brief Determines if the address is manually assigned
* @param[in] origin - The origin entry of the IP::Address
diff --git a/src/network_manager.cpp b/src/network_manager.cpp
index 99bedaa..82eb2c5 100644
--- a/src/network_manager.cpp
+++ b/src/network_manager.cpp
@@ -141,7 +141,7 @@
}
config::Parser config(config::pathForIntfConf(confDir, *info.intf.name));
auto intf = std::make_unique<EthernetInterface>(
- bus, *this, info.intf, objPath.str, config, true, enabled);
+ bus, *this, info.intf, objPath.str, config, enabled);
if (info.defgw4)
{
intf->EthernetInterface::defaultGateway(std::to_string(*info.defgw4));
diff --git a/test/mock_ethernet_interface.hpp b/test/mock_ethernet_interface.hpp
index ff1b324..91e9bf5 100644
--- a/test/mock_ethernet_interface.hpp
+++ b/test/mock_ethernet_interface.hpp
@@ -12,8 +12,7 @@
public:
template <typename... Args>
MockEthernetInterface(Args&&... args) :
- EthernetInterface(std::forward<Args>(args)..., /*emitSignal=*/false,
- /*nicEnabled=*/true)
+ EthernetInterface(std::forward<Args>(args)..., /*nicEnabled=*/true)
{
}