qemu-char: convert spice backend to data-driven creation
Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
122e5ed441
commit
68145e178a
@ -43,9 +43,7 @@ int qemu_spice_set_pw_expire(time_t expires);
|
|||||||
int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
|
int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
|
||||||
const char *subject);
|
const char *subject);
|
||||||
|
|
||||||
CharDriverState *qemu_chr_open_spice_vmc(const char *type);
|
|
||||||
#if SPICE_SERVER_VERSION >= 0x000c02
|
#if SPICE_SERVER_VERSION >= 0x000c02
|
||||||
CharDriverState *qemu_chr_open_spice_port(const char *name);
|
|
||||||
void qemu_spice_register_ports(void);
|
void qemu_spice_register_ports(void);
|
||||||
#else
|
#else
|
||||||
static inline CharDriverState *qemu_chr_open_spice_port(const char *name)
|
static inline CharDriverState *qemu_chr_open_spice_port(const char *name)
|
||||||
|
@ -4350,14 +4350,12 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
|
|||||||
case CHARDEV_BACKEND_KIND_CONSOLE:
|
case CHARDEV_BACKEND_KIND_CONSOLE:
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_SPICE
|
|
||||||
case CHARDEV_BACKEND_KIND_SPICEVMC:
|
case CHARDEV_BACKEND_KIND_SPICEVMC:
|
||||||
chr = qemu_chr_open_spice_vmc(backend->spicevmc->type);
|
abort();
|
||||||
break;
|
break;
|
||||||
case CHARDEV_BACKEND_KIND_SPICEPORT:
|
case CHARDEV_BACKEND_KIND_SPICEPORT:
|
||||||
chr = qemu_chr_open_spice_port(backend->spiceport->fqdn);
|
abort();
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case CHARDEV_BACKEND_KIND_VC:
|
case CHARDEV_BACKEND_KIND_VC:
|
||||||
chr = vc_init(backend->vc);
|
chr = vc_init(backend->vc);
|
||||||
break;
|
break;
|
||||||
|
@ -296,15 +296,14 @@ static CharDriverState *chr_open(const char *subtype,
|
|||||||
return chr;
|
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();
|
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) {
|
for (; *psubtype != NULL; ++psubtype) {
|
||||||
if (strcmp(type, *psubtype) == 0) {
|
if (strcmp(type, *psubtype) == 0) {
|
||||||
break;
|
break;
|
||||||
@ -320,8 +319,12 @@ CharDriverState *qemu_chr_open_spice_vmc(const char *type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if SPICE_SERVER_VERSION >= 0x000c02
|
#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;
|
CharDriverState *chr;
|
||||||
SpiceCharDriver *s;
|
SpiceCharDriver *s;
|
||||||
|
|
||||||
@ -379,9 +382,9 @@ static void qemu_chr_parse_spice_port(QemuOpts *opts, ChardevBackend *backend,
|
|||||||
static void register_types(void)
|
static void register_types(void)
|
||||||
{
|
{
|
||||||
register_char_driver("spicevmc", CHARDEV_BACKEND_KIND_SPICEVMC,
|
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,
|
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);
|
type_init(register_types);
|
||||||
|
@ -20,7 +20,6 @@ stub-obj-y += mon-is-qmp.o
|
|||||||
stub-obj-y += mon-printf.o
|
stub-obj-y += mon-printf.o
|
||||||
stub-obj-y += monitor-init.o
|
stub-obj-y += monitor-init.o
|
||||||
stub-obj-y += notify-event.o
|
stub-obj-y += notify-event.o
|
||||||
stub-obj-$(CONFIG_SPICE) += qemu-chr-open-spice.o
|
|
||||||
stub-obj-y += qtest.o
|
stub-obj-y += qtest.o
|
||||||
stub-obj-y += reset.o
|
stub-obj-y += reset.o
|
||||||
stub-obj-y += runstate-check.o
|
stub-obj-y += runstate-check.o
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
#include "qemu-common.h"
|
|
||||||
#include "ui/qemu-spice.h"
|
|
||||||
|
|
||||||
CharDriverState *qemu_chr_open_spice_vmc(const char *type)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if SPICE_SERVER_VERSION >= 0x000c02
|
|
||||||
CharDriverState *qemu_chr_open_spice_port(const char *name)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user