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 094cccf..6a34688 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -76,6 +76,12 @@
.help = N_("make live change persistent") \
} \
+#define VSH_DOMAIN_CONFIG_OPT_COMMON \
+ {.name = "config", \
+ .type = VSH_OT_BOOL, \
+ .help = N_("affect next boot") \
+ } \
+
static virDomainPtr
virshLookupDomainInternal(vshControl *ctl,
const char *cmdname,
@@ -225,10 +231,7 @@ static const vshCmdOptDef opts_attach_device[] = {
.help = N_("XML file")
},
VSH_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -385,10 +388,7 @@ static const vshCmdOptDef opts_attach_disk[] = {
.help = N_("print XML document rather than attach the disk")
},
VSH_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -842,10 +842,7 @@ static const vshCmdOptDef opts_attach_interface[] = {
.help = N_("control domain's outgoing traffics")
},
VSH_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -1288,10 +1285,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -1542,10 +1536,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -3052,10 +3043,7 @@ static const vshCmdOptDef opts_domif_setlink[] = {
.type = VSH_OT_ALIAS,
.help = "config"
},
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = NULL}
};
@@ -3234,10 +3222,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6422,10 +6407,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6626,10 +6608,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6743,10 +6722,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6831,10 +6807,7 @@ static const vshCmdInfo info_iothreadinfo[] = {
};
static const vshCmdOptDef opts_iothreadinfo[] = {
VSH_DOMAIN_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -6926,10 +6899,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -7012,10 +6982,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -7086,10 +7053,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8348,10 +8312,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8438,10 +8399,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8542,10 +8500,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -8721,10 +8676,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")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -10835,10 +10787,7 @@ static const vshCmdOptDef opts_detach_device[] = {
.help = N_("XML file")
},
VSH_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -10929,10 +10878,7 @@ static const vshCmdOptDef opts_update_device[] = {
.help = N_("XML file")
},
VSH_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -11028,10 +10974,7 @@ static const vshCmdOptDef opts_detach_interface[] = {
.help = N_("MAC address")
},
VSH_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
@@ -11437,10 +11380,7 @@ static const vshCmdOptDef opts_detach_disk[] = {
.help = N_("target of disk device")
},
VSH_DOMAIN_PERSISTENT_OPT_COMMON,
- {.name = "config",
- .type = VSH_OT_BOOL,
- .help = N_("affect next boot")
- },
+ VSH_DOMAIN_CONFIG_OPT_COMMON,
{.name = "live",
.type = VSH_OT_BOOL,
.help = N_("affect running domain")
--
2.5.0