On 10/9/21 23:08, [email protected] wrote:
> From: Marc-André Lureau <[email protected]>
>
> Export the default consoles over the D-Bus chardev.
>
> Signed-off-by: Marc-André Lureau <[email protected]>
> ---
> ui/dbus.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 53 insertions(+)
> +static void
> +dbus_vc_parse(QemuOpts *opts, ChardevBackend *backend,
> + Error **errp)
> +{
> + DBusVCClass *klass =
> DBUS_VC_CLASS(object_class_by_name(TYPE_CHARDEV_VC));
> + const char *name = qemu_opt_get(opts, "name");
> + const char *id = qemu_opts_id(opts);
> +
> + if (name == NULL) {
> + name = "";
Could also drop this assignation, and:
> + if (g_str_has_prefix(id, "compat_monitor")) {
> + name = "org.qemu.monitor.hmp.0";
> + }
else
> + if (g_str_has_prefix(id, "serial")) {
> + name = "org.qemu.console.serial.0";
> + }
else {
name = "";
}
> + if (!qemu_opt_set(opts, "name", name, errp)) {
> + return;
> + }
> + }
> +
> + klass->parent_parse(opts, backend, errp);
> +}
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>