From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, sw@weilnetz.de,
stefano.stabellini@eu.citrix.com
Subject: Re: [Qemu-devel] [PATCH memory v2 3/3] memory: Lazy init name from QOM name as needed
Date: Thu, 28 Aug 2014 16:06:28 +0200 [thread overview]
Message-ID: <53FF3764.20603@redhat.com> (raw)
In-Reply-To: <f978a4677b36b0505994ae4d5b5c91efe090b6bd.1409018983.git.peter.crosthwaite@xilinx.com>
Il 26/08/2014 05:10, Peter Crosthwaite ha scritto:
> To support name retrieval of MemoryRegions that were created
> dynamically (that is, not via memory_region_init and friends). We
> cache the name in MemoryRegion's state as
> object_get_canonical_path_component mallocs the returned value
> so it's not suitable for direct return to callers. Memory already
> frees the name field, so this will be garbage collected along with
> the MR object.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
>
> memory.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/memory.c b/memory.c
> index 42317a2..fc16e5f 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -914,7 +914,6 @@ void memory_region_init(MemoryRegion *mr,
> if (size == UINT64_MAX) {
> mr->size = int128_2_64();
> }
> - mr->name = g_strdup(name);
This causes a bunch of [0] to appear in the "info mtree" output.
They're a bit ugly, so I'm removing this line for now.
Paolo
> if (name) {
> object_property_add_child_array(owner, name, OBJECT(mr));
> @@ -1309,6 +1308,10 @@ uint64_t memory_region_size(MemoryRegion *mr)
>
> const char *memory_region_name(const MemoryRegion *mr)
> {
> + if (!mr->name) {
> + ((MemoryRegion *)mr)->name =
> + object_get_canonical_path_component(OBJECT(mr));
> + }
> return mr->name;
> }
>
>
next prev parent reply other threads:[~2014-08-28 14:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-26 3:08 [Qemu-devel] [PATCH memory v2 0/3] Memory Region Naming - take 2 Peter Crosthwaite
2014-08-26 3:09 ` [Qemu-devel] [PATCH memory v2 1/3] xen-hvm: Constify string Peter Crosthwaite
2014-08-26 5:37 ` Stefan Weil
2014-08-26 3:09 ` [Qemu-devel] [PATCH memory v2 2/3] xen: hvm: Abstract away memory region name ref Peter Crosthwaite
2014-08-26 3:10 ` [Qemu-devel] [PATCH memory v2 3/3] memory: Lazy init name from QOM name as needed Peter Crosthwaite
2014-08-26 12:51 ` Paolo Bonzini
2014-08-28 14:06 ` Paolo Bonzini [this message]
2014-08-28 14:27 ` Peter Crosthwaite
2014-08-28 14:57 ` Paolo Bonzini
2014-08-28 23:17 ` Peter Crosthwaite
2014-09-03 0:17 ` [Qemu-devel] [PATCH memory v2 0/3] Memory Region Naming - take 2 Stefano Stabellini
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=53FF3764.20603@redhat.com \
--to=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=sw@weilnetz.de \
/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).