qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat un


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union
Date: Fri, 18 Sep 2015 06:29:36 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

On 09/18/2015 03:03 AM, Yang Hongyang wrote:

>> Fix is simple: add this patch to your build:
>>
>> https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg01650.html
>>
>> I've rebased my git repo accordingly for now, and will post v5 later on
>> (I'm still working on other improvements, and may reshuffle patches
>> before actually getting to v5).
>>
>> git fetch git://repo.or.cz/qemu/ericb.git qapi
>> http://repo.or.cz/qemu/ericb.git/shortlog/refs/heads/qapi
> 
> I have to add a workaround in my previous netfilter v9 patchset(v10 and
> later
> changed to QOM, so it won't have the problem) to get flat union work.
> Seems that
> you have already fixed it.

Rather, Zoltán found it, and I just realized why it was important.  Your
alternative is a bit simpler in implementation, though.

> 
> diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c
> index 7ae33b3..1271fab 100644
> --- a/qapi/opts-visitor.c
> +++ b/qapi/opts-visitor.c
> @@ -186,6 +186,20 @@ opts_end_struct(Visitor *v, Error **errp)
>  }
> 
> 
> +static void opts_start_implicit_struct(Visitor *v, void **obj,
> +                                       size_t size, Error **errp)
> +{
> +    if (obj) {
> +        *obj = g_malloc0(size);
> +    }
> +}
> +
> +
> +static void opts_end_implicit_struct(Visitor *v, Error **errp)
> +{
> +}
> +
> +
>  static GQueue *
>  lookup_distinct(const OptsVisitor *ov, const char *name, Error **errp)
>  {
> @@ -507,6 +521,8 @@ opts_visitor_new(const QemuOpts *opts)
> 
>      ov->visitor.start_struct = &opts_start_struct;
>      ov->visitor.end_struct   = &opts_end_struct;
> +    ov->visitor.start_implicit_struct = &opts_start_implicit_struct;
> +    ov->visitor.end_implicit_struct = &opts_end_implicit_struct;
> 
>      ov->visitor.start_list = &opts_start_list;
>      ov->visitor.next_list  = &opts_next_list;
> 
>>
> 

-- 
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]