]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Create macro for common "interface" option
authorJohn Ferlan <jferlan@redhat.com>
Sat, 9 Jan 2016 13:36:35 +0000 (08:36 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 11 Jan 2016 23:14:01 +0000 (18:14 -0500)
Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically.  Note that not all
'{.name = "interface",' entries are replaced, just those that have the
common .help string of "interface name or MAC address".

Signed-off-by: John Ferlan <jferlan@redhat.com>
tools/virsh-interface.c

index c36b92d2c67b37b0e04a9cffeee1ebce4019250a..99ac84ea9b6d57b85543b54b7640ad298abe0c7d 100644 (file)
  *
  */
 
+#define VIRSH_COMMON_OPT_INTERFACE                     \
+    {.name = "interface",                              \
+     .type = VSH_OT_DATA,                              \
+     .flags = VSH_OFLAG_REQ,                           \
+     .help = N_("interface name or MAC address")       \
+    }                                                  \
+
 #include <config.h>
 #include "virsh-interface.h"
 
@@ -100,11 +107,7 @@ static const vshCmdInfo info_interface_edit[] = {
 };
 
 static const vshCmdOptDef opts_interface_edit[] = {
-    {.name = "interface",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("interface name or MAC address")
-    },
+    VIRSH_COMMON_OPT_INTERFACE,
     {.name = NULL}
 };
 
@@ -464,11 +467,7 @@ static const vshCmdInfo info_interface_dumpxml[] = {
 };
 
 static const vshCmdOptDef opts_interface_dumpxml[] = {
-    {.name = "interface",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("interface name or MAC address")
-    },
+    VIRSH_COMMON_OPT_INTERFACE,
     {.name = "inactive",
      .type = VSH_OT_BOOL,
      .help = N_("show inactive defined XML")
@@ -565,11 +564,7 @@ static const vshCmdInfo info_interface_undefine[] = {
 };
 
 static const vshCmdOptDef opts_interface_undefine[] = {
-    {.name = "interface",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("interface name or MAC address")
-    },
+    VIRSH_COMMON_OPT_INTERFACE,
     {.name = NULL}
 };
 
@@ -608,11 +603,7 @@ static const vshCmdInfo info_interface_start[] = {
 };
 
 static const vshCmdOptDef opts_interface_start[] = {
-    {.name = "interface",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("interface name or MAC address")
-    },
+    VIRSH_COMMON_OPT_INTERFACE,
     {.name = NULL}
 };
 
@@ -651,11 +642,7 @@ static const vshCmdInfo info_interface_destroy[] = {
 };
 
 static const vshCmdOptDef opts_interface_destroy[] = {
-    {.name = "interface",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("interface name or MAC address")
-    },
+    VIRSH_COMMON_OPT_INTERFACE,
     {.name = NULL}
 };