All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH 8/8] libqos: add malloc
Date: Wed, 13 Mar 2013 09:53:41 -0500	[thread overview]
Message-ID: <874ngfl5ai.fsf@codemonkey.ws> (raw)
In-Reply-To: <20130313134428.GH2309@dhcp-200-207.str.redhat.com>

Kevin Wolf <kwolf@redhat.com> writes:

> Am 05.03.2013 um 14:53 hat Anthony Liguori geschrieben:
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
>> --- /dev/null
>> +++ b/tests/libqos/malloc.h
>> @@ -0,0 +1,26 @@
>> +#ifndef LIBQOS_MALLOC_H
>> +#define LIBQOS_MALLOC_H
>> +
>> +#include <stdint.h>
>> +#include <sys/types.h>
>> +
>> +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

  reply	other threads:[~2013-03-13 14:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05 13:53 [Qemu-devel] [RFC PATCH 0/8] libqos support Anthony Liguori
2013-03-05 13:53 ` [Qemu-devel] [RFC PATCH 1/8] qtest: add libqos Anthony Liguori
2013-03-13 11:26   ` Kevin Wolf
2013-03-13 14:03     ` Anthony Liguori
2013-03-28 11:41       ` Kevin Wolf
2013-03-29  2:26         ` Anthony Liguori
2013-04-09  9:15           ` Kevin Wolf
2013-03-13 12:11   ` Andreas Färber
2013-03-05 13:53 ` [Qemu-devel] [RFC PATCH 2/8] i440fx-test: add test to compare default register values against spec Anthony Liguori
2013-03-05 13:53 ` [Qemu-devel] [RFC PATCH 3/8] i440fx-test: add test for PAM functionality Anthony Liguori
2013-03-05 13:53 ` [Qemu-devel] [RFC PATCH 4/8] pci: foreach Anthony Liguori
2013-03-05 13:53 ` [Qemu-devel] [RFC PATCH 5/8] fw_cfg: add qtest test harness Anthony Liguori
2013-03-05 13:53 ` [Qemu-devel] [RFC PATCH 6/8] libqos: fw_cfg Anthony Liguori
2013-03-05 13:53 ` [Qemu-devel] [RFC PATCH 7/8] libqos: add fw_cfg-pc Anthony Liguori
2013-03-05 13:53 ` [Qemu-devel] [RFC PATCH 8/8] libqos: add malloc Anthony Liguori
2013-03-13 13:44   ` Kevin Wolf
2013-03-13 14:53     ` Anthony Liguori [this message]
2013-03-05 14:15 ` [Qemu-devel] [RFC PATCH 0/8] libqos support Stefan Hajnoczi
2013-03-05 14:59   ` Anthony Liguori
2013-04-22 18:38 ` Anthony Liguori

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=874ngfl5ai.fsf@codemonkey.ws \
    --to=aliguori@us.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.