mirror of https://gitee.com/openkylin/qemu.git
Four little fixes
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVOpHzAAoJEDu+7JDiTtWnKLEP/ilhLzPwMwGm6vYYwMwVy/1g X8PtQJFkgdcNPG1q05NpJH22Ntrq5lsl5t4H+J0WbevMoJ9RJY2LpRogvDFvsvrZ T31tPvagiiiub3ABCyFWbVmJurzPgW403xi1RDCGIRyfeRNy31vkTnEEJFzE0Kzo /w7lPpN3xFDj31hHjpNCzDRnPDu5Qj9DzYiEt+oZ0HMwpDnHIYo/VCbh/PpV+1XT gPUOusbOBg2wBDNwhevH74YNNKddsBf6c5X3E9rPJ649DPc36Qj5K2WGVF6fJWW7 sCDjDMo9kJ5rh4E7NhB0GR/3Jaxc68zGvDL2f/DjYbPnPdLaWOeXyzoH64JDaVZH CqkBPG3n3ysW9cQDDKupRmO1VYetMyzdHxnYo/scfTiEqqgb+WsOBp19hdOQW/lL 22rg3IqONP01QBDQI9lUMb//jq3HtwyP3j9ROSxpgpIeaXLMIYLU8IUVnVJQ9bhf 3FwZwRNdsJOjI2shR8DognRVkIPRUNck9Uw+VibfWKwCPU1+LaJ/7asbsOsf1eyA 5YPs9RotaUxXF6YH8F/e6qeDw99Tb5efH9Irozmj6Sb89z0ForbKgFoBGuwMoiHN wS5gZit0f+IV9Xl9LK4Mv9iknuiJMw7c6NsUKznsYWd15iz9QrLn/9j6vvQeHrgI aWLDW1i+JoovRqiDxE36 =WFLx -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/qmp-unstable/tags/for-upstream' into staging Four little fixes # gpg: Signature made Fri Apr 24 19:56:51 2015 BST using RSA key ID E24ED5A7 # gpg: Good signature from "Luiz Capitulino <lcapitulino@gmail.com>" * remotes/qmp-unstable/tags/for-upstream: qmp: Give saner messages related to qmp_capabilities misuse qmp-commands: fix incorrect uses of ":O" specifier qapi: Drop dead genlist parameter balloon: improve error msg when adding second device Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
0d81cdddaa
|
@ -58,7 +58,6 @@ int qemu_add_balloon_handler(QEMUBalloonEvent *event_func,
|
|||
/* We're already registered one balloon handler. How many can
|
||||
* a guest really have?
|
||||
*/
|
||||
error_report("Another balloon device already registered");
|
||||
return -1;
|
||||
}
|
||||
balloon_event_fn = event_func;
|
||||
|
|
|
@ -383,7 +383,7 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)
|
|||
virtio_balloon_stat, s);
|
||||
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Adding balloon handler failed");
|
||||
error_setg(errp, "Only one balloon device is supported");
|
||||
virtio_cleanup(vdev);
|
||||
return;
|
||||
}
|
||||
|
|
23
monitor.c
23
monitor.c
|
@ -4783,10 +4783,22 @@ static int monitor_can_read(void *opaque)
|
|||
return (mon->suspend_cnt == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd)
|
||||
static bool invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd)
|
||||
{
|
||||
int is_cap = cmd->mhandler.cmd_new == do_qmp_capabilities;
|
||||
return (qmp_cmd_mode(mon) ? is_cap : !is_cap);
|
||||
bool is_cap = cmd->mhandler.cmd_new == do_qmp_capabilities;
|
||||
if (is_cap && qmp_cmd_mode(mon)) {
|
||||
qerror_report(ERROR_CLASS_COMMAND_NOT_FOUND,
|
||||
"Capabilities negotiation is already complete, command "
|
||||
"'%s' ignored", cmd->name);
|
||||
return true;
|
||||
}
|
||||
if (!is_cap && !qmp_cmd_mode(mon)) {
|
||||
qerror_report(ERROR_CLASS_COMMAND_NOT_FOUND,
|
||||
"Expecting capabilities negotiation with "
|
||||
"'qmp_capabilities' before command '%s'", cmd->name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5080,11 +5092,14 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
|
|||
cmd_name = qdict_get_str(input, "execute");
|
||||
trace_handle_qmp_command(mon, cmd_name);
|
||||
cmd = qmp_find_cmd(cmd_name);
|
||||
if (!cmd || invalid_qmp_mode(mon, cmd)) {
|
||||
if (!cmd) {
|
||||
qerror_report(ERROR_CLASS_COMMAND_NOT_FOUND,
|
||||
"The command %s has not been found", cmd_name);
|
||||
goto err_out;
|
||||
}
|
||||
if (invalid_qmp_mode(mon, cmd)) {
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
obj = qdict_get(input, "arguments");
|
||||
if (!obj) {
|
||||
|
|
|
@ -332,7 +332,7 @@ EQMP
|
|||
|
||||
{
|
||||
.name = "send-key",
|
||||
.args_type = "keys:O,hold-time:i?",
|
||||
.args_type = "keys:q,hold-time:i?",
|
||||
.mhandler.cmd_new = qmp_marshal_input_send_key,
|
||||
},
|
||||
|
||||
|
@ -3288,7 +3288,7 @@ EQMP
|
|||
|
||||
{
|
||||
.name = "migrate-set-capabilities",
|
||||
.args_type = "capabilities:O",
|
||||
.args_type = "capabilities:q",
|
||||
.params = "capability:s,state:b",
|
||||
.mhandler.cmd_new = qmp_marshal_input_migrate_set_capabilities,
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# QAPI visitor generator
|
||||
#
|
||||
# Copyright IBM, Corp. 2011
|
||||
# Copyright (C) 2014 Red Hat, Inc.
|
||||
# Copyright (C) 2014-2015 Red Hat, Inc.
|
||||
#
|
||||
# Authors:
|
||||
# Anthony Liguori <aliguori@us.ibm.com>
|
||||
|
@ -401,34 +401,31 @@ def generate_visit_union(expr):
|
|||
|
||||
return ret
|
||||
|
||||
def generate_declaration(name, members, genlist=True, builtin_type=False):
|
||||
def generate_declaration(name, members, builtin_type=False):
|
||||
ret = ""
|
||||
if not builtin_type:
|
||||
ret += mcgen('''
|
||||
|
||||
void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **errp);
|
||||
''',
|
||||
name=name)
|
||||
name=name)
|
||||
|
||||
if genlist:
|
||||
ret += mcgen('''
|
||||
ret += mcgen('''
|
||||
void visit_type_%(name)sList(Visitor *m, %(name)sList **obj, const char *name, Error **errp);
|
||||
''',
|
||||
name=name)
|
||||
|
||||
return ret
|
||||
|
||||
def generate_enum_declaration(name, members, genlist=True):
|
||||
ret = ""
|
||||
if genlist:
|
||||
ret += mcgen('''
|
||||
def generate_enum_declaration(name, members):
|
||||
ret = mcgen('''
|
||||
void visit_type_%(name)sList(Visitor *m, %(name)sList **obj, const char *name, Error **errp);
|
||||
''',
|
||||
name=name)
|
||||
name=name)
|
||||
|
||||
return ret
|
||||
|
||||
def generate_decl_enum(name, members, genlist=True):
|
||||
def generate_decl_enum(name, members):
|
||||
return mcgen('''
|
||||
|
||||
void visit_type_%(name)s(Visitor *m, %(name)s *obj, const char *name, Error **errp);
|
||||
|
@ -542,8 +539,7 @@ def maybe_open(really, name, opt):
|
|||
# for built-in types in our header files and simply guard them
|
||||
fdecl.write(guardstart("QAPI_VISIT_BUILTIN_VISITOR_DECL"))
|
||||
for typename in builtin_types:
|
||||
fdecl.write(generate_declaration(typename, None, genlist=True,
|
||||
builtin_type=True))
|
||||
fdecl.write(generate_declaration(typename, None, builtin_type=True))
|
||||
fdecl.write(guardend("QAPI_VISIT_BUILTIN_VISITOR_DECL"))
|
||||
|
||||
# ...this doesn't work for cases where we link in multiple objects that
|
||||
|
|
Loading…
Reference in New Issue