From 72ac876248ca2d33b3e1170b2f86fb68daaacdc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Sat, 22 Oct 2016 12:53:02 +0300 Subject: char: rename chr_close/chr_free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function is used to free the backend opaque pointer, let's name it accordingly. Signed-off-by: Marc-André Lureau Message-Id: <20161022095318.17775-23-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- spice-qemu-char.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spice-qemu-char.c') diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 351fcaa..930b8c5 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -199,7 +199,7 @@ static int spice_chr_write(CharDriverState *chr, const uint8_t *buf, int len) return read_bytes; } -static void spice_chr_close(struct CharDriverState *chr) +static void spice_chr_free(struct CharDriverState *chr) { SpiceCharDriver *s = chr->opaque; @@ -289,7 +289,7 @@ static CharDriverState *chr_open(const char *subtype, chr->opaque = s; chr->chr_write = spice_chr_write; chr->chr_add_watch = spice_chr_add_watch; - chr->chr_close = spice_chr_close; + chr->chr_free = spice_chr_free; chr->chr_set_fe_open = set_fe_open; chr->explicit_be_open = true; chr->chr_fe_event = spice_chr_fe_event; -- cgit v1.1 From 58fa54947e6b8a26aaeb1b719eabfd0e1461a2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Sat, 22 Oct 2016 13:09:40 +0300 Subject: char: remove unused qemu_chr_fe_event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I introduced this function in d61b0c9a2f7f, but it isn't used. Furthermore, it was incomplete, as it would need to translate QEMU chr events to Spice port events. (presumably it was used in the follow-up NBD-spice series that was not completed: http://lists.gnu.org/archive/html/qemu-devel/2013-11/msg02024.html) Signed-off-by: Marc-André Lureau Message-Id: <20161022100951.19562-4-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- spice-qemu-char.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'spice-qemu-char.c') diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 930b8c5..89fae6d 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -236,15 +236,6 @@ static void spice_port_set_fe_open(struct CharDriverState *chr, int fe_open) #endif } -static void spice_chr_fe_event(struct CharDriverState *chr, int event) -{ -#if SPICE_SERVER_VERSION >= 0x000c02 - SpiceCharDriver *s = chr->opaque; - - spice_server_port_event(&s->sin, event); -#endif -} - static void print_allowed_subtypes(void) { const char** psubtype; @@ -292,7 +283,6 @@ static CharDriverState *chr_open(const char *subtype, chr->chr_free = spice_chr_free; chr->chr_set_fe_open = set_fe_open; chr->explicit_be_open = true; - chr->chr_fe_event = spice_chr_fe_event; chr->chr_accept_input = spice_chr_accept_input; QLIST_INSERT_HEAD(&spice_chars, s, next); -- cgit v1.1 From 82878dac6fcd16cb4fa47266bcd3dd03df436dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Sat, 22 Oct 2016 13:09:43 +0300 Subject: char: remove explicit_be_open from CharDriverState MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's only used in qmp_chardev_add(), so use a create() argument instead. Also switched to typedef functions for CharDriverParse/CharDriverCreate. Signed-off-by: Marc-André Lureau Message-Id: <20161022100951.19562-7-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- spice-qemu-char.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'spice-qemu-char.c') diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 89fae6d..276c4ae 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -282,7 +282,6 @@ static CharDriverState *chr_open(const char *subtype, chr->chr_add_watch = spice_chr_add_watch; chr->chr_free = spice_chr_free; chr->chr_set_fe_open = set_fe_open; - chr->explicit_be_open = true; chr->chr_accept_input = spice_chr_accept_input; QLIST_INSERT_HEAD(&spice_chars, s, next); @@ -293,6 +292,7 @@ static CharDriverState *chr_open(const char *subtype, static CharDriverState *qemu_chr_open_spice_vmc(const char *id, ChardevBackend *backend, ChardevReturn *ret, + bool *be_opened, Error **errp) { ChardevSpiceChannel *spicevmc = backend->u.spicevmc.data; @@ -311,6 +311,7 @@ static CharDriverState *qemu_chr_open_spice_vmc(const char *id, return NULL; } + *be_opened = false; return chr_open(type, spice_vmc_set_fe_open, common, errp); } @@ -318,6 +319,7 @@ static CharDriverState *qemu_chr_open_spice_vmc(const char *id, static CharDriverState *qemu_chr_open_spice_port(const char *id, ChardevBackend *backend, ChardevReturn *ret, + bool *be_opened, Error **errp) { ChardevSpicePort *spiceport = backend->u.spiceport.data; @@ -335,6 +337,7 @@ static CharDriverState *qemu_chr_open_spice_port(const char *id, if (!chr) { return NULL; } + *be_opened = false; s = chr->opaque; s->sin.portname = g_strdup(name); -- cgit v1.1