[PATCH v2 14/14] virsh: Create macro for common "interface" option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 tools/virsh-interface.c | 37 ++++++++++++-------------------------
 1 file changed, 12 insertions(+), 25 deletions(-)

diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index b69c685..b98b002 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -23,6 +23,13 @@
  *
  */
 
+#define VIRSH_INTERFACE_OPT_COMMON                     \
+    {.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_INTERFACE_OPT_COMMON,
     {.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_INTERFACE_OPT_COMMON,
     {.name = "inactive",
      .type = VSH_OT_BOOL,
      .help = N_("show inactive defined XML")
@@ -569,11 +568,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_INTERFACE_OPT_COMMON,
     {.name = NULL}
 };
 
@@ -612,11 +607,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_INTERFACE_OPT_COMMON,
     {.name = NULL}
 };
 
@@ -655,11 +646,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_INTERFACE_OPT_COMMON,
     {.name = NULL}
 };
 
-- 
2.5.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]