All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v2 0/8] qom: Use qlit to represent property defaults
Date: Thu, 19 Nov 2020 12:13:42 -0500	[thread overview]
Message-ID: <20201119171342.GT1509407@habkost.net> (raw)
In-Reply-To: <87eekpbjvt.fsf@dusky.pond.sub.org>

On Thu, Nov 19, 2020 at 01:39:50PM +0100, Markus Armbruster wrote:
> Eduardo Habkost <ehabkost@redhat.com> writes:
> 
> > Based-on: 20201104160021.2342108-1-ehabkost@redhat.com
> > Git branch: https://gitlab.com/ehabkost/qemu/-/commits/work/qdev-qlit-defaults
> >
> > This extend qlit.h to support all QNum types (signed int,
> > unsigned int, and double), and use QLitObject to represent field
> > property defaults.
> >
> > It allows us to get rid of most type-specific .set_default_value
> > functions for QOM property types.
> 
> What's left?

Enums.  Enums properties are a mess to implement, and I plan to
tackle them later.

On all other cases, the external representation of the property
value is similar to the internal representation.  In the case of
enums, the external representation is a string, but the internal
representation is an integer.

> 
> I'm asking because if you create a new way to get rid of most of an old
> way, you're still left with two ways, which may or may not be an
> improvement.

I don't think this is an accurate description.  We had five
different ways of doing this[1].  I replaced four of them with
the new qlit-based mechanism, and now we have two.


[1] The five different ways were:
    qdev_propinfo_set_default_value_enum,
    qdev_propinfo_set_default_value_int,
    qdev_propinfo_set_default_value_uint,
    set_default_uuid_auto, and
    set_default_value_bool.

> 
> Moving defaults from code to data sounds attractive to me.  Data is
> easier to reason about than code.  For QAPI, we've been talking about
> defining defaults in the schema for a long time, but nobody has gotten
> around to finish an implementation.

-- 
Eduardo



  reply	other threads:[~2020-11-19 17:16 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 22:41 [PATCH v2 0/8] qom: Use qlit to represent property defaults Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 1/8] qobject: Include API docs in docs/devel/qobject.html Eduardo Habkost
2020-11-17  8:23   ` Marc-André Lureau
2020-11-19  9:37   ` Markus Armbruster
2020-11-19 18:03     ` Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 2/8] qnum: Make qnum_get_double() get const pointer Eduardo Habkost
2020-11-17  8:26   ` Marc-André Lureau
2020-11-16 22:41 ` [PATCH v2 3/8] qnum: QNumValue type for QNum value literals Eduardo Habkost
2020-11-17  8:37   ` Marc-André Lureau
2020-11-17 14:42     ` Eduardo Habkost
2020-11-17 14:58       ` Marc-André Lureau
2020-11-19 10:24         ` Markus Armbruster
2020-11-19 18:21           ` Eduardo Habkost
2020-11-19 20:55             ` Eduardo Habkost
2020-11-20  9:05               ` Markus Armbruster
2020-11-20  5:29             ` Markus Armbruster
2020-11-20 18:27               ` Eduardo Habkost
2020-11-23  7:51                 ` Markus Armbruster
2020-11-23 18:33                   ` Eduardo Habkost
2020-11-24  8:49                     ` Markus Armbruster
2020-11-24 14:41                       ` Eduardo Habkost
2020-11-24 15:20                         ` Markus Armbruster
2020-11-24 15:29                           ` Eduardo Habkost
2020-11-25  6:40                             ` Markus Armbruster
2020-11-25 15:01                               ` Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 4/8] qnum: qnum_value_is_equal() function Eduardo Habkost
2020-11-17  8:42   ` Marc-André Lureau
2020-11-17 15:49     ` Eduardo Habkost
2020-11-17 16:53       ` Marc-André Lureau
2020-11-17 17:21         ` Eduardo Habkost
2020-11-19 10:27   ` Markus Armbruster
2020-11-19 18:24     ` Eduardo Habkost
2020-11-20  6:52       ` Markus Armbruster
2020-11-20 18:22         ` Eduardo Habkost
2020-11-23  8:17           ` Markus Armbruster
2020-11-16 22:41 ` [PATCH v2 5/8] qlit: Support all types of QNums Eduardo Habkost
2020-11-17  8:52   ` Marc-André Lureau
2020-11-19 10:39     ` Markus Armbruster
2020-11-19 18:56       ` Eduardo Habkost
2020-11-20  6:55         ` Markus Armbruster
2020-11-16 22:41 ` [PATCH v2 6/8] qlit: qlit_type() function Eduardo Habkost
2020-11-17  8:53   ` Marc-André Lureau
2020-11-19 10:41   ` Markus Armbruster
2020-11-19 17:56     ` Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 7/8] qom: Make object_property_set_default() public Eduardo Habkost
2020-11-17  8:56   ` Marc-André Lureau
2020-11-16 22:41 ` [PATCH v2 8/8] qom: Use qlit to represent property defaults Eduardo Habkost
2020-11-17  9:02   ` Marc-André Lureau
2020-11-19 12:39 ` [PATCH v2 0/8] " Markus Armbruster
2020-11-19 17:13   ` Eduardo Habkost [this message]
2020-11-19 17:23     ` Paolo Bonzini
2020-11-19 17:55       ` Eduardo Habkost
2020-11-19 18:25         ` Paolo Bonzini
2020-11-19 19:05           ` Eduardo Habkost

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=20201119171342.GT1509407@habkost.net \
    --to=ehabkost@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.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.