From: Marcel Apfelbaum <marcel.a@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: peter.crosthwaite@xilinx.com, mst@redhat.com,
qemu-devel@nongnu.org, anthony@codemonkey.ws,
imammedo@redhat.com, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qom: add object_property_is_set
Date: Wed, 19 Feb 2014 09:11:36 +0200 [thread overview]
Message-ID: <1392793896.3076.21.camel@localhost.localdomain> (raw)
In-Reply-To: <53039D3C.8050802@suse.de>
On Tue, 2014-02-18 at 18:49 +0100, Andreas Färber wrote:
> Am 18.02.2014 18:26, schrieb Paolo Bonzini:
> > Il 18/02/2014 18:11, Marcel Apfelbaum ha scritto:
> >> It is used to replace qemu_opt_get_bool that provides a
> >> parameter for a default value. In this case we need to
> >> differentiate "no value" from "false."
> >
> > But what would the getter return in that case? If possible, it's better
> > to initialize to the default value in an instance_init method.
>
> Another issue I see is that it's currently a valid use case to use a
> setter in instance_init to set default values. Doing so would flag the
> property as set with this patch.
Hi Andreas, thank you for the review!
As I replayed to Paolo, this does not contradict the patch's aim.
Meaning, if you have a default for all cases, is ok to init it and make
it "set". The interesting case is if you have 2 places: one that you want
the value to be "x" if is not set, and other place that you need "y" if
is not set.
>
> To me it sounded like a concept similar to component-oriented IDEs where
> non-default values are shown in bold. We'd need a QMP API for that
> however, and we'd need to reset properties in instance_post_init to
> unset then (globals would be considered unset in that case).
I thought about it, but it seemed to me over-engineering *for my case*,
where all I need to know if the user supplied the value or not,
not need to "unset" it.
>
> Another aspect is that dynamic properties are slightly awkward, if we
> think of setting the rtc, which then advances and reads back differently.
Sadly I am not familiar with the "rtc", but as I explained before,
I don't need the "repeatedly set/unset" use-case.
Thanks,
Marcel
>
> Regards,
> Andreas
>
next prev parent reply other threads:[~2014-02-19 7:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-18 16:46 [Qemu-devel] [PATCH] qom: add object_property_is_set Marcel Apfelbaum
2014-02-18 16:51 ` Paolo Bonzini
2014-02-18 17:11 ` Marcel Apfelbaum
2014-02-18 17:26 ` Paolo Bonzini
2014-02-18 17:49 ` Andreas Färber
2014-02-19 7:11 ` Marcel Apfelbaum [this message]
2014-02-19 7:03 ` Marcel Apfelbaum
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=1392793896.3076.21.camel@localhost.localdomain \
--to=marcel.a@redhat.com \
--cc=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).