From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFn4A-0005Xe-Mw for qemu-devel@nongnu.org; Wed, 13 Mar 2013 10:54:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFn44-0000rj-4l for qemu-devel@nongnu.org; Wed, 13 Mar 2013 10:54:06 -0400 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:33368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFn43-0000r8-Kr for qemu-devel@nongnu.org; Wed, 13 Mar 2013 10:54:00 -0400 Received: from /spool/local by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Mar 2013 00:47:38 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 91C7A357804E for ; Thu, 14 Mar 2013 01:53:47 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r2DEf1uC59375798 for ; Thu, 14 Mar 2013 01:41:02 +1100 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r2DErkrg018510 for ; Thu, 14 Mar 2013 01:53:46 +1100 From: Anthony Liguori In-Reply-To: <20130313134428.GH2309@dhcp-200-207.str.redhat.com> References: <1362491612-19226-1-git-send-email-aliguori@us.ibm.com> <1362491612-19226-9-git-send-email-aliguori@us.ibm.com> <20130313134428.GH2309@dhcp-200-207.str.redhat.com> Date: Wed, 13 Mar 2013 09:53:41 -0500 Message-ID: <874ngfl5ai.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [RFC PATCH 8/8] libqos: add malloc List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Kevin Wolf writes: > Am 05.03.2013 um 14:53 hat Anthony Liguori geschrieben: >> Signed-off-by: Anthony Liguori > >> --- /dev/null >> +++ b/tests/libqos/malloc.h >> @@ -0,0 +1,26 @@ >> +#ifndef LIBQOS_MALLOC_H >> +#define LIBQOS_MALLOC_H >> + >> +#include >> +#include >> + >> +typedef struct QGuestAllocator QGuestAllocator; >> + >> +struct QGuestAllocator >> +{ >> + uint64_t (*alloc)(QGuestAllocator *allocator, size_t size); >> + void (*free)(QGuestAllocator *allocator, uint64_t addr); >> +}; >> + >> +/* Always returns page aligned values */ >> +static inline uint64_t guest_alloc(QGuestAllocator *allocator, size_t size) >> +{ >> + return allocator->alloc(allocator, size); >> +} >> + >> +static inline void guest_free(QGuestAllocator *allocator, uint64_t addr) >> +{ >> + allocator->alloc(allocator, addr); >> +} > > I think the common case is using exactly one global allocator. Maybe > worth convenience macros like in libqtest.h? Definitely. Regard, Anthony Liguori > > Kevin