aboutsummaryrefslogtreecommitdiff
path: root/spice-qemu-char.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-12-09 00:50:12 +0300
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-01-31 13:01:47 +0400
commit88cace9f119b85ac2d40a8b10c24e05ccfa6da07 (patch)
tree9aa623eb65581a78d3c1d910f2a787990260c1eb /spice-qemu-char.c
parent8cddc46990ab0310af9fb148143326f832802fca (diff)
char: get rid of CharDriver
qemu_chr_new_from_opts() is modified to not need CharDriver backend[] array, but uses instead objectified qmp_query_chardev_backends() and char_get_class(). The alias field is moved outside in a ChardevAlias[], similar to QDevAlias for devices. "kind" and "parse" are moved to ChardevClass ("kind" is to be removed next) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'spice-qemu-char.c')
-rw-r--r--spice-qemu-char.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 3902202a35..17305830ab 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -380,6 +380,8 @@ static void char_spicevmc_class_init(ObjectClass *oc, void *data)
{
ChardevClass *cc = CHARDEV_CLASS(oc);
+ cc->kind = CHARDEV_BACKEND_KIND_SPICEVMC;
+ cc->parse = qemu_chr_parse_spice_vmc;
cc->open = qemu_chr_open_spice_vmc;
cc->chr_set_fe_open = spice_vmc_set_fe_open;
}
@@ -394,6 +396,8 @@ static void char_spiceport_class_init(ObjectClass *oc, void *data)
{
ChardevClass *cc = CHARDEV_CLASS(oc);
+ cc->kind = CHARDEV_BACKEND_KIND_SPICEPORT;
+ cc->parse = qemu_chr_parse_spice_port;
cc->open = qemu_chr_open_spice_port;
cc->chr_set_fe_open = spice_port_set_fe_open;
}
@@ -406,17 +410,6 @@ static const TypeInfo char_spiceport_type_info = {
static void register_types(void)
{
- static const CharDriver vmc_driver = {
- .kind = CHARDEV_BACKEND_KIND_SPICEVMC,
- .parse = qemu_chr_parse_spice_vmc,
- };
- static const CharDriver port_driver = {
- .kind = CHARDEV_BACKEND_KIND_SPICEPORT,
- .parse = qemu_chr_parse_spice_port,
- };
- register_char_driver(&vmc_driver);
- register_char_driver(&port_driver);
-
type_register_static(&char_spice_type_info);
type_register_static(&char_spicevmc_type_info);
type_register_static(&char_spiceport_type_info);