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
On 01.09.21 18:19, Philippe Mathieu-Daudé wrote:
> 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,
>
Reviewed-by: David Hildenbrand <david@redhat.com>
I'd just have squashed that into #1.
--
Thanks,
David / dhildenb
On 9/1/21 7:11 PM, David Hildenbrand wrote:
> On 01.09.21 18:19, Philippe Mathieu-Daudé wrote:
>> 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,
>>
>
> Reviewed-by: David Hildenbrand <david@redhat.com>
>
> I'd just have squashed that into #1.
Agreed, it seems like all part of one change. Anyway,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
© 2016 - 2026 Red Hat, Inc.