diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2013-04-17 09:45:10 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-04-25 14:45:46 -0500 |
commit | 95be0669a353d7f4093876a8fe94474e39c7af9d (patch) | |
tree | 793a7782e0ae2d01a956a31b3aaef16d50d176e0 | |
parent | 7c4869761d7f2e0a3f806a5359eea5d2473ec5d5 (diff) |
console: qom-ify QemuConsole
Just the minimal bits to turn QemuConsoles into Objects.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | hw/display/xenfb.c | 2 | ||||
-rw-r--r-- | include/ui/console.h | 15 | ||||
-rw-r--r-- | ui/console.c | 15 |
3 files changed, 30 insertions, 2 deletions
diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index f2eb89fa7f..f0333a0cad 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -987,7 +987,7 @@ wait_more: /* vfb */ fb = container_of(xfb, struct XenFB, c.xendev); - fb->c.con = graphic_console_init(&xenfb_ops, fb); + fb->c.con = graphic_console_init(NULL, &xenfb_ops, fb); fb->have_console = 1; /* vkbd */ diff --git a/include/ui/console.h b/include/ui/console.h index 1c82f51331..b8b0441a0c 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -2,6 +2,7 @@ #define CONSOLE_H #include "ui/qemu-pixman.h" +#include "qom/object.h" #include "qapi/qmp/qdict.h" #include "qemu/notify.h" #include "monitor/monitor.h" @@ -93,6 +94,20 @@ void kbd_put_keysym(int keysym); /* consoles */ +#define TYPE_QEMU_CONSOLE "qemu-console" +#define QEMU_CONSOLE(obj) \ + OBJECT_CHECK(QemuConsole, (obj), TYPE_QEMU_CONSOLE) +#define QEMU_CONSOLE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(QemuConsoleClass, (obj), TYPE_QEMU_CONSOLE) +#define QEMU_CONSOLE_CLASS(klass) \ + OBJECT_CLASS_CHECK(QemuConsoleClass, (klass), TYPE_QEMU_CONSOLE) + +typedef struct QemuConsoleClass QemuConsoleClass; + +struct QemuConsoleClass { + ObjectClass parent_class; +}; + #define QEMU_BIG_ENDIAN_FLAG 0x01 #define QEMU_ALLOCATED_FLAG 0x02 diff --git a/ui/console.c b/ui/console.c index 4f9219e38d..e9f30802b6 100644 --- a/ui/console.c +++ b/ui/console.c @@ -113,6 +113,8 @@ typedef enum { } console_type_t; struct QemuConsole { + Object parent; + int index; console_type_t console_type; DisplayState *ds; @@ -1197,12 +1199,14 @@ static void text_console_update(void *opaque, console_ch_t *chardata) static QemuConsole *new_console(DisplayState *ds, console_type_t console_type) { + Object *obj; QemuConsole *s; int i; if (nb_consoles >= MAX_CONSOLES) return NULL; - s = g_malloc0(sizeof(QemuConsole)); + obj = object_new(TYPE_QEMU_CONSOLE); + s = QEMU_CONSOLE(obj); if (!active_console || ((active_console->console_type != GRAPHIC_CONSOLE) && (console_type == GRAPHIC_CONSOLE))) { active_console = s; @@ -1920,8 +1924,17 @@ static void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, } } +static const TypeInfo qemu_console_info = { + .name = TYPE_QEMU_CONSOLE, + .parent = TYPE_OBJECT, + .instance_size = sizeof(QemuConsole), + .class_size = sizeof(QemuConsoleClass), +}; + + static void register_types(void) { + type_register_static(&qemu_console_info); register_char_driver_qapi("vc", CHARDEV_BACKEND_KIND_VC, qemu_chr_parse_vc); } |