Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically. Note that not all
'{.name = "config",' entries are replaced, just those that have the
common .help string of "affect next boot".
Non replaced instances are unique to the command.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
tools/virsh-domain.c | 116 +++++++++++++--------------------------------------
1 file changed, 28 insertions(+), 88 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 476ba58..ba6ba7f 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -69,6 +69,12 @@
.help = N_("make live change persistent") \
} \
+#define VIRSH_COMMON_OPT_DOMAIN_CONFIG \
+ {.name = "config", \
+ .type = VSH_OT_BOOL, \
+ .help = N_("affect next boot") \
+ } \
+
static virDomainPtr
virshLookupDomainInternal(vshControl *ctl,
const char *cmdname,
@@ -218,10 +224,7 @@ static const vshCmdOptDef opts_attach_device[] = {
.help = N_("XML file")
},
VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -378,10 +381,7 @@ static const vshCmdOptDef opts_attach_disk[] = {
.help = N_("print XML document rather than attach the disk")
},
VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -835,10 +835,7 @@ static const vshCmdOptDef opts_attach_interface[] = {
.help = N_("control domain's outgoing traffics")
},
VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -1281,10 +1278,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
.type = VSH_OT_INT,
.help = N_("I/O size in bytes")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -1535,10 +1529,7 @@ static const vshCmdOptDef opts_blkiotune[] = {
.type = VSH_OT_STRING,
.help = N_("per-device bytes wrote per second, in the form of
/path/to/device,write_bytes_sec,...")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -3045,10 +3036,7 @@ static const vshCmdOptDef opts_domif_setlink[] = {
.type = VSH_OT_ALIAS,
.help = "config"
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = NULL}
};
@@ -3227,10 +3215,7 @@ static const vshCmdOptDef opts_domiftune[] = {
.type = VSH_OT_STRING,
.help = N_("control domain's outgoing traffics")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6443,10 +6428,7 @@ static const vshCmdOptDef opts_vcpupin[] = {
.flags = VSH_OFLAG_EMPTY_OK,
.help = N_("host cpu number(s) to set, or omit option to query")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6647,10 +6629,7 @@ static const vshCmdOptDef opts_emulatorpin[] = {
.flags = VSH_OFLAG_EMPTY_OK,
.help = N_("host cpu number(s) to set, or omit option to query")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6764,10 +6743,7 @@ static const vshCmdOptDef opts_setvcpus[] = {
.type = VSH_OT_BOOL,
.help = N_("set maximum limit on next boot")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6852,10 +6828,7 @@ static const vshCmdInfo info_iothreadinfo[] = {
};
static const vshCmdOptDef opts_iothreadinfo[] = {
VIRSH_COMMON_OPT_DOMAIN,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6947,10 +6920,7 @@ static const vshCmdOptDef opts_iothreadpin[] = {
.flags = VSH_OFLAG_REQ,
.help = N_("host cpu number(s) to set")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -7033,10 +7003,7 @@ static const vshCmdOptDef opts_iothreadadd[] = {
.flags = VSH_OFLAG_REQ,
.help = N_("iothread for the new IOThread")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -7107,10 +7074,7 @@ static const vshCmdOptDef opts_iothreaddel[] = {
.flags = VSH_OFLAG_REQ,
.help = N_("iothread_id for the IOThread to delete")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8369,10 +8333,7 @@ static const vshCmdOptDef opts_setmem[] = {
.flags = VSH_OFLAG_REQ,
.help = N_("new memory size, as scaled integer (default KiB)")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8459,10 +8420,7 @@ static const vshCmdOptDef opts_setmaxmem[] = {
.flags = VSH_OFLAG_REQ,
.help = N_("new maximum memory size, as scaled integer (default KiB)")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8563,10 +8521,7 @@ static const vshCmdOptDef opts_memtune[] = {
.type = VSH_OT_INT,
.help = N_("Min guaranteed memory, as scaled integer (default KiB)")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8742,10 +8697,7 @@ static const vshCmdOptDef opts_numatune[] = {
.type = VSH_OT_STRING,
.help = N_("NUMA node selections to set")
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -10860,10 +10812,7 @@ static const vshCmdOptDef opts_detach_device[] = {
.help = N_("XML file")
},
VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -10954,10 +10903,7 @@ static const vshCmdOptDef opts_update_device[] = {
.help = N_("XML file")
},
VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -11053,10 +10999,7 @@ static const vshCmdOptDef opts_detach_interface[] = {
.help = N_("MAC address")
},
VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -11462,10 +11405,7 @@ static const vshCmdOptDef opts_detach_disk[] = {
.help = N_("target of disk device")
},
VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
--
2.5.0