[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/9] chardev: hotplug, hmp
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 5/9] chardev: hotplug, hmp |
Date: |
Wed, 19 Dec 2012 16:59:03 +0100 |
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hmp-commands.hx | 32 ++++++++++++++++++++++++++++++++
hmp.c | 23 +++++++++++++++++++++++
hmp.h | 2 ++
3 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 010b8c9..183e231 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1485,6 +1485,38 @@ passed since 1970, i.e. unix epoch.
ETEXI
{
+ .name = "chardev_add",
+ .args_type = "args:s",
+ .params = "args",
+ .help = "add chardev",
+ .mhandler.cmd = hmp_chardev_add,
+ },
+
+STEXI
address@hidden chardev_add args
address@hidden chardev_add
+
+chardev_add accepts the same parameters as the -chardev command line switch.
+
+ETEXI
+
+ {
+ .name = "chardev_remove",
+ .args_type = "id:s",
+ .params = "id",
+ .help = "remove chardev",
+ .mhandler.cmd = hmp_chardev_remove,
+ },
+
+STEXI
address@hidden chardev_remove id
address@hidden chardev_remove
+
+Removes the chardev @var{id}.
+
+ETEXI
+
+ {
.name = "info",
.args_type = "item:s?",
.params = "[subcommand]",
diff --git a/hmp.c b/hmp.c
index 180ba2b..7f3ddf5 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1335,3 +1335,26 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict
*qdict)
qmp_nbd_server_stop(&errp);
hmp_handle_error(mon, &errp);
}
+
+void hmp_chardev_add(Monitor *mon, const QDict *qdict)
+{
+ const char *args = qdict_get_str(qdict, "args");
+ Error *err = NULL;
+ QemuOpts *opts;
+
+ opts = qemu_opts_parse(qemu_find_opts("chardev"), args, 1);
+ if (opts == NULL) {
+ error_setg(&err, "Parsing chardev args failed\n");
+ } else {
+ qemu_chr_new_from_opts(opts, NULL, &err);
+ }
+ hmp_handle_error(mon, &err);
+}
+
+void hmp_chardev_remove(Monitor *mon, const QDict *qdict)
+{
+ Error *local_err = NULL;
+
+ qmp_chardev_remove(qdict_get_str(qdict, "id"), &local_err);
+ hmp_handle_error(mon, &local_err);
+}
diff --git a/hmp.h b/hmp.h
index 0ab03be..e67e482 100644
--- a/hmp.h
+++ b/hmp.h
@@ -80,5 +80,7 @@ void hmp_screen_dump(Monitor *mon, const QDict *qdict);
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict);
void hmp_nbd_server_add(Monitor *mon, const QDict *qdict);
void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict);
+void hmp_chardev_add(Monitor *mon, const QDict *qdict);
+void hmp_chardev_remove(Monitor *mon, const QDict *qdict);
#endif
--
1.7.1
- [Qemu-devel] [PATCH 9/9] chardev: hotplug, qmp, parallel, (continued)
- [Qemu-devel] [PATCH 9/9] chardev: hotplug, qmp, parallel, Gerd Hoffmann, 2012/12/19
- [Qemu-devel] [PATCH 8/9] chardev: hotplug, qmp, serial, Gerd Hoffmann, 2012/12/19
- [Qemu-devel] [PATCH 6/9] chardev: hotplug, qmp, file, Gerd Hoffmann, 2012/12/19
- [Qemu-devel] [PATCH 7/9] chardev: hotplug, qmp, tty, Gerd Hoffmann, 2012/12/19
- [Qemu-devel] [PATCH 4/9] chardev: hotplug, qmp, null, Gerd Hoffmann, 2012/12/19
- [Qemu-devel] [PATCH 1/9] chardev: add error reporting for qemu_chr_new_from_opts, Gerd Hoffmann, 2012/12/19
- [Qemu-devel] [PATCH 3/9] chardev: reduce chardev ifdef mess a bit, Gerd Hoffmann, 2012/12/19
- [Qemu-devel] [PATCH 5/9] chardev: hotplug, hmp,
Gerd Hoffmann <=
- Re: [Qemu-devel] [PATCH RfC 0/9] chardev hotplug, Michal Privoznik, 2012/12/20
- Re: [Qemu-devel] [PATCH RfC 0/9] chardev hotplug, Daniel P. Berrange, 2012/12/20
- Re: [Qemu-devel] [PATCH RfC 0/9] chardev hotplug, Paolo Bonzini, 2012/12/20
- Re: [Qemu-devel] [PATCH RfC 0/9] chardev hotplug, Gerd Hoffmann, 2012/12/20
- Re: [Qemu-devel] [PATCH RfC 0/9] chardev hotplug, Gerd Hoffmann, 2012/12/20
- Re: [Qemu-devel] [PATCH RfC 0/9] chardev hotplug, Gerd Hoffmann, 2012/12/21
- Re: [Qemu-devel] [PATCH RfC 0/9] chardev hotplug, Paolo Bonzini, 2012/12/21
- Re: [Qemu-devel] [PATCH RfC 0/9] chardev hotplug, Gerd Hoffmann, 2012/12/21
- Re: [Qemu-devel] [PATCH RfC 0/9] chardev hotplug, Paolo Bonzini, 2012/12/21
- Re: [Qemu-devel] [PATCH RfC 0/9] chardev hotplug, Gerd Hoffmann, 2012/12/21