qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: peter.crosthwaite@xilinx.com, qemu-devel@nongnu.org, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH 0/4] qom: Replace "automatic arrayification"
Date: Fri, 14 Nov 2014 15:25:13 +0100	[thread overview]
Message-ID: <546610C9.3060706@redhat.com> (raw)
In-Reply-To: <87a93t3lsd.fsf@blackfin.pond.sub.org>



On 14/11/2014 15:21, Markus Armbruster wrote:
> qdev properties can easily use object_gen_new_property_name() instead,
> as shown in PATCH 3/4.
> 
> So can memory regions [PATCH 2/4], but only because we clumsily arrayify
> all of them, by appending "[*]" in memory_region_init().
> 
> Some day, we may want to arrayify only the ones that actually need it,
> by appending "[*]" right to their names instead of appending it behind
> the scenes to all memory region names.
> 
> This would involve touching the untouchables: non-qdevified devices.
> But the changes should be limited to string literals.
> 
> With my series, you'd have to graft in object_gen_new_property_name()
> and the matching g_free() instead.  You called that "just too ugly".
> 
> Here's how to avoid it, and confine the ugliness to
> memory_region_init():
> 
> Change memory_region_init() from
> 
>         char *escaped_name = memory_region_escape_name(name);
>         char *propname = object_gen_new_property_name(owner, escaped_name);
>         object_property_add_child(owner, propname, OBJECT(mr), &error_abort);
>         object_unref(OBJECT(mr));
>         g_free(propname);
>         g_free(escaped_name);
> 
> to something like
> 
>         if (name ends with "[*]") {
>             stem = g_strndup(name, strlen(name) -3);
>             escaped = memory_region_escape_name(stem);
>             propname = object_gen_new_property_name(owner, escaped_name);
>             g_free(escaped);
>             g_free(stem);
>         else
>             propname = memory_region_escape_name(name);
>         object_property_add_child(owner, propname, OBJECT(mr), &error_abort);
>         object_unref(OBJECT(mr));
>         g_free(propname);
> 
> and append "[*]" to the names of regions that need "arrayification".
> 
> That way, the bad magic is limited to just memory_region_init() rather
> than all of QOM, and it's needed "only" as long as the problem with
> non-qdevified users remains.

Yes, I agree.

Whether it's an improvement to move back the special-casing of "[*]" to
memory_region_init(), that's of course in the eye of the beholder. ;)
We do know that it's very unlikely to be removed from memory regions.

Paolo

  reply	other threads:[~2014-11-14 14:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12 17:08 [Qemu-devel] [PATCH 0/4] qom: Replace "automatic arrayification" Markus Armbruster
2014-11-12 17:08 ` [Qemu-devel] [PATCH 1/4] qom: New object_gen_new_property_name() Markus Armbruster
2014-11-12 17:08 ` [Qemu-devel] [PATCH 2/4] memory: Use object_gen_new_property_name() instead of "arrayification" Markus Armbruster
2014-11-12 17:08 ` [Qemu-devel] [PATCH 3/4] qdev: " Markus Armbruster
2014-11-12 17:08 ` [Qemu-devel] [PATCH 4/4] Revert "qom: Add automatic arrayification to object_property_add()" Markus Armbruster
2014-11-12 17:14   ` Andreas Färber
2014-11-12 22:25     ` Paolo Bonzini
2014-11-12 22:47       ` Peter Maydell
2014-11-13 10:05         ` Paolo Bonzini
2014-11-13 10:50           ` Peter Maydell
2014-11-12 17:13 ` [Qemu-devel] [PATCH 0/4] qom: Replace "automatic arrayification" Paolo Bonzini
2014-11-13  8:08   ` Markus Armbruster
2014-11-13 10:08     ` Paolo Bonzini
2014-11-13 14:34       ` Markus Armbruster
2014-11-13 14:39         ` Paolo Bonzini
2014-11-14 14:21           ` Markus Armbruster
2014-11-14 14:25             ` Paolo Bonzini [this message]
2014-11-14 15:10               ` Markus Armbruster

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=546610C9.3060706@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=armbru@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).