@@ -212,6 +212,7 @@ void qemu_chr_be_update_read_handlers(Chardev *s,
*/
void qemu_chr_be_event(Chardev *s, QEMUChrEvent event);
+void qemu_chr_print_types(void);
int qemu_chr_add_client(Chardev *s, int fd);
Chardev *qemu_chr_find(const char *name);
@@ -633,6 +633,15 @@ ChardevBackend *qemu_chr_parse_opts(QemuOpts *opts, Error **errp)
return backend;
}
+void qemu_chr_print_types(void)
+{
+ g_autoptr(GString) str = g_string_new("");
+
+ chardev_name_foreach(help_string_append, str);
+
+ qemu_printf("Available chardev backend types: %s\n", str->str);
+}
+
Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context,
Error **errp)
{
@@ -644,12 +653,7 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context,
char *bid = NULL;
if (name && is_help_option(name)) {
- GString *str = g_string_new("");
-
- chardev_name_foreach(help_string_append, str);
-
- qemu_printf("Available chardev backend types: %s\n", str->str);
- g_string_free(str, true);
+ qemu_chr_print_types();
return NULL;
}