Il 13/12/2013 03:55, Wenchao Xia ha scritto:
> 于 2013/12/11 2:15, Paolo Bonzini 写道:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Il 10/12/2013 19:00, Eric Blake ha scritto:
>>>>> +  'data': {'qom-type': 'str', 'id': 'str', '*props': 'dict'},
>>>>> +  'gen': 'no' }
>>>
>>> This feels VERY open-coded.  No where else in qapi-schema do we
>>> have 'dict' as a type
>>
>> Yes, in fact the "data" field is entirely skipped by the code
>> generator (that's 'gen':'no').
>>
> 
> Could we use hmp_object_add()->qmp_object_add()->object_add() code path,
> instead of  hmp_object_add()->object_add(),qmp_object_add()->object_add()?
> Would skipping by generator brings some difficult to it?

No, you cannot do that because both hmp_object_add and qmp_object_add
take a QDict.  But hmp_object_add's qdict has strings, while
qmp_object_add has the right types (e.g. integer for integer properties).

It is not entirely clear, but actually the structure is the same as
regular commands that use code generation.

The usual code path is

        hmp_cont          qmp_marshal_input_cont
                \        /
                 qmp_cont

Here it is

  hmp_object_add          qmp_object_add
                \        /
                object_add

So the current structure is fine.

Paolo

Reply via email to