[libvirt] [PATCH 06/12] virsh: Create macros for VSH_OT_ARGV "domain" option

Peter Krempa pkrempa at redhat.com
Fri May 4 10:37:47 UTC 2018


On Fri, May 04, 2018 at 17:25:27 +0800, Lin Ma wrote:
> Signed-off-by: Lin Ma <lma at suse.com>
> ---
>  tools/virsh-domain-monitor.c | 3 +++
>  tools/virsh-domain.c         | 3 +++
>  tools/virsh-snapshot.c       | 3 +++
>  tools/virsh.h                | 9 +++++++++
>  4 files changed, 18 insertions(+)
> 
> diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
> index 8ad651626b..e4a21534cb 100644
> --- a/tools/virsh-domain-monitor.c
> +++ b/tools/virsh-domain-monitor.c
> @@ -46,6 +46,9 @@
>  #define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(cflags) \
>      VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), cflags)
>  
> +#define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV_FULL(cflags) \
> +    VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(N_("domain name, id or uuid"), cflags)

All of these defined here are unused (even in the other patches in this
series), so what's the point of adding them?

> +
>  VIR_ENUM_DECL(virshDomainIOError)
>  VIR_ENUM_IMPL(virshDomainIOError,
>                VIR_DOMAIN_DISK_ERROR_LAST,
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 689f9d686b..89aefbf86a 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -71,6 +71,9 @@
>  #define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(cflags) \
>      VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), cflags)
>  
> +#define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV_FULL(cflags) \
> +    VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(N_("domain name, id or uuid"), cflags)
> +
>  #define VIRSH_COMMON_OPT_DOMAIN_PERSISTENT \
>      {.name = "persistent", \
>       .type = VSH_OT_BOOL, \
> diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
> index 3d86ac84d1..0c86b6c950 100644
> --- a/tools/virsh-snapshot.c
> +++ b/tools/virsh-snapshot.c
> @@ -48,6 +48,9 @@
>  #define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(cflags) \
>      VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), cflags)
>  
> +#define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV_FULL(cflags) \
> +    VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(N_("domain name, id or uuid"), cflags)
> +
>  /* Helper for snapshot-create and snapshot-create-as */

Also all of them have the same docs string so I really don't know why we
need to define them in every file separately ...

>  static bool
>  virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, const char *buffer,
> diff --git a/tools/virsh.h b/tools/virsh.h
> index 9dcf104cc4..a33d108b2d 100644
> --- a/tools/virsh.h
> +++ b/tools/virsh.h
> @@ -115,6 +115,15 @@
>       .completer_flags = cflags, \
>      }
>  
> +# define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(_helpstr, cflags) \
> +    {.name = "domain", \
> +     .type = VSH_OT_ARGV, \
> +     .flags = VSH_OFLAG_NONE, \
> +     .help = _helpstr, \
> +     .completer = virshDomainNameCompleter, \
> +     .completer_flags = cflags, \
> +    }
> +
>  typedef struct _virshControl virshControl;
>  typedef virshControl *virshControlPtr;
>  
> -- 
> 2.15.1
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180504/0e737bf6/attachment-0001.sig>


More information about the libvir-list mailing list