[libvirt] [PATCH 03/12] virsh: Create macros for VSH_OT_STRING "domain" option

Peter Krempa pkrempa at redhat.com
Fri May 4 10:39:36 UTC 2018


On Fri, May 04, 2018 at 17:25:24 +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                | 8 ++++++++
>  4 files changed, 17 insertions(+)
> 
> diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
> index 8e071779b4..8ad651626b 100644
> --- a/tools/virsh-domain-monitor.c
> +++ b/tools/virsh-domain-monitor.c
> @@ -43,6 +43,9 @@
>  #define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
>      VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
>  
> +#define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(cflags) \
> +    VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), cflags)
> +
>  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 6601f94a12..8a63761fab 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -68,6 +68,9 @@
>  #define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
>      VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
>  
> +#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_PERSISTENT \
>      {.name = "persistent", \
>       .type = VSH_OT_BOOL, \
> diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
> index e4908eea70..3d86ac84d1 100644
> --- a/tools/virsh-snapshot.c
> +++ b/tools/virsh-snapshot.c
> @@ -45,6 +45,9 @@
>  #define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
>      VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
>  
> +#define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(cflags) \
> +    VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), cflags)

Only one of the three definitions above is actually used ...

> +
>  /* Helper for snapshot-create and snapshot-create-as */
>  static bool
>  virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, const char *buffer,
> diff --git a/tools/virsh.h b/tools/virsh.h
> index f2213ebb57..9dcf104cc4 100644
> --- a/tools/virsh.h
> +++ b/tools/virsh.h
> @@ -107,6 +107,14 @@
>       .help = _helpstr \
>      }

... since all of them share the docs string, why isn't it declared here?

>  
> +# define VIRSH_COMMON_OPT_DOMAIN_OT_STRING(_helpstr, cflags) \
> +    {.name = "domain", \
> +     .type = VSH_OT_STRING, \
> +     .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/4ab1e69f/attachment-0001.sig>


More information about the libvir-list mailing list