diff options
author | Lin Ma <lma@suse.com> | 2016-08-17 01:13:52 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-09-13 19:08:47 +0200 |
commit | 517b3d40166f18e321e964e5fe0d6260e92b2121 (patch) | |
tree | 86323e58ac4ebb22937efd15eb5cb6dee74a19d0 /qemu-char.c | |
parent | 173134467a585c66c43467c71b834cd0b488cf46 (diff) | |
download | qemu-517b3d40166f18e321e964e5fe0d6260e92b2121.zip qemu-517b3d40166f18e321e964e5fe0d6260e92b2121.tar.gz qemu-517b3d40166f18e321e964e5fe0d6260e92b2121.tar.bz2 |
chardev: Add 'help' option to print all available chardev backend types
Signed-off-by: Lin Ma <lma@suse.com>
Message-Id: <20160816171352.17021-1-lma@suse.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r-- | qemu-char.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/qemu-char.c b/qemu-char.c index 5f82ebb..cf6a27a 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -39,6 +39,7 @@ #include "io/channel-file.h" #include "io/channel-tls.h" #include "sysemu/replay.h" +#include "qemu/help_option.h" #include <zlib.h> @@ -3879,16 +3880,26 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, const char *id = qemu_opts_id(opts); char *bid = NULL; - if (id == NULL) { - error_setg(errp, "chardev: no id specified"); - goto err; - } - if (qemu_opt_get(opts, "backend") == NULL) { error_setg(errp, "chardev: \"%s\" missing backend", qemu_opts_id(opts)); goto err; } + + if (is_help_option(qemu_opt_get(opts, "backend"))) { + fprintf(stderr, "Available chardev backend types:\n"); + for (i = backends; i; i = i->next) { + cd = i->data; + fprintf(stderr, "%s\n", cd->name); + } + exit(!is_help_option(qemu_opt_get(opts, "backend"))); + } + + if (id == NULL) { + error_setg(errp, "chardev: no id specified"); + goto err; + } + for (i = backends; i; i = i->next) { cd = i->data; |