提交 545e5571 编写于 作者: J John Ferlan

virsh: Create macro for common "interface" option

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: NJohn Ferlan <jferlan@redhat.com>
上级 21655228
...@@ -23,6 +23,13 @@ ...@@ -23,6 +23,13 @@
* *
*/ */
#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 <config.h>
#include "virsh-interface.h" #include "virsh-interface.h"
...@@ -100,11 +107,7 @@ static const vshCmdInfo info_interface_edit[] = { ...@@ -100,11 +107,7 @@ static const vshCmdInfo info_interface_edit[] = {
}; };
static const vshCmdOptDef opts_interface_edit[] = { static const vshCmdOptDef opts_interface_edit[] = {
{.name = "interface", VIRSH_COMMON_OPT_INTERFACE,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("interface name or MAC address")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -464,11 +467,7 @@ static const vshCmdInfo info_interface_dumpxml[] = { ...@@ -464,11 +467,7 @@ static const vshCmdInfo info_interface_dumpxml[] = {
}; };
static const vshCmdOptDef opts_interface_dumpxml[] = { static const vshCmdOptDef opts_interface_dumpxml[] = {
{.name = "interface", VIRSH_COMMON_OPT_INTERFACE,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("interface name or MAC address")
},
{.name = "inactive", {.name = "inactive",
.type = VSH_OT_BOOL, .type = VSH_OT_BOOL,
.help = N_("show inactive defined XML") .help = N_("show inactive defined XML")
...@@ -565,11 +564,7 @@ static const vshCmdInfo info_interface_undefine[] = { ...@@ -565,11 +564,7 @@ static const vshCmdInfo info_interface_undefine[] = {
}; };
static const vshCmdOptDef opts_interface_undefine[] = { static const vshCmdOptDef opts_interface_undefine[] = {
{.name = "interface", VIRSH_COMMON_OPT_INTERFACE,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("interface name or MAC address")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -608,11 +603,7 @@ static const vshCmdInfo info_interface_start[] = { ...@@ -608,11 +603,7 @@ static const vshCmdInfo info_interface_start[] = {
}; };
static const vshCmdOptDef opts_interface_start[] = { static const vshCmdOptDef opts_interface_start[] = {
{.name = "interface", VIRSH_COMMON_OPT_INTERFACE,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("interface name or MAC address")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -651,11 +642,7 @@ static const vshCmdInfo info_interface_destroy[] = { ...@@ -651,11 +642,7 @@ static const vshCmdInfo info_interface_destroy[] = {
}; };
static const vshCmdOptDef opts_interface_destroy[] = { static const vshCmdOptDef opts_interface_destroy[] = {
{.name = "interface", VIRSH_COMMON_OPT_INTERFACE,
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("interface name or MAC address")
},
{.name = NULL} {.name = NULL}
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册