[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 18/19] qemu-char: Chardev open error reporting, gene
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH 18/19] qemu-char: Chardev open error reporting, generic part |
Date: |
Tue, 7 Feb 2012 15:09:25 +0100 |
1. Convert to error_report().
2. All backends now report their errors, no need to follow up with an
unspecific "opening backend failed". Drop the message.
Signed-off-by: Markus Armbruster <address@hidden>
---
qemu-char.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index ecbb595..fe0cfce 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2808,33 +2808,30 @@ static const struct {
CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
void (*init)(struct CharDriverState *s))
{
+ const char *backend = qemu_opt_get(opts, "backend");
CharDriverState *chr;
int i;
if (qemu_opts_id(opts) == NULL) {
- fprintf(stderr, "chardev: no id specified\n");
+ error_report("character device requires parameter id");
return NULL;
}
- if (qemu_opt_get(opts, "backend") == NULL) {
- fprintf(stderr, "chardev: \"%s\" missing backend\n",
- qemu_opts_id(opts));
+ if (!backend) {
+ error_report("character device requires parameter backend");
return NULL;
}
for (i = 0; i < ARRAY_SIZE(backend_table); i++) {
- if (strcmp(backend_table[i].name, qemu_opt_get(opts, "backend")) == 0)
+ if (strcmp(backend_table[i].name, backend) == 0)
break;
}
if (i == ARRAY_SIZE(backend_table)) {
- fprintf(stderr, "chardev: backend \"%s\" not found\n",
- qemu_opt_get(opts, "backend"));
+ error_report("character device backend '%s' not found", backend);
return NULL;
}
chr = backend_table[i].open(opts);
if (!chr) {
- fprintf(stderr, "chardev: opening backend \"%s\" failed\n",
- qemu_opt_get(opts, "backend"));
return NULL;
}
--
1.7.6.5
- Re: [Qemu-devel] [PATCH 10/19] qemu-char: Chardev open error reporting, !_WIN32 part, (continued)
- Re: [Qemu-devel] [PATCH 10/19] qemu-char: Chardev open error reporting, !_WIN32 part, Kevin Wolf, 2012/02/09
- Re: [Qemu-devel] [PATCH 10/19] qemu-char: Chardev open error reporting, !_WIN32 part, Markus Armbruster, 2012/02/09
- Re: [Qemu-devel] [PATCH 10/19] qemu-char: Chardev open error reporting, !_WIN32 part, Luiz Capitulino, 2012/02/09
- Re: [Qemu-devel] [PATCH 10/19] qemu-char: Chardev open error reporting, !_WIN32 part, Markus Armbruster, 2012/02/09
[Qemu-devel] [PATCH 03/19] qemu-char: Re-apply style fixes from just reverted aad04cd0, Markus Armbruster, 2012/02/07
[Qemu-devel] [PATCH 17/19] baum: Chardev open error reporting, braille part, Markus Armbruster, 2012/02/07
[Qemu-devel] [PATCH 11/19] qemu-char: Chardev open error reporting, _WIN32 part, Markus Armbruster, 2012/02/07
[Qemu-devel] [PATCH 15/19] console: Chardev open error reporting, console part, Markus Armbruster, 2012/02/07
[Qemu-devel] [PATCH 19/19] qemu-char: Fix legacy chardev syntax error reporting, Markus Armbruster, 2012/02/07
[Qemu-devel] [PATCH 18/19] qemu-char: Chardev open error reporting, generic part,
Markus Armbruster <=
Re: [Qemu-devel] [PATCH 00/19] Fix and improve chardev open error messages, Kevin Wolf, 2012/02/07
Re: [Qemu-devel] [PATCH 00/19] Fix and improve chardev open error messages, Anthony Liguori, 2012/02/24