From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAxFC-0001Ba-Bg for qemu-devel@nongnu.org; Tue, 13 Jan 2015 03:54:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YAxF9-0001T6-3b for qemu-devel@nongnu.org; Tue, 13 Jan 2015 03:54:34 -0500 Received: from mail-wg0-x235.google.com ([2a00:1450:400c:c00::235]:49405) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAxF8-0001Sv-TL for qemu-devel@nongnu.org; Tue, 13 Jan 2015 03:54:31 -0500 Received: by mail-wg0-f53.google.com with SMTP id x13so1533441wgg.12 for ; Tue, 13 Jan 2015 00:54:29 -0800 (PST) Date: Tue, 13 Jan 2015 09:54:25 +0100 From: Marc =?UTF-8?B?TWFyw60=?= Message-ID: <20150113095425.63defa1a@crunchbang> In-Reply-To: <1421120079-987-2-git-send-email-jsnow@redhat.com> References: <1421120079-987-1-git-send-email-jsnow@redhat.com> <1421120079-987-2-git-send-email-jsnow@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 01/14] libqos: Split apart pc_alloc_init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: kwolf@redhat.com, mreitz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com El Mon, 12 Jan 2015 22:34:26 -0500 John Snow escribi=C3=B3: > Move the list-specific initialization over into > malloc.c, to keep all of the list implementation > details within the same file. >=20 > The allocation and freeing of these structures are > now both back within the same layer. >=20 > Signed-off-by: John Snow > --- > tests/libqos/malloc-pc.c | 20 ++++---------------- > tests/libqos/malloc.c | 17 +++++++++++++++++ > tests/libqos/malloc.h | 1 + > 3 files changed, 22 insertions(+), 16 deletions(-) >=20 > diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c > index c9c48fd..36a0740 100644 > --- a/tests/libqos/malloc-pc.c > +++ b/tests/libqos/malloc-pc.c > @@ -32,31 +32,19 @@ void pc_alloc_uninit(QGuestAllocator *allocator) > =20 > QGuestAllocator *pc_alloc_init_flags(QAllocOpts flags) > { > - QGuestAllocator *s =3D g_malloc0(sizeof(*s)); > + QGuestAllocator *s; > uint64_t ram_size; > QFWCFG *fw_cfg =3D pc_fw_cfg_init(); > - MemBlock *node; > + > + ram_size =3D qfw_cfg_get_u64(fw_cfg, FW_CFG_RAM_SIZE); > + s =3D alloc_init(1 << 20, MIN(ram_size, 0xE0000000)); > =20 > s->opts =3D flags; > s->page_size =3D PAGE_SIZE; Is there a reason to leave page_size out of the function? (flags is considered in a patch later, ok). I think it would be interesting to have both, so pc_alloc_init_flags can forget about the fields in QGuestAllocator. Thanks Marc