[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1 01/17] qemu/obj_pool.h: introduce object allo
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v1 01/17] qemu/obj_pool.h: introduce object allocation pool |
Date: |
Tue, 05 Aug 2014 06:21:55 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 |
On 08/05/2014 06:05 AM, Michael S. Tsirkin wrote:
> On Tue, Aug 05, 2014 at 05:55:49AM -0600, Eric Blake wrote:
>> On 08/04/2014 09:33 PM, Ming Lei wrote:
>>> This patch introduces object allocation pool for speeding up
>>> object allocation in fast path.
>>>
>>> Signed-off-by: Ming Lei <address@hidden>
>>> ---
>>> include/qemu/obj_pool.h | 64
>>> +++++++++++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 64 insertions(+)
>>> create mode 100644 include/qemu/obj_pool.h
>>>
>>> +
>>> + char *objs;
>>> +} ObjPool;
>>> +
>>> +static inline void obj_pool_init(ObjPool *op, void *objs_buf, void
>>> **free_objs,
>>> + unsigned int obj_size, unsigned cnt)
>>> +{
>>> + int i;
>>> +
>>> + op->objs = (char *)objs_buf;
>>
>> Why the cast? This is C, not C++.
>
> It's not needed in C++ either, right?
In C++, going from void* to a typed pointer requires a cast (that's why
in C++ you see casts on malloc results). In C, void* can implicitly be
converted to any other pointer (modulo const-/volatile-correctness).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH v1 02/17] dataplane: use object pool to speed up allocation for virtio blk request, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 03/17] qemu coroutine: support bypass mode, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 04/17] block: prepare for supporting selective bypass coroutine, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 05/17] garbage collector: introduced for support of bypass coroutine, Ming Lei, 2014/08/04
[Qemu-devel] [PATCH v1 06/17] block: introduce bdrv_co_can_bypass_co, Ming Lei, 2014/08/04