提交 bbcf59bc 编写于 作者: A Anthony Liguori

Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Amos Kong (1) and Luiz Capitulino (1)
# Via Luiz Capitulino
* luiz/queue/qmp:
  qmp: update send-key document
  qapi: qapi-commands: fix possible leaks on visitor dealloc

Message-id: 1374093679-29213-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
......@@ -346,7 +346,8 @@ Send keys to VM.
Arguments:
keys array:
- "key": key sequence (a json-array of key enum values)
- "key": key sequence (a json-array of key union values,
union can be number or qcode enum)
- hold-time: time to delay key up events, milliseconds. Defaults to 100
(json-int, optional)
......@@ -354,7 +355,9 @@ keys array:
Example:
-> { "execute": "send-key",
"arguments": { 'keys': [ 'ctrl', 'alt', 'delete' ] } }
"arguments": { "keys": [ { "type": "qcode", "data": "ctrl" },
{ "type": "qcode", "data": "alt" },
{ "type": "qcode", "data": "delete" } ] } }
<- { "return": {} }
EQMP
......
......@@ -128,12 +128,15 @@ bool has_%(argname)s = false;
def gen_visitor_input_block(args, obj, dealloc=False):
ret = ""
errparg = 'errp'
if len(args) == 0:
return ret
push_indent()
if dealloc:
errparg = 'NULL'
ret += mcgen('''
md = qapi_dealloc_visitor_new();
v = qapi_dealloc_get_visitor(md);
......@@ -148,22 +151,22 @@ v = qmp_input_get_visitor(mi);
for argname, argtype, optional, structured in parse_args(args):
if optional:
ret += mcgen('''
visit_start_optional(v, &has_%(c_name)s, "%(name)s", errp);
visit_start_optional(v, &has_%(c_name)s, "%(name)s", %(errp)s);
if (has_%(c_name)s) {
''',
c_name=c_var(argname), name=argname)
c_name=c_var(argname), name=argname, errp=errparg)
push_indent()
ret += mcgen('''
%(visitor)s(v, &%(c_name)s, "%(name)s", errp);
%(visitor)s(v, &%(c_name)s, "%(name)s", %(errp)s);
''',
c_name=c_var(argname), name=argname, argtype=argtype,
visitor=type_visitor(argtype))
visitor=type_visitor(argtype), errp=errparg)
if optional:
pop_indent()
ret += mcgen('''
}
visit_end_optional(v, errp);
''')
visit_end_optional(v, %(errp)s);
''', errp=errparg)
if dealloc:
ret += mcgen('''
......@@ -194,7 +197,7 @@ static void qmp_marshal_output_%(c_name)s(%(c_ret_type)s ret_in, QObject **ret_o
}
qmp_output_visitor_cleanup(mo);
v = qapi_dealloc_get_visitor(md);
%(visitor)s(v, &ret_in, "unused", errp);
%(visitor)s(v, &ret_in, "unused", NULL);
qapi_dealloc_visitor_cleanup(md);
}
''',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册