On 25.11.2015 20:11, John Ferlan wrote: > Rather than continually cut/paste the "pool" option for pool command > option structures, generate a macro which will commonly define it for > any command. Then of course use that macro. > > Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> > --- > tools/virsh-pool.c | 91 +++++++++++++++++++----------------------------------- > 1 file changed, 31 insertions(+), 60 deletions(-) > > diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c > index cf5a8f3..6922ad5 100644 > --- a/tools/virsh-pool.c > +++ b/tools/virsh-pool.c > @@ -33,6 +33,13 @@ > #include "conf/storage_conf.h" > #include "virstring.h" > > +#define OPT_POOL_COMMON \ > + {.name = "pool", \ > + .type = VSH_OT_DATA, \ > + .flags = VSH_OFLAG_REQ, \ > + .help = N_("pool name or uuid") \ > + }, \ > + > virStoragePoolPtr > virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname, > const char **name, unsigned int flags) > @@ -85,11 +92,8 @@ static const vshCmdInfo info_pool_autostart[] = { > }; > > static const vshCmdOptDef opts_pool_autostart[] = { > - {.name = "pool", > - .type = VSH_OT_DATA, > - .flags = VSH_OFLAG_REQ, > - .help = N_("pool name or uuid") > - }, > + OPT_POOL_COMMON > + > {.name = "disable", > .type = VSH_OT_BOOL, > .help = N_("disable autostarting") Nice. ACK Should we do something similar to domain, network, ... in the rest of virsh? Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list