qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v5 07/14] qapi: Utilize implicit struct visits


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v5 07/14] qapi: Utilize implicit struct visits
Date: Thu, 10 Mar 2016 13:16:51 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 03/10/2016 12:05 PM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
> 
>> Rather than generate inline per-member visits, take advantage
>> of the 'visit_type_FOO_members()' function for both event and
>> command marshalling.  This is possible now that implicit
>> structs can be visited like any other.
>>

>> Likewise, command marshalling generates call arguments from a
>> stack-allocated struct, rather than a list of local variables:
>>

>> |-            goto out;
>> |-        }
>> |+    q_obj_add_fd_arg qapi = {0};
> 
> Let's calls this arg.

Sure.

> 
>> |+
>> |+    v = qmp_input_get_visitor(qiv);
>> |+    visit_type_q_obj_add_fd_arg_members(v, &qapi, &err);
>> |+    if (err) {
>> |+        goto out;
>> |     }
>> |
>> |-    retval = qmp_add_fd(has_fdset_id, fdset_id, has_opaque, opaque, &err);
>> |+    retval = qmp_add_fd(qapi.has_fdset_id, qapi.fdset_id, qapi.has_opaque, 
>> qapi.opaque, &err);

and this line then gets a bit shorter.

>> +++ b/scripts/qapi-event.py
>> @@ -28,6 +28,30 @@ def gen_event_send_decl(name, arg_type):
>>                   proto=gen_event_send_proto(name, arg_type))

>> @@ -50,6 +74,7 @@ def gen_event_send(name, arg_type):
>>      QmpOutputVisitor *qov;
>>      Visitor *v;
>>  ''')
>> +        ret += gen_param_var(arg_type)
>>
>>      ret += mcgen('''
>>

This is why I moved the blank line in 6/14.  But I can rearrange things
as you requested.

I'm also wondering if this should be split into two patches (one for
qapi-visit, one for qapi-commands); when I first started writing it, I
thought there would be some code sharing between the two with edits to
qapi.py (see the v4 posting); but now they are distinct enough that two
commits is just as easy to do.

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