From: Anthony Liguori <anthony@codemonkey.ws>
To: "Crístian Viana" <vianac@linux.vnet.ibm.com>,
"QEMU Development ML" <qemu-devel@nongnu.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [Qemu-devel] [PATCH v5 1/3] Check if GlobalProperty exists before registering
Date: Wed, 11 Jul 2012 12:52:41 -0500 [thread overview]
Message-ID: <87r4si2niu.fsf@codemonkey.ws> (raw)
In-Reply-To: <1340733111-9166-1-git-send-email-vianac@linux.vnet.ibm.com>
Crístian Viana <vianac@linux.vnet.ibm.com> writes:
> If a GlobalProperty has already been registered, it won't have its
> value overwritten.
>
> Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
> ---
>
> Changes since v4:
> - Only register a GlobalProperty if it hasn't already been registered. That
> avoids the property values to be overwritten (fix previous known bug).
>
> hw/qdev-properties.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
> index 099a7aa..fda94dd 100644
> --- a/hw/qdev-properties.c
> +++ b/hw/qdev-properties.c
> @@ -1105,6 +1105,14 @@ static QTAILQ_HEAD(, GlobalProperty) global_props = QTAILQ_HEAD_INITIALIZER(glob
>
> static void qdev_prop_register_global(GlobalProperty *prop)
> {
> + GlobalProperty *p;
> +
> + QTAILQ_FOREACH(p, &global_props, next) {
> + if (strcmp(prop->driver, p->driver) == 0) {
> + return;
> + }
> + }
> +
> QTAILQ_INSERT_TAIL(&global_props, prop, next);
> }
This is relying on a very subtle characteristic: that -global properties
are registered before machine options. We probably need to be more
explicit about who we want to win. In the very least, you should add a
comment here that says this check is specifically to allow -global to
"win" over machine options.
Regards,
Anthony Liguori
>
> --
> 1.7.9.5
next parent reply other threads:[~2012-07-11 17:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1340733111-9166-1-git-send-email-vianac@linux.vnet.ibm.com>
2012-07-11 17:52 ` Anthony Liguori [this message]
[not found] ` <1340733111-9166-2-git-send-email-vianac@linux.vnet.ibm.com>
2012-07-11 17:53 ` [Qemu-devel] [PATCH v5 2/3] Force driftfix=none on previous machines Anthony Liguori
[not found] ` <1340733111-9166-3-git-send-email-vianac@linux.vnet.ibm.com>
2012-07-11 17:54 ` [Qemu-devel] [PATCH v5 3/3] Change driftfix default value to slew Anthony Liguori
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=87r4si2niu.fsf@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=vianac@linux.vnet.ibm.com \
/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.