summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-09-29 15:15:53 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2015-10-19 10:05:49 +0200
commitdbba8d1be3db5a52cfe200f219fbf8840d75cb14 (patch)
tree6c17cd65cb8d3d3aee8f58a9da85fb51928a64c5
parent20cbe7a27980ef7e2ecd307cd210fc23b3f0762e (diff)
downloadqemu-dbba8d1be3db5a52cfe200f219fbf8840d75cb14.tar.gz
qemu-dbba8d1be3db5a52cfe200f219fbf8840d75cb14.tar.bz2
qemu-dbba8d1be3db5a52cfe200f219fbf8840d75cb14.zip
qemu-char: convert socket backend to data-driven creation
Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--qemu-char.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 44a5a8d5c3..d0de7ef025 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -4154,11 +4154,14 @@ static gboolean socket_reconnect_timeout(gpointer opaque)
return false;
}
-static CharDriverState *qmp_chardev_open_socket(ChardevSocket *sock,
+static CharDriverState *qmp_chardev_open_socket(const char *id,
+ ChardevBackend *backend,
+ ChardevReturn *ret,
Error **errp)
{
CharDriverState *chr;
TCPCharDriver *s;
+ ChardevSocket *sock = backend->socket;
SocketAddress *addr = sock->addr;
bool do_nodelay = sock->has_nodelay ? sock->nodelay : false;
bool is_listen = sock->has_server ? sock->server : true;
@@ -4276,7 +4279,7 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
abort();
break;
case CHARDEV_BACKEND_KIND_SOCKET:
- chr = qmp_chardev_open_socket(backend->socket, &local_err);
+ abort();
break;
case CHARDEV_BACKEND_KIND_UDP:
chr = qmp_chardev_open_udp(backend->udp, &local_err);
@@ -4392,7 +4395,7 @@ static void register_types(void)
register_char_driver("null", CHARDEV_BACKEND_KIND_NULL, NULL,
NULL);
register_char_driver("socket", CHARDEV_BACKEND_KIND_SOCKET,
- qemu_chr_parse_socket, NULL);
+ qemu_chr_parse_socket, qmp_chardev_open_socket);
register_char_driver("udp", CHARDEV_BACKEND_KIND_UDP, qemu_chr_parse_udp,
NULL);
register_char_driver("ringbuf", CHARDEV_BACKEND_KIND_RINGBUF,