diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-09-29 15:23:42 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-10-19 10:05:49 +0200 |
commit | c2e75a432b907562cf93772b7d058d1ec8a8f8f1 (patch) | |
tree | f23822389e9dda7b885dd7d5265cef3d67689a47 /qemu-char.c | |
parent | e79b80daa252ffb4bc5c84c836714eb45ab3bb68 (diff) | |
download | qemu-c2e75a432b907562cf93772b7d058d1ec8a8f8f1.tar.gz qemu-c2e75a432b907562cf93772b7d058d1ec8a8f8f1.tar.bz2 qemu-c2e75a432b907562cf93772b7d058d1ec8a8f8f1.zip |
qemu-char: convert pty backend to data-driven creation
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r-- | qemu-char.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/qemu-char.c b/qemu-char.c index de4d9d8cc8..15c1a1547f 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1390,7 +1390,9 @@ static void pty_chr_close(struct CharDriverState *chr) } static CharDriverState *qemu_chr_open_pty(const char *id, - ChardevReturn *ret) + ChardevBackend *backend, + ChardevReturn *ret, + Error **errp) { CharDriverState *chr; PtyCharDriver *s; @@ -1399,6 +1401,7 @@ static CharDriverState *qemu_chr_open_pty(const char *id, master_fd = qemu_openpty_raw(&slave_fd, pty_name); if (master_fd < 0) { + error_setg_errno(errp, errno, "Failed to create PTY"); return NULL; } @@ -4287,11 +4290,9 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend, case CHARDEV_BACKEND_KIND_UDP: abort(); break; -#ifdef HAVE_CHARDEV_PTY case CHARDEV_BACKEND_KIND_PTY: - chr = qemu_chr_open_pty(id, ret); + abort(); break; -#endif case CHARDEV_BACKEND_KIND_NULL: chr = qemu_chr_open_null(); break; @@ -4419,8 +4420,10 @@ static void register_types(void) register_char_driver("parport", CHARDEV_BACKEND_KIND_PARALLEL, qemu_chr_parse_parallel, qmp_chardev_open_parallel); #endif +#ifdef HAVE_CHARDEV_PTY register_char_driver("pty", CHARDEV_BACKEND_KIND_PTY, NULL, - NULL); + qemu_chr_open_pty); +#endif register_char_driver("console", CHARDEV_BACKEND_KIND_CONSOLE, NULL, NULL); register_char_driver("pipe", CHARDEV_BACKEND_KIND_PIPE, |