Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically. Note that not all
'{.name = "current",' entries are replaced, just those that have the
common .help string of "affect current domain".
Non replaced instances are unique to the command.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
tools/virsh-domain.c | 111 +++++++++++++--------------------------------------
1 file changed, 27 insertions(+), 84 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index c6e9979..20627e9 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -81,6 +81,12 @@
.help = N_("affect running domain") \
} \
+#define VIRSH_DOMAIN_CURRENT_OPT_COMMON \
+ {.name = "current", \
+ .type = VSH_OT_BOOL, \
+ .help = N_("affect current domain") \
+ } \
+
static virDomainPtr
virshLookupDomainInternal(vshControl *ctl,
const char *cmdname,
@@ -232,10 +238,7 @@ static const vshCmdOptDef opts_attach_device[] = {
VIRSH_DOMAIN_PERSISTENT_OPT_COMMON,
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -386,10 +389,7 @@ static const vshCmdOptDef opts_attach_disk[] = {
VIRSH_DOMAIN_PERSISTENT_OPT_COMMON,
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -837,10 +837,7 @@ static const vshCmdOptDef opts_attach_interface[] = {
VIRSH_DOMAIN_PERSISTENT_OPT_COMMON,
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = "print-xml",
.type = VSH_OT_BOOL,
.help = N_("print XML document rather than attach the interface")
@@ -1277,10 +1274,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -1525,10 +1519,7 @@ static const vshCmdOptDef opts_blkiotune[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -3208,10 +3199,7 @@ static const vshCmdOptDef opts_domiftune[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -6390,10 +6378,7 @@ static const vshCmdOptDef opts_vcpupin[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -6588,10 +6573,7 @@ static const vshCmdOptDef opts_emulatorpin[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -6699,10 +6681,7 @@ static const vshCmdOptDef opts_setvcpus[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = "guest",
.type = VSH_OT_BOOL,
.help = N_("modify cpu state in the guest")
@@ -6781,10 +6760,7 @@ static const vshCmdOptDef opts_iothreadinfo[] = {
VIRSH_DOMAIN_OPT_COMMON,
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -6870,10 +6846,7 @@ static const vshCmdOptDef opts_iothreadpin[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -6950,10 +6923,7 @@ static const vshCmdOptDef opts_iothreadadd[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -7018,10 +6988,7 @@ static const vshCmdOptDef opts_iothreaddel[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -8274,10 +8241,7 @@ static const vshCmdOptDef opts_setmem[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -8358,10 +8322,7 @@ static const vshCmdOptDef opts_setmaxmem[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -8456,10 +8417,7 @@ static const vshCmdOptDef opts_memtune[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -8629,10 +8587,7 @@ static const vshCmdOptDef opts_numatune[] = {
},
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -10737,10 +10692,7 @@ static const vshCmdOptDef opts_detach_device[] = {
VIRSH_DOMAIN_PERSISTENT_OPT_COMMON,
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -10825,10 +10777,7 @@ static const vshCmdOptDef opts_update_device[] = {
VIRSH_DOMAIN_PERSISTENT_OPT_COMMON,
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = "force",
.type = VSH_OT_BOOL,
.help = N_("force device update")
@@ -10918,10 +10867,7 @@ static const vshCmdOptDef opts_detach_interface[] = {
VIRSH_DOMAIN_PERSISTENT_OPT_COMMON,
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
@@ -11321,10 +11267,7 @@ static const vshCmdOptDef opts_detach_disk[] = {
VIRSH_DOMAIN_PERSISTENT_OPT_COMMON,
VIRSH_DOMAIN_CONFIG_OPT_COMMON,
VIRSH_DOMAIN_LIVE_OPT_COMMON,
- {.name = "current",
- .type = VSH_OT_BOOL,
- .help = N_("affect current domain")
- },
+ VIRSH_DOMAIN_CURRENT_OPT_COMMON,
{.name = NULL}
};
--
2.5.0