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: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Anthony Liguori 2013-07-18 08:14:10 -05:00
commit bbcf59bc4b
2 changed files with 15 additions and 9 deletions

View File

@ -346,7 +346,8 @@ Send keys to VM.
Arguments: Arguments:
keys array: 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 - hold-time: time to delay key up events, milliseconds. Defaults to 100
(json-int, optional) (json-int, optional)
@ -354,7 +355,9 @@ keys array:
Example: Example:
-> { "execute": "send-key", -> { "execute": "send-key",
"arguments": { 'keys': [ 'ctrl', 'alt', 'delete' ] } } "arguments": { "keys": [ { "type": "qcode", "data": "ctrl" },
{ "type": "qcode", "data": "alt" },
{ "type": "qcode", "data": "delete" } ] } }
<- { "return": {} } <- { "return": {} }
EQMP EQMP

View File

@ -128,12 +128,15 @@ def gen_visitor_input_vars_decl(args):
def gen_visitor_input_block(args, obj, dealloc=False): def gen_visitor_input_block(args, obj, dealloc=False):
ret = "" ret = ""
errparg = 'errp'
if len(args) == 0: if len(args) == 0:
return ret return ret
push_indent() push_indent()
if dealloc: if dealloc:
errparg = 'NULL'
ret += mcgen(''' ret += mcgen('''
md = qapi_dealloc_visitor_new(); md = qapi_dealloc_visitor_new();
v = qapi_dealloc_get_visitor(md); v = qapi_dealloc_get_visitor(md);
@ -148,22 +151,22 @@ def gen_visitor_input_block(args, obj, dealloc=False):
for argname, argtype, optional, structured in parse_args(args): for argname, argtype, optional, structured in parse_args(args):
if optional: if optional:
ret += mcgen(''' 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) { if (has_%(c_name)s) {
''', ''',
c_name=c_var(argname), name=argname) c_name=c_var(argname), name=argname, errp=errparg)
push_indent() push_indent()
ret += mcgen(''' 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, c_name=c_var(argname), name=argname, argtype=argtype,
visitor=type_visitor(argtype)) visitor=type_visitor(argtype), errp=errparg)
if optional: if optional:
pop_indent() pop_indent()
ret += mcgen(''' ret += mcgen('''
} }
visit_end_optional(v, errp); visit_end_optional(v, %(errp)s);
''') ''', errp=errparg)
if dealloc: if dealloc:
ret += mcgen(''' ret += mcgen('''
@ -194,7 +197,7 @@ def gen_marshal_output(name, args, ret_type, middle_mode):
} }
qmp_output_visitor_cleanup(mo); qmp_output_visitor_cleanup(mo);
v = qapi_dealloc_get_visitor(md); 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); qapi_dealloc_visitor_cleanup(md);
} }
''', ''',