All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Lin Ma <lma@suse.com>,
	pbonzini@redhat.com, qemu-devel@nongnu.org, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH v4 4/5] backends: add description for enum class properties
Date: Mon, 7 Nov 2016 16:09:48 +0000	[thread overview]
Message-ID: <20161107160948.GA19422@redhat.com> (raw)
In-Reply-To: <87eg2suygy.fsf@dusky.pond.sub.org>

On Thu, Nov 03, 2016 at 08:58:53PM +0100, Markus Armbruster wrote:
> Lin Ma <lma@suse.com> writes:
> 
> > Signed-off-by: Lin Ma <lma@suse.com>
> > ---
> >  backends/hostmem.c | 4 ++++
> >  crypto/secret.c    | 4 ++++
> >  crypto/tlscreds.c  | 4 ++++
> >  net/filter.c       | 4 ++++
> >  4 files changed, 16 insertions(+)
> >
> > diff --git a/backends/hostmem.c b/backends/hostmem.c
> > index 4256d24..25f303d 100644
> > --- a/backends/hostmem.c
> > +++ b/backends/hostmem.c
> > @@ -377,6 +377,10 @@ host_memory_backend_class_init(ObjectClass *oc, void *data)
> >          HostMemPolicy_lookup,
> >          host_memory_backend_get_policy,
> >          host_memory_backend_set_policy, &error_abort);
> > +    object_class_property_set_description(oc, "policy",
> > +                                    "Data format: one of "
> > +                                    HostMemPolicy_value_str,
> > +                                    &error_abort);
> >  }
> >  
> >  static const TypeInfo host_memory_backend_info = {
> > diff --git a/crypto/secret.c b/crypto/secret.c
> > index 285ab7a..71d06e3 100644
> > --- a/crypto/secret.c
> > +++ b/crypto/secret.c
> > @@ -382,6 +382,10 @@ qcrypto_secret_class_init(ObjectClass *oc, void *data)
> >                                     qcrypto_secret_prop_get_format,
> >                                     qcrypto_secret_prop_set_format,
> >                                     NULL);
> > +    object_class_property_set_description(oc, "format",
> > +                                          "Data format: one of "
> > +                                          QCryptoSecretFormat_value_str,
> > +                                          &error_abort);
> >      object_class_property_add_str(oc, "data",
> >                                    qcrypto_secret_prop_get_data,
> >                                    qcrypto_secret_prop_set_data,
> > diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
> > index a896553..d3af38a 100644
> > --- a/crypto/tlscreds.c
> > +++ b/crypto/tlscreds.c
> > @@ -237,6 +237,10 @@ qcrypto_tls_creds_class_init(ObjectClass *oc, void *data)
> >                                     qcrypto_tls_creds_prop_get_endpoint,
> >                                     qcrypto_tls_creds_prop_set_endpoint,
> >                                     NULL);
> > +    object_class_property_set_description(oc, "endpoint",
> > +                                          "Data format: one of "
> > +                                          QCryptoTLSCredsEndpoint_value_str,
> > +                                          &error_abort);
> >      object_class_property_add_str(oc, "priority",
> >                                    qcrypto_tls_creds_prop_get_priority,
> >                                    qcrypto_tls_creds_prop_set_priority,
> > diff --git a/net/filter.c b/net/filter.c
> > index 1dfd2ca..205fb49 100644
> > --- a/net/filter.c
> > +++ b/net/filter.c
> > @@ -182,6 +182,10 @@ static void netfilter_init(Object *obj)
> >                               NetFilterDirection_lookup,
> >                               netfilter_get_direction, netfilter_set_direction,
> >                               NULL);
> > +    object_property_set_description(obj, "queue",
> > +                                    "Data format: one of "
> > +                                    NetFilterDirection_value_str,
> > +                                    &error_abort);
> >      object_property_add_str(obj, "status",
> >                              netfilter_get_status, netfilter_set_status,
> >                              NULL);
> 
> After  each
> 
>     object_class_property_add_enum(OC, PROP_NAME", ENUM_NAME, ...);
> 
> you add
> 
>     object_class_property_set_description(OC, PROP_NAME,
>                                           "Data format: one of "
>                                           ENUM_NAME_value_str,
>                                           &error_abort);
> 
> Whenever somebody adds another object_class_property_add_enum(), he
> should also add an object_class_property_set_description().  Easily
> forgotten.
> 
> Why not do it in object_class_property_add_enum() automatically?
> We got strings[] there...

We could make every single object_property_add_* method accept a
description, but it'd be a huge code-churn to retrofit.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

  parent reply	other threads:[~2016-11-07 16:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-20 11:28 [Qemu-devel] [PATCH v4 0/5] object: Add 'help' option for all available backends and properties Lin Ma
2016-10-20 11:28 ` [Qemu-devel] [PATCH v4 1/5] qom: Add interface check in object_class_is_abstract Lin Ma
2016-11-03  5:19   ` [Qemu-devel] 答复: " Lin Ma
2016-11-03 18:18   ` [Qemu-devel] " Markus Armbruster
2016-11-07  9:19     ` [Qemu-devel] 答复: " Lin Ma
2016-10-20 11:28 ` [Qemu-devel] [PATCH v4 2/5] qapi: auto generate enum value strings Lin Ma
2016-11-03  5:19   ` [Qemu-devel] 答复: " Lin Ma
2016-11-03 19:17   ` [Qemu-devel] " Markus Armbruster
2016-11-07 15:41     ` [Qemu-devel] 答复: " Lin Ma
2016-10-20 11:28 ` [Qemu-devel] [PATCH v4 3/5] qapi: add test case for the generated enum value str Lin Ma
2016-11-03  5:19   ` [Qemu-devel] 答复: " Lin Ma
2016-10-20 11:28 ` [Qemu-devel] [PATCH v4 4/5] backends: add description for enum class properties Lin Ma
2016-11-03  5:19   ` [Qemu-devel] 答复: " Lin Ma
2016-11-03 19:58   ` [Qemu-devel] " Markus Armbruster
2016-11-07 15:54     ` [Qemu-devel] 答复: " Lin Ma
2016-11-07 16:09     ` Daniel P. Berrange [this message]
2016-10-20 11:28 ` [Qemu-devel] [PATCH v4 5/5] object: Add 'help' option for all available backends and properties Lin Ma
2016-11-03  5:19   ` [Qemu-devel] 答复: " Lin Ma
2016-11-03 19:50   ` [Qemu-devel] " Markus Armbruster
2016-11-07 16:17     ` [Qemu-devel] 答复: " Lin Ma
2016-11-03  5:19 ` [Qemu-devel] 答复: [PATCH v4 0/5] " Lin Ma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161107160948.GA19422@redhat.com \
    --to=berrange@redhat.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=lma@suse.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.