From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"David Hildenbrand" <david@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Peter Xu" <peterx@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH v4 2/3] memory: Extract mtree_info_as() from mtree_info()
Date: Wed, 1 Sep 2021 18:19:42 +0200 [thread overview]
Message-ID: <20210901161943.4174212-3-philmd@redhat.com> (raw)
In-Reply-To: <20210901161943.4174212-1-philmd@redhat.com>
While mtree_info() handles both ASes and flatviews cases,
the two cases share basically no code. Split mtree_info_as()
out of mtree_info() to simplify.
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
softmmu/memory.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 3eb6f52de67..5be7d5e7412 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -3284,18 +3284,12 @@ static void mtree_info_flatview(bool dispatch_tree, bool owner)
g_hash_table_unref(views);
}
-void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled)
+static void mtree_info_as(bool dispatch_tree, bool owner, bool disabled)
{
MemoryRegionListHead ml_head;
MemoryRegionList *ml, *ml2;
AddressSpace *as;
- if (flatview) {
- mtree_info_flatview(dispatch_tree, owner);
-
- return;
- }
-
QTAILQ_INIT(&ml_head);
QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
@@ -3316,6 +3310,15 @@ void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled)
}
}
+void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled)
+{
+ if (flatview) {
+ mtree_info_flatview(dispatch_tree, owner);
+ } else {
+ mtree_info_as(dispatch_tree, owner, disabled);
+ }
+}
+
void memory_region_init_ram(MemoryRegion *mr,
Object *owner,
const char *name,
--
2.31.1
next prev parent reply other threads:[~2021-09-01 16:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 16:19 [PATCH v4 0/3] memory: Have 'info mtree' remove duplicated Address Space information Philippe Mathieu-Daudé
2021-09-01 16:19 ` [PATCH v4 1/3] memory: Extract mtree_info_flatview() from mtree_info() Philippe Mathieu-Daudé
2021-09-01 16:23 ` Philippe Mathieu-Daudé
2021-09-01 17:10 ` David Hildenbrand
2021-09-04 9:23 ` Richard Henderson
2021-09-01 16:19 ` Philippe Mathieu-Daudé [this message]
2021-09-01 17:11 ` [PATCH v4 2/3] memory: Extract mtree_info_as() " David Hildenbrand
2021-09-04 9:23 ` Richard Henderson
2021-09-01 16:19 ` [PATCH v4 3/3] memory: Have 'info mtree' remove duplicated Address Space information Philippe Mathieu-Daudé
2021-09-01 17:12 ` David Hildenbrand
2021-09-04 9:27 ` Richard Henderson
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=20210901161943.4174212-3-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=david@redhat.com \
--cc=kraxel@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@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 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).