[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 0/9] Virtio cleanups
From: |
Juan Quintela |
Subject: |
[Qemu-devel] Re: [PATCH 0/9] Virtio cleanups |
Date: |
Mon, 22 Mar 2010 02:13:48 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
"Michael S. Tsirkin" <address@hidden> wrote:
> On Sun, Mar 21, 2010 at 06:11:43PM +0000, Jamie Lokier wrote:
>> Michael S. Tsirkin wrote:
>> > That's version 1 of my patch. Version 2 removed even need for macro
>> > completely by moving allocations to the caller.
>>
>> The downside of moving allocations are: (1) it's one more call in the
>> caller, to allocate the type, (2) it needs a virtual destructor for
>> each type to free the object, which can clutter the code if there is
>> no other reason for virtual destructors.
>
> BTW I don't understand why do you refer to virtual destructors here.
> When virtio-net.c allocates and frees structure of type VirtIONet
> this is analogous to regular destructur, not a virtual one.
If you remove it in virtio-net.c, you are right.
If your remove it in virtio.c, then you need the equivalent of a virtual
destructor (somehow you need to find a field that is an offset and do a
free(pointer- offset).
If struct VirtIODevice is the 1st field of everything, then a simple
free(pointer) is enough and does the right thing.
Notice that as just now there is no free call, you can put it in either
place.
>> I don't think those are necessarily bad, but they can remove from the
>> neatness of existing code. Personally I favour an occasional macro
>> using sizeof/offsetof/container_of if the result is a natural and
>> sensible API to all of its callers.
>>
>> -- Jamie
Later, Juan.
- Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, (continued)
- Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Michael S. Tsirkin, 2010/03/22
- [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Juan Quintela, 2010/03/22
- Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Paul Brook, 2010/03/22
- Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Anthony Liguori, 2010/03/22
- Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Michael S. Tsirkin, 2010/03/23
- Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Gerd Hoffmann, 2010/03/23
- Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Paul Brook, 2010/03/23
- Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Michael S. Tsirkin, 2010/03/23
- [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Juan Quintela, 2010/03/23
- Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Michael S. Tsirkin, 2010/03/21
- [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups,
Juan Quintela <=
- [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Michael S. Tsirkin, 2010/03/22
- [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Michael S. Tsirkin, 2010/03/18
- Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Gerd Hoffmann, 2010/03/18
- [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Juan Quintela, 2010/03/18
- [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Gerd Hoffmann, 2010/03/18
- [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Juan Quintela, 2010/03/18
- [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Michael S. Tsirkin, 2010/03/18
- [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Juan Quintela, 2010/03/18
- Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups, Anthony Liguori, 2010/03/18