From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: qemu-trivial@nongnu.org
Cc: zhanghailiang <zhang.zhanghailiang@huawei.com>,
armbru@redhat.com, mjt@tls.msk.ru, qemu-devel@nongnu.org,
peter.huangpeng@huawei.com, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH v3 5/5] spice-qemu-char: convert some functions to use Error API
Date: Tue, 4 Nov 2014 18:50:23 +0800 [thread overview]
Message-ID: <1415098223-32404-6-git-send-email-zhang.zhanghailiang@huawei.com> (raw)
In-Reply-To: <1415098223-32404-1-git-send-email-zhang.zhanghailiang@huawei.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
---
include/ui/qemu-spice.h | 2 +-
qemu-char.c | 2 +-
spice-qemu-char.c | 12 ++++++------
stubs/qemu-chr-open-spice.c | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h
index a93b4b2..33882aa 100644
--- a/include/ui/qemu-spice.h
+++ b/include/ui/qemu-spice.h
@@ -48,7 +48,7 @@ int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
void do_info_spice_print(Monitor *mon, const QObject *data);
void do_info_spice(Monitor *mon, QObject **ret_data);
-CharDriverState *qemu_chr_open_spice_vmc(const char *type);
+CharDriverState *qemu_chr_open_spice_vmc(const char *type, Error **errp);
#if SPICE_SERVER_VERSION >= 0x000c02
CharDriverState *qemu_chr_open_spice_port(const char *name);
void qemu_spice_register_ports(void);
diff --git a/qemu-char.c b/qemu-char.c
index a1d25c7..df24c65 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -4256,7 +4256,7 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
#endif
#ifdef CONFIG_SPICE
case CHARDEV_BACKEND_KIND_SPICEVMC:
- chr = qemu_chr_open_spice_vmc(backend->spicevmc->type);
+ chr = qemu_chr_open_spice_vmc(backend->spicevmc->type, errp);
break;
case CHARDEV_BACKEND_KIND_SPICEPORT:
chr = qemu_chr_open_spice_port(backend->spiceport->fqdn);
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index d3c1f5c..721c895 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -249,16 +249,16 @@ static void print_allowed_subtypes(void)
const char** psubtype;
int i;
- fprintf(stderr, "allowed names: ");
+ error_printf("allowed names: ");
for(i=0, psubtype = spice_server_char_device_recognized_subtypes();
*psubtype != NULL; ++psubtype, ++i) {
if (i == 0) {
- fprintf(stderr, "%s", *psubtype);
+ error_printf("%s", *psubtype);
} else {
- fprintf(stderr, ", %s", *psubtype);
+ error_printf(", %s", *psubtype);
}
}
- fprintf(stderr, "\n");
+ error_printf("\n");
}
static CharDriverState *chr_open(const char *subtype,
@@ -286,7 +286,7 @@ static CharDriverState *chr_open(const char *subtype,
return chr;
}
-CharDriverState *qemu_chr_open_spice_vmc(const char *type)
+CharDriverState *qemu_chr_open_spice_vmc(const char *type, Error **errp)
{
const char **psubtype = spice_server_char_device_recognized_subtypes();
@@ -296,7 +296,7 @@ CharDriverState *qemu_chr_open_spice_vmc(const char *type)
}
}
if (*psubtype == NULL) {
- fprintf(stderr, "spice-qemu-char: unsupported type: %s\n", type);
+ error_setg(errp, "spice-qemu-char: unsupported type: %s", type);
print_allowed_subtypes();
return NULL;
}
diff --git a/stubs/qemu-chr-open-spice.c b/stubs/qemu-chr-open-spice.c
index f1c4849..55826ed 100644
--- a/stubs/qemu-chr-open-spice.c
+++ b/stubs/qemu-chr-open-spice.c
@@ -1,7 +1,7 @@
#include "qemu-common.h"
#include "ui/qemu-spice.h"
-CharDriverState *qemu_chr_open_spice_vmc(const char *type)
+CharDriverState *qemu_chr_open_spice_vmc(const char *type, Error **errp)
{
return NULL;
}
--
1.7.12.4
next prev parent reply other threads:[~2014-11-04 10:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-04 10:50 [Qemu-devel] [PATCH v3 0/5] Trivial patch about qemu-char zhanghailiang
2014-11-04 10:50 ` [Qemu-devel] [PATCH v3 1/5] qemu-char: fix parameter check in some qemu_chr_parse_* functions zhanghailiang
2014-11-04 13:25 ` Alex Bennée
2014-11-05 7:05 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-11-05 12:19 ` zhanghailiang
2014-11-05 13:28 ` Alex Bennée
2014-11-04 10:50 ` [Qemu-devel] [PATCH v3 2/5] spice-qemu-char: fix parameter checks in " zhanghailiang
2014-11-04 13:27 ` Alex Bennée
2014-11-04 10:50 ` [Qemu-devel] [PATCH v3 3/5] qemu-char: fix incorrect state in error message zhanghailiang
2014-11-04 13:31 ` Alex Bennée
2014-11-05 7:08 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-11-04 10:50 ` [Qemu-devel] [PATCH v3 4/5] qemu-char: convert some open functions to use Error API zhanghailiang
2014-11-04 13:39 ` Alex Bennée
2014-11-05 7:15 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-11-05 9:08 ` Markus Armbruster
2014-11-04 10:50 ` zhanghailiang [this message]
2014-11-04 13:41 ` [Qemu-devel] [PATCH v3 5/5] spice-qemu-char: convert some " Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415098223-32404-6-git-send-email-zhang.zhanghailiang@huawei.com \
--to=zhang.zhanghailiang@huawei.com \
--cc=armbru@redhat.com \
--cc=kraxel@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).