qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v8 02/11] init/cleanup of netfilter object


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v8 02/11] init/cleanup of netfilter object
Date: Wed, 26 Aug 2015 09:31:47 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 08/26/2015 08:41 AM, Markus Armbruster wrote:
> Only reviewing the QAPI part.
> 
> Yang Hongyang <address@hidden> writes:
> 

> Let's make this a flat union instead, to reduce nesting, and therefore
> memory allocations and indirections.  Something like
> 
> { 'enum': 'NetFilterType',
>   'data': [] }
> 
> { 'struct': NetFilterBase',
>   'data': {
>       'id':   'str',
>       'netdev': 'str',
>       '*chain': 'str',
>       'type': 'NetFilterType'
> 
> { 'union': 'NetFilter',
>   'base': 'NetFilterBase',
>   'discriminator': 'type',
>   'data': {
>   }
> }
> 
> I hope to reduce the notational overhead of such flat unions in the near
> future.
> 
> Not sure empty unions actually work.  If they don't, you can either
> squash adding members into this patch, or add a dummy member, and drop
> it when you add the real ones.

The generator handles an empty union without compilation error, but
creates C code that will always abort() if the union is passed on the
wire.  I have pending patches on top of Markus' that outlaw an empty union:

[uggh: https://lists.gnu.org/archive/html/qemu-devel/ is hosed right
now, and it's harder to find messages on other archivers...]

http://thread.gmane.org/gmane.comp.emulators.qemu/356265/focus=356258
http://thread.gmane.org/gmane.comp.emulators.qemu/356265/focus=356294

so a dummy member for now is a reasonable compromise.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]