qemu-char: convert testdev backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2015-09-29 15:33:42 +02:00
parent e47666b8d1
commit 0498790173
5 changed files with 6 additions and 14 deletions

View File

@ -108,7 +108,10 @@ static void testdev_close(struct CharDriverState *chr)
g_free(testdev); g_free(testdev);
} }
CharDriverState *chr_testdev_init(void) static CharDriverState *chr_testdev_init(const char *id,
ChardevBackend *backend,
ChardevReturn *ret,
Error **errp)
{ {
TestdevCharState *testdev; TestdevCharState *testdev;
CharDriverState *chr; CharDriverState *chr;
@ -126,7 +129,7 @@ CharDriverState *chr_testdev_init(void)
static void register_types(void) static void register_types(void)
{ {
register_char_driver("testdev", CHARDEV_BACKEND_KIND_TESTDEV, NULL, register_char_driver("testdev", CHARDEV_BACKEND_KIND_TESTDEV, NULL,
NULL); chr_testdev_init);
} }
type_init(register_types); type_init(register_types);

View File

@ -356,9 +356,6 @@ extern int term_escape_char;
CharDriverState *qemu_char_get_next_serial(void); CharDriverState *qemu_char_get_next_serial(void);
/* testdev.c */
CharDriverState *chr_testdev_init(void);
/* console.c */ /* console.c */
typedef CharDriverState *(VcHandler)(ChardevVC *vc); typedef CharDriverState *(VcHandler)(ChardevVC *vc);

View File

@ -4318,7 +4318,7 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
abort(); abort();
break; break;
case CHARDEV_BACKEND_KIND_TESTDEV: case CHARDEV_BACKEND_KIND_TESTDEV:
chr = chr_testdev_init(); abort();
break; break;
case CHARDEV_BACKEND_KIND_STDIO: case CHARDEV_BACKEND_KIND_STDIO:
chr = qemu_chr_open_stdio(backend->stdio); chr = qemu_chr_open_stdio(backend->stdio);

View File

@ -1,6 +1,5 @@
stub-obj-y += arch-query-cpu-def.o stub-obj-y += arch-query-cpu-def.o
stub-obj-y += bdrv-commit-all.o stub-obj-y += bdrv-commit-all.o
stub-obj-y += chr-testdev.o
stub-obj-y += clock-warp.o stub-obj-y += clock-warp.o
stub-obj-y += cpu-get-clock.o stub-obj-y += cpu-get-clock.o
stub-obj-y += cpu-get-icount.o stub-obj-y += cpu-get-icount.o

View File

@ -1,7 +0,0 @@
#include "qemu-common.h"
#include "sysemu/char.h"
CharDriverState *chr_testdev_init(void)
{
return 0;
}