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 f12973b..dc3b07c 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -69,6 +69,12 @@
.help = N_("make live change persistent") \
} \
+#define VIRSH_DOMAIN_CONFIG_OPT_COMMON \
+ {.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_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_DOMAIN_CONFIG_OPT_COMMON,
{.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_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_DOMAIN_CONFIG_OPT_COMMON,
{.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_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_DOMAIN_CONFIG_OPT_COMMON,
{.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_DOMAIN_CONFIG_OPT_COMMON,
{.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_DOMAIN_CONFIG_OPT_COMMON,
{.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_DOMAIN_CONFIG_OPT_COMMON,
{.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_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6415,10 +6400,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_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6619,10 +6601,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_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6736,10 +6715,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_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6824,10 +6800,7 @@ static const vshCmdInfo info_iothreadinfo[] = {
};
static const vshCmdOptDef opts_iothreadinfo[] = {
VIRSH_DOMAIN_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6919,10 +6892,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_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -7005,10 +6975,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_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -7079,10 +7046,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_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8341,10 +8305,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_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8431,10 +8392,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_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8535,10 +8493,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_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8714,10 +8669,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_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -10828,10 +10780,7 @@ static const vshCmdOptDef opts_detach_device[] = {
.help = N_("XML file")
},
VIRSH_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -10922,10 +10871,7 @@ static const vshCmdOptDef opts_update_device[] = {
.help = N_("XML file")
},
VIRSH_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -11021,10 +10967,7 @@ static const vshCmdOptDef opts_detach_interface[] = {
.help = N_("MAC address")
},
VIRSH_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -11430,10 +11373,7 @@ static const vshCmdOptDef opts_detach_disk[] = {
.help = N_("target of disk device")
},
VIRSH_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VIRSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
--
2.5.0