[libvirt] [PATCH 1/8] virsh: Create macro for common "domain" option

John Ferlan jferlan at redhat.com
Fri Dec 18 11:45:20 UTC 2015



On 12/18/2015 03:31 AM, Erik Skultety wrote:
> On 17/12/15 17:55, John Ferlan wrote:
>> Rather than continually cut-n-paste the strings into each command,
>> create a common macro to be used generically.  Note that not all
>> '{.name = "domain",' entries are replaced, just those that have the
>> common .help string of "domain name, id or uuid" and those that are
>> required.
>>
>> Other instances won't take all 3 options, but some subset of those
>> options as directed by the virshCommandOptDomainBy flags argument or
>> in some instances where the domain is not a required option.
>>
>> Signed-off-by: John Ferlan <jferlan at redhat.com>
>> ---
>>  tools/virsh-domain.c | 450 +++++++++------------------------------------------
>>  1 file changed, 80 insertions(+), 370 deletions(-)
>>
>> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
>> index 7650535..e766ec4 100644
>> --- a/tools/virsh-domain.c
>> +++ b/tools/virsh-domain.c
>> @@ -63,6 +63,12 @@
>>  # define SA_SIGINFO 0
>>  #endif
>>  
>> +#define VSH_DOMAIN_OPT_COMMON                          \
>> +    {.name = "domain",                                 \
>> +     .type = VSH_OT_DATA,                              \
>> +     .flags = VSH_OFLAG_REQ,                           \
>> +     .help = N_("domain name, id or uuid")             \
>> +    }                                                  \
>>
> 
> Since generic 'vsh.c' module introduction in commit 834c5720, we prefix
> macros/constants/methods with VIRSH/virsh within all virsh modules.
> 
> 

OK - not a problem to change/convert... I'll have to also do the same
for virsh-pool.c too.  I use the VSH_ prefix on advice from review of
that series:

http://www.redhat.com/archives/libvir-list/2015-December/msg00675.html

John




More information about the libvir-list mailing list