On Wed, Aug 30, 2023 at 01:38:28PM +0400, marcandre.lur...@redhat.com wrote: > From: Marc-André Lureau <marcandre.lur...@redhat.com> > > Add stubs for the fallback paths. > > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > --- > ui/console-vc-stubs.c | 59 +++++++++++++++++++++++++++++++++++++++++++ > ui/meson.build | 2 +- > 2 files changed, 60 insertions(+), 1 deletion(-) > create mode 100644 ui/console-vc-stubs.c > > diff --git a/ui/console-vc-stubs.c b/ui/console-vc-stubs.c > new file mode 100644 > index 0000000000..76ea880d27 > --- /dev/null > +++ b/ui/console-vc-stubs.c > @@ -0,0 +1,59 @@ > +/* > + * SPDX-License-Identifier: GPL-2.0-or-later > + * QEMU VC stubs > + */ > +#include "qemu/osdep.h" > + > +#include "qapi/error.h" > +#include "qemu/error-report.h" > +#include "qemu/option.h" > +#include "chardev/char.h" > +#include "ui/console-priv.h" > + > +void qemu_text_console_select(QemuTextConsole *c) > +{ > +} > + > +const char * qemu_text_console_get_label(QemuTextConsole *c) > +{ > + return NULL; > +} > + > +void qemu_text_console_update_cursor(void) > +{ > +} > + > +void qemu_text_console_handle_keysym(QemuTextConsole *s, int keysym) > +{ > +} > + > +#define TYPE_CHARDEV_VC "chardev-vc" > + > +static void vc_chr_parse(QemuOpts *opts, ChardevBackend *backend, Error > **errp) > +{ > + const char *id = qemu_opts_id(opts); > + > + warn_report("%s: this is a dummy VC driver. " > + "Use '-nographic' or a different chardev.", id); > +}
Why should this be an error_setg() call given we have a errp parameter, so make this unsupportable config into an error ? Ignoring invalid user configs is not desirable in general. > + > +static void char_vc_class_init(ObjectClass *oc, void *data) > +{ > + ChardevClass *cc = CHARDEV_CLASS(oc); > + > + cc->parse = vc_chr_parse; > +} > + > +static const TypeInfo char_vc_type_info = { > + .name = TYPE_CHARDEV_VC, > + .parent = TYPE_CHARDEV, > + .class_init = char_vc_class_init, > +}; > + > +void qemu_console_early_init(void) > +{ > + /* set the default vc driver */ > + if (!object_class_by_name(TYPE_CHARDEV_VC)) { > + type_register(&char_vc_type_info); > + } > +} > diff --git a/ui/meson.build b/ui/meson.build > index 0a1e8272a3..3085e10a72 100644 > --- a/ui/meson.build > +++ b/ui/meson.build > @@ -6,7 +6,6 @@ system_ss.add(png) > system_ss.add(files( > 'clipboard.c', > 'console.c', > - 'console-vc.c', > 'cursor.c', > 'input-keymap.c', > 'input-legacy.c', > @@ -19,6 +18,7 @@ system_ss.add(files( > 'ui-qmp-cmds.c', > 'util.c', > )) > +system_ss.add(when: pixman, if_true: files('console-vc.c'), if_false: > files('console-vc-stubs.c')) > if dbus_display > system_ss.add(files('dbus-module.c')) > endif > -- > 2.41.0 > > With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|