ui/console: introduce different console objects

Boilerplate code to introduce different object types for the different
console types.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230830093843.3531473-20-marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2023-08-30 13:37:53 +04:00
parent 098d57e7c0
commit b208f745a8

View File

@ -128,6 +128,45 @@ struct QemuConsole {
OBJECT_DEFINE_TYPE(QemuConsole, qemu_console, QEMU_CONSOLE, OBJECT)
typedef struct QemuGraphicConsole {
QemuConsole parent;
} QemuGraphicConsole;
typedef QemuConsoleClass QemuGraphicConsoleClass;
#define TYPE_QEMU_GRAPHIC_CONSOLE "qemu-graphic-console"
OBJECT_DECLARE_SIMPLE_TYPE(QemuGraphicConsole, QEMU_GRAPHIC_CONSOLE)
OBJECT_DEFINE_TYPE(QemuGraphicConsole, qemu_graphic_console, QEMU_GRAPHIC_CONSOLE, QEMU_CONSOLE)
#define QEMU_IS_GRAPHIC_CONSOLE(c) \
object_dynamic_cast(OBJECT(c), TYPE_QEMU_GRAPHIC_CONSOLE)
typedef struct QemuTextConsole {
QemuConsole parent;
} QemuTextConsole;
typedef QemuConsoleClass QemuTextConsoleClass;
#define TYPE_QEMU_TEXT_CONSOLE "qemu-text-console"
OBJECT_DECLARE_SIMPLE_TYPE(QemuTextConsole, QEMU_TEXT_CONSOLE)
OBJECT_DEFINE_TYPE(QemuTextConsole, qemu_text_console, QEMU_TEXT_CONSOLE, QEMU_CONSOLE)
#define QEMU_IS_TEXT_CONSOLE(c) \
object_dynamic_cast(OBJECT(c), TYPE_QEMU_TEXT_CONSOLE)
typedef struct QemuFixedTextConsole {
QemuTextConsole parent;
} QemuFixedTextConsole;
typedef QemuTextConsoleClass QemuFixedTextConsoleClass;
#define TYPE_QEMU_FIXED_TEXT_CONSOLE "qemu-fixed-text-console"
OBJECT_DECLARE_SIMPLE_TYPE(QemuFixedTextConsole, QEMU_FIXED_TEXT_CONSOLE)
OBJECT_DEFINE_TYPE(QemuFixedTextConsole, qemu_fixed_text_console, QEMU_FIXED_TEXT_CONSOLE, QEMU_TEXT_CONSOLE)
#define QEMU_IS_FIXED_TEXT_CONSOLE(c) \
object_dynamic_cast(OBJECT(c), TYPE_QEMU_FIXED_TEXT_CONSOLE)
struct VCChardev {
Chardev parent;
QemuConsole *console;
@ -1338,6 +1377,51 @@ qemu_console_init(Object *obj)
c->window_id = -1;
}
static void
qemu_graphic_console_finalize(Object *obj)
{
}
static void
qemu_graphic_console_class_init(ObjectClass *oc, void *data)
{
}
static void
qemu_graphic_console_init(Object *obj)
{
}
static void
qemu_text_console_finalize(Object *obj)
{
}
static void
qemu_text_console_class_init(ObjectClass *oc, void *data)
{
}
static void
qemu_text_console_init(Object *obj)
{
}
static void
qemu_fixed_text_console_finalize(Object *obj)
{
}
static void
qemu_fixed_text_console_class_init(ObjectClass *oc, void *data)
{
}
static void
qemu_fixed_text_console_init(Object *obj)
{
}
static QemuConsole *new_console(console_type_t console_type,
uint32_t head)
{