summaryrefslogtreecommitdiff
path: root/spice-qemu-char.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-09-29 15:45:47 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2015-10-19 10:13:07 +0200
commit68145e178ac200a27b5f0ab342da80cf60ddd576 (patch)
tree74bae6b780b8630c6cd7935f0a6ec8c1ba55f435 /spice-qemu-char.c
parent122e5ed4412cadce2d44a5f636e4d1bfc67c534b (diff)
downloadqemu-68145e178ac200a27b5f0ab342da80cf60ddd576.tar.gz
qemu-68145e178ac200a27b5f0ab342da80cf60ddd576.tar.bz2
qemu-68145e178ac200a27b5f0ab342da80cf60ddd576.zip
qemu-char: convert spice backend to data-driven creation
Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'spice-qemu-char.c')
-rw-r--r--spice-qemu-char.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index e4353ef029..a20fb5c90c 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -296,15 +296,14 @@ static CharDriverState *chr_open(const char *subtype,
return chr;
}
-CharDriverState *qemu_chr_open_spice_vmc(const char *type)
+static CharDriverState *qemu_chr_open_spice_vmc(const char *id,
+ ChardevBackend *backend,
+ ChardevReturn *ret,
+ Error **errp)
{
+ const char *type = backend->spicevmc->type;
const char **psubtype = spice_server_char_device_recognized_subtypes();
- if (type == NULL) {
- fprintf(stderr, "spice-qemu-char: missing name parameter\n");
- print_allowed_subtypes();
- return NULL;
- }
for (; *psubtype != NULL; ++psubtype) {
if (strcmp(type, *psubtype) == 0) {
break;
@@ -320,8 +319,12 @@ CharDriverState *qemu_chr_open_spice_vmc(const char *type)
}
#if SPICE_SERVER_VERSION >= 0x000c02
-CharDriverState *qemu_chr_open_spice_port(const char *name)
+static CharDriverState *qemu_chr_open_spice_port(const char *id,
+ ChardevBackend *backend,
+ ChardevReturn *ret,
+ Error **errp)
{
+ const char *name = backend->spiceport->fqdn;
CharDriverState *chr;
SpiceCharDriver *s;
@@ -379,9 +382,9 @@ static void qemu_chr_parse_spice_port(QemuOpts *opts, ChardevBackend *backend,
static void register_types(void)
{
register_char_driver("spicevmc", CHARDEV_BACKEND_KIND_SPICEVMC,
- qemu_chr_parse_spice_vmc, NULL);
+ qemu_chr_parse_spice_vmc, qemu_chr_open_spice_vmc);
register_char_driver("spiceport", CHARDEV_BACKEND_KIND_SPICEPORT,
- qemu_chr_parse_spice_port, NULL);
+ qemu_chr_parse_spice_port, qemu_chr_open_spice_port);
}
type_init(register_types);