mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
qemu-option: qemu_opts_create(): use error_set()
This commit converts qemu_opts_create() from qerror_report() to error_set(). Currently, most calls to qemu_opts_create() can't fail, so most callers don't need any changes. The two cases where code checks for qemu_opts_create() erros are: 1. Initialization code in vl.c. All of them print their own error messages directly to stderr, no need to pass the Error object 2. The functions opts_parse(), qemu_opts_from_qdict() and qemu_chr_parse_compat() make use of the error information and they can be called from HMP or QMP. In this case, to allow for incremental conversion, we propagate the error up using qerror_report_err(), which keeps the QError semantics Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-By: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
783e9b4826
commit
8be7e7e4c7
9 changed files with 59 additions and 32 deletions
|
@ -461,7 +461,7 @@ int inet_listen(const char *str, char *ostr, int olen,
|
|||
char *optstr;
|
||||
int sock = -1;
|
||||
|
||||
opts = qemu_opts_create(&dummy_opts, NULL, 0);
|
||||
opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
|
||||
if (inet_parse(opts, str) == 0) {
|
||||
sock = inet_listen_opts(opts, port_offset, errp);
|
||||
if (sock != -1 && ostr) {
|
||||
|
@ -490,7 +490,7 @@ int inet_connect(const char *str, bool block, Error **errp)
|
|||
QemuOpts *opts;
|
||||
int sock = -1;
|
||||
|
||||
opts = qemu_opts_create(&dummy_opts, NULL, 0);
|
||||
opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
|
||||
if (inet_parse(opts, str) == 0) {
|
||||
if (block) {
|
||||
qemu_opt_set(opts, "block", "on");
|
||||
|
@ -589,7 +589,7 @@ int unix_listen(const char *str, char *ostr, int olen)
|
|||
char *path, *optstr;
|
||||
int sock, len;
|
||||
|
||||
opts = qemu_opts_create(&dummy_opts, NULL, 0);
|
||||
opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
|
||||
|
||||
optstr = strchr(str, ',');
|
||||
if (optstr) {
|
||||
|
@ -617,7 +617,7 @@ int unix_connect(const char *path)
|
|||
QemuOpts *opts;
|
||||
int sock;
|
||||
|
||||
opts = qemu_opts_create(&dummy_opts, NULL, 0);
|
||||
opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
|
||||
qemu_opt_set(opts, "path", path);
|
||||
sock = unix_connect_opts(opts);
|
||||
qemu_opts_del(opts);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue