aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-09-29 15:51:14 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2015-10-19 10:13:07 +0200
commit479f09a130f774b0275134b5c44081ea71fe00b3 (patch)
tree9cd5c49ad640ada161bbb5342dc2c9b9328dc1cd
parentfa19d02539a56ac20d03b2eef775be7ffcdd695a (diff)
qemu-char: convert ringbuf 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.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 14cb253ff6..6632018cc3 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3222,9 +3222,12 @@ static void ringbuf_chr_close(struct CharDriverState *chr)
chr->opaque = NULL;
}
-static CharDriverState *qemu_chr_open_ringbuf(ChardevRingbuf *opts,
+static CharDriverState *qemu_chr_open_ringbuf(const char *id,
+ ChardevBackend *backend,
+ ChardevReturn *ret,
Error **errp)
{
+ ChardevRingbuf *opts = backend->ringbuf;
CharDriverState *chr;
RingBufCharDriver *d;
@@ -4361,7 +4364,7 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
break;
case CHARDEV_BACKEND_KIND_RINGBUF:
case CHARDEV_BACKEND_KIND_MEMORY:
- chr = qemu_chr_open_ringbuf(backend->ringbuf, &local_err);
+ abort();
break;
default:
error_setg(errp, "unknown chardev backend (%d)", backend->kind);
@@ -4427,7 +4430,7 @@ static void register_types(void)
register_char_driver("udp", CHARDEV_BACKEND_KIND_UDP, qemu_chr_parse_udp,
qmp_chardev_open_udp);
register_char_driver("ringbuf", CHARDEV_BACKEND_KIND_RINGBUF,
- qemu_chr_parse_ringbuf, NULL);
+ qemu_chr_parse_ringbuf, qemu_chr_open_ringbuf);
register_char_driver("file", CHARDEV_BACKEND_KIND_FILE,
qemu_chr_parse_file_out, qmp_chardev_open_file);
register_char_driver("stdio", CHARDEV_BACKEND_KIND_STDIO,
@@ -4458,7 +4461,7 @@ static void register_types(void)
qemu_chr_open_mux);
/* Bug-compatibility: */
register_char_driver("memory", CHARDEV_BACKEND_KIND_MEMORY,
- qemu_chr_parse_ringbuf, NULL);
+ qemu_chr_parse_ringbuf, qemu_chr_open_ringbuf);
/* this must be done after machine init, since we register FEs with muxes
* as part of realize functions like serial_isa_realizefn when -nographic
* is specified