From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aORf5-00007q-6A for qemu-devel@nongnu.org; Wed, 27 Jan 2016 10:05:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aORez-0002xJ-1K for qemu-devel@nongnu.org; Wed, 27 Jan 2016 10:05:35 -0500 Received: from greensocs.com ([193.104.36.180]:50422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aORey-0002wt-Km for qemu-devel@nongnu.org; Wed, 27 Jan 2016 10:05:28 -0500 References: From: KONRAD Frederic Message-ID: <56A8DCB1.5070705@greensocs.com> Date: Wed, 27 Jan 2016 16:05:21 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 01/16] memory: Allow subregions to not be printed by info mtree List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alistair Francis , qemu-devel@nongnu.org Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, crosthwaitepeter@gmail.com, afaerber@suse.de, edgar.iglesias@gmail.com Le 19/01/2016 23:34, Alistair Francis a =E9crit : > Add a function called memory_region_add_subregion_no_print() that > creates memory subregions that won't be printed when running > the 'info mtree' command. > > Signed-off-by: Alistair Francis > --- > > include/exec/memory.h | 17 +++++++++++++++++ > memory.c | 10 +++++++++- > 2 files changed, 26 insertions(+), 1 deletion(-) > > diff --git a/include/exec/memory.h b/include/exec/memory.h > index 01f1004..eff2a89 100644 > --- a/include/exec/memory.h > +++ b/include/exec/memory.h > @@ -186,6 +186,7 @@ struct MemoryRegion { > bool skip_dump; > bool enabled; > bool warning_printed; /* For reservations */ > + bool do_not_print; > uint8_t vga_logging_count; > MemoryRegion *alias; > hwaddr alias_offset; > @@ -952,6 +953,22 @@ void memory_region_del_eventfd(MemoryRegion *mr, > void memory_region_add_subregion(MemoryRegion *mr, > hwaddr offset, > MemoryRegion *subregion); > + > +/** > + * memory_region_add_subregion_no_print: Add a subregion to a containe= r. > + * > + * The same functionality as memory_region_add_subregion except that a= ny > + * memory regions added by this function are not printed by 'info mtre= e'. > + * > + * @mr: the region to contain the new subregion; must be a container > + * initialized with memory_region_init(). > + * @offset: the offset relative to @mr where @subregion is added. > + * @subregion: the subregion to be added. > + */ > +void memory_region_add_subregion_no_print(MemoryRegion *mr, > + hwaddr offset, > + MemoryRegion *subregion); > + > /** > * memory_region_add_subregion_overlap: Add a subregion to a containe= r > * with overlap. > diff --git a/memory.c b/memory.c > index 93bd8ed..ee90682 100644 > --- a/memory.c > +++ b/memory.c > @@ -1827,6 +1827,14 @@ void memory_region_add_subregion(MemoryRegion *m= r, > memory_region_add_subregion_common(mr, offset, subregion); > } > =20 > +void memory_region_add_subregion_no_print(MemoryRegion *mr, > + hwaddr offset, > + MemoryRegion *subregion) > +{ > + memory_region_add_subregion(mr, offset, subregion); > + subregion->do_not_print =3D true; > +} > + > void memory_region_add_subregion_overlap(MemoryRegion *mr, > hwaddr offset, > MemoryRegion *subregion, > @@ -2190,7 +2198,7 @@ static void mtree_print_mr(fprintf_function mon_p= rintf, void *f, > const MemoryRegion *submr; > unsigned int i; > =20 > - if (!mr) { > + if (!mr || mr->do_not_print) { > return; > } > =20 Seems OK to me. Reviewed-by: KONRAD Frederic