diff options
author | Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 2014-01-14 12:09:59 +1000 |
---|---|---|
committer | Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 2014-01-14 12:10:08 +1000 |
commit | 133fe77437d3a23bf1fd70a231b4f29d5fa0571c (patch) | |
tree | 89450efd322bd414e941e30dfc991652892e4a3e /util | |
parent | 73c694565c6144e0c4e15041b5250a04a25107c3 (diff) | |
parent | c950114286ea358a93ce632db0421945e1008395 (diff) | |
download | qemu-133fe77437d3a23bf1fd70a231b4f29d5fa0571c.tar.gz qemu-133fe77437d3a23bf1fd70a231b4f29d5fa0571c.tar.bz2 qemu-133fe77437d3a23bf1fd70a231b4f29d5fa0571c.zip |
Merge remote branch 'luiz/queue/qmp' into qmpq
* luiz/queue/qmp:
migration: qmp_migrate(): keep working after syntax error
qerror: Remove assert_no_error()
qemu-option: Remove qemu_opts_create_nofail
target-i386: Remove assert_no_error usage
hw: Remove assert_no_error usages
qdev: Delete dead code
error: Add error_abort
monitor: add object-add (QMP) and object_add (HMP) command
monitor: add object-del (QMP) and object_del (HMP) command
qom: catch errors in object_property_add_child
qom: fix leak for objects created with -object
rng: initialize file descriptor to -1
qemu-monitor: HMP cpu-add wrapper
vl: add missing transition debug->finish_migrate
Message-Id: 1389045795-18706-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/error.c | 22 | ||||
-rw-r--r-- | util/qemu-config.c | 2 | ||||
-rw-r--r-- | util/qemu-option.c | 9 | ||||
-rw-r--r-- | util/qemu-sockets.c | 18 |
4 files changed, 31 insertions, 20 deletions
diff --git a/util/error.c b/util/error.c index 3ee362a7f5..f11f1d57a0 100644 --- a/util/error.c +++ b/util/error.c @@ -23,6 +23,8 @@ struct Error ErrorClass err_class; }; +Error *error_abort; + void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...) { Error *err; @@ -41,6 +43,11 @@ void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...) va_end(ap); err->err_class = err_class; + if (errp == &error_abort) { + error_report("%s", error_get_pretty(err)); + abort(); + } + *errp = err; errno = saved_errno; @@ -72,6 +79,11 @@ void error_set_errno(Error **errp, int os_errno, ErrorClass err_class, va_end(ap); err->err_class = err_class; + if (errp == &error_abort) { + error_report("%s", error_get_pretty(err)); + abort(); + } + *errp = err; errno = saved_errno; @@ -112,6 +124,11 @@ void error_set_win32(Error **errp, int win32_err, ErrorClass err_class, va_end(ap); err->err_class = err_class; + if (errp == &error_abort) { + error_report("%s", error_get_pretty(err)); + abort(); + } + *errp = err; } @@ -153,7 +170,10 @@ void error_free(Error *err) void error_propagate(Error **dst_err, Error *local_err) { - if (dst_err && !*dst_err) { + if (local_err && dst_err == &error_abort) { + error_report("%s", error_get_pretty(local_err)); + abort(); + } else if (dst_err && !*dst_err) { *dst_err = local_err; } else if (local_err) { error_free(local_err); diff --git a/util/qemu-config.c b/util/qemu-config.c index 04da942a25..7973659518 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -311,7 +311,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname) error_free(local_err); goto out; } - opts = qemu_opts_create_nofail(list); + opts = qemu_opts_create(list, NULL, 0, &error_abort); continue; } if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2) { diff --git a/util/qemu-option.c b/util/qemu-option.c index efcb5dcfcb..668e5d919f 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -791,15 +791,6 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, return opts; } -QemuOpts *qemu_opts_create_nofail(QemuOptsList *list) -{ - QemuOpts *opts; - Error *errp = NULL; - opts = qemu_opts_create(list, NULL, 0, &errp); - assert_no_error(errp); - return opts; -} - void qemu_opts_reset(QemuOptsList *list) { QemuOpts *opts, *next_opts; diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 6b97dc11f9..8818d7c0de 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -578,7 +578,7 @@ int inet_listen(const char *str, char *ostr, int olen, addr = inet_parse(str, errp); if (addr != NULL) { - opts = qemu_opts_create_nofail(&socket_optslist); + opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); inet_addr_to_opts(opts, addr); qapi_free_InetSocketAddress(addr); sock = inet_listen_opts(opts, port_offset, errp); @@ -617,7 +617,7 @@ int inet_connect(const char *str, Error **errp) addr = inet_parse(str, errp); if (addr != NULL) { - opts = qemu_opts_create_nofail(&socket_optslist); + opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); inet_addr_to_opts(opts, addr); qapi_free_InetSocketAddress(addr); sock = inet_connect_opts(opts, errp, NULL, NULL); @@ -651,7 +651,7 @@ int inet_nonblocking_connect(const char *str, addr = inet_parse(str, errp); if (addr != NULL) { - opts = qemu_opts_create_nofail(&socket_optslist); + opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); inet_addr_to_opts(opts, addr); qapi_free_InetSocketAddress(addr); sock = inet_connect_opts(opts, errp, callback, opaque); @@ -794,7 +794,7 @@ int unix_listen(const char *str, char *ostr, int olen, Error **errp) char *path, *optstr; int sock, len; - opts = qemu_opts_create_nofail(&socket_optslist); + opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); optstr = strchr(str, ','); if (optstr) { @@ -822,7 +822,7 @@ int unix_connect(const char *path, Error **errp) QemuOpts *opts; int sock; - opts = qemu_opts_create_nofail(&socket_optslist); + opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); qemu_opt_set(opts, "path", path); sock = unix_connect_opts(opts, errp, NULL, NULL); qemu_opts_del(opts); @@ -839,7 +839,7 @@ int unix_nonblocking_connect(const char *path, g_assert(callback != NULL); - opts = qemu_opts_create_nofail(&socket_optslist); + opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); qemu_opt_set(opts, "path", path); sock = unix_connect_opts(opts, errp, callback, opaque); qemu_opts_del(opts); @@ -889,7 +889,7 @@ int socket_connect(SocketAddress *addr, Error **errp, QemuOpts *opts; int fd; - opts = qemu_opts_create_nofail(&socket_optslist); + opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); switch (addr->kind) { case SOCKET_ADDRESS_KIND_INET: inet_addr_to_opts(opts, addr->inet); @@ -921,7 +921,7 @@ int socket_listen(SocketAddress *addr, Error **errp) QemuOpts *opts; int fd; - opts = qemu_opts_create_nofail(&socket_optslist); + opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); switch (addr->kind) { case SOCKET_ADDRESS_KIND_INET: inet_addr_to_opts(opts, addr->inet); @@ -949,7 +949,7 @@ int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp) QemuOpts *opts; int fd; - opts = qemu_opts_create_nofail(&socket_optslist); + opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); switch (remote->kind) { case SOCKET_ADDRESS_KIND_INET: qemu_opt_set(opts, "host", remote->inet->host); |