[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 8/8] libqos: add malloc
From: |
Anthony Liguori |
Subject: |
Re: [Qemu-devel] [RFC PATCH 8/8] libqos: add malloc |
Date: |
Wed, 13 Mar 2013 09:53:41 -0500 |
User-agent: |
Notmuch/0.13.2+93~ged93d79 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) |
Kevin Wolf <address@hidden> writes:
> Am 05.03.2013 um 14:53 hat Anthony Liguori geschrieben:
>> Signed-off-by: Anthony Liguori <address@hidden>
>
>> --- /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
- [Qemu-devel] [RFC PATCH 0/8] libqos support, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 7/8] libqos: add fw_cfg-pc, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 4/8] pci: foreach, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 8/8] libqos: add malloc, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 2/8] i440fx-test: add test to compare default register values against spec, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 3/8] i440fx-test: add test for PAM functionality, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 6/8] libqos: fw_cfg, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 1/8] qtest: add libqos, Anthony Liguori, 2013/03/05
- Re: [Qemu-devel] [RFC PATCH 1/8] qtest: add libqos, Andreas Färber, 2013/03/13
[Qemu-devel] [RFC PATCH 5/8] fw_cfg: add qtest test harness, Anthony Liguori, 2013/03/05