diff mbox series

[v3,4/8] tools/hotplug/Linux: remove code duplication in vif-bridge

Message ID 20200811080202.31163-5-paul@xen.org (mailing list archive)
State New, archived
Headers show
Series tools: propogate MTU to vif frontends | expand

Commit Message

Paul Durrant Aug. 11, 2020, 8:01 a.m. UTC
From: Paul Durrant <pdurrant@amazon.com>

The 'add' and 'online' cases do exactly the same thing so have 'add' simply
fall through to 'online'.

NOTE: This patch also adds in the missing 'remove' case, which falls though
      to 'offline'. (The former is passed for 'tap' devices, the latter for
      'vif' devices).

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>

v3:
 - Re-factored from "tools/hotplug: combine add/online and remove/offline
   in vif-bridge..." in v2
---
 tools/hotplug/Linux/vif-bridge | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/tools/hotplug/Linux/vif-bridge b/tools/hotplug/Linux/vif-bridge
index c3e409926d..e1d7c49788 100644
--- a/tools/hotplug/Linux/vif-bridge
+++ b/tools/hotplug/Linux/vif-bridge
@@ -77,21 +77,18 @@  then
 fi
 
 case "$command" in
+    add)
+        ;&
     online)
         setup_virtual_bridge_port "$dev"
         set_mtu "$bridge" "$dev"
         add_to_bridge "$bridge" "$dev"
         ;;
-
+    remove)
+        ;&
     offline)
         remove_from_bridge "$bridge" "$dev"
         ;;
-
-    add)
-        setup_virtual_bridge_port "$dev"
-        set_mtu "$bridge" "$dev"
-        add_to_bridge "$bridge" "$dev"
-        ;;
 esac
 
 handle_iptable