From e178688f8e140e80f4f4cbcfbd17d22dd43c073f Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Wed, 25 Nov 2015 09:08:54 -0500 Subject: [PATCH] virsh: Create macro for "file" option Rather than continually cut/paste the "file" option for pool command option structures, generate a macro which will commonly define it for any command. Then of course use that macro. --- tools/virsh-pool.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 28a525cc1d..06f69d8178 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -40,6 +40,13 @@ .help = N_("pool name or uuid") \ } \ +#define VSH_POOL_FILE_OPT_COMMON \ + {.name = "file", \ + .type = VSH_OT_DATA, \ + .flags = VSH_OFLAG_REQ, \ + .help = N_("file containing an XML pool description") \ + } \ + virStoragePoolPtr virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname, const char **name, unsigned int flags) @@ -145,11 +152,8 @@ static const vshCmdInfo info_pool_create[] = { }; static const vshCmdOptDef opts_pool_create[] = { - {.name = "file", - .type = VSH_OT_DATA, - .flags = VSH_OFLAG_REQ, - .help = N_("file containing an XML pool description") - }, + VSH_POOL_FILE_OPT_COMMON, + {.name = NULL} }; @@ -410,11 +414,8 @@ static const vshCmdInfo info_pool_define[] = { }; static const vshCmdOptDef opts_pool_define[] = { - {.name = "file", - .type = VSH_OT_DATA, - .flags = VSH_OFLAG_REQ, - .help = N_("file containing an XML pool description") - }, + VSH_POOL_FILE_OPT_COMMON, + {.name = NULL} }; -- GitLab