Commit f1088908 authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

chardev: add hmp hotplug commands

Add chardev-add and chardev-remove commands to the human monitor.
chardev-add accepts the same syntax as -chardev, chardev-remove
expects a chardev id.
Signed-off-by: default avatarGerd Hoffmann <>
parent f1a1a356
......@@ -1482,6 +1482,38 @@ Password is invalidated at the given time. @var{nsec} are the seconds
passed since 1970, i.e. unix epoch.
@end table
.name = "chardev-add",
.args_type = "args:s",
.params = "args",
.help = "add chardev",
.mhandler.cmd = hmp_chardev_add,
@item chardev_add args
@findex chardev_add
chardev_add accepts the same parameters as the -chardev command line switch.
.name = "chardev-remove",
.args_type = "id:s",
.params = "id",
.help = "remove chardev",
.mhandler.cmd = hmp_chardev_remove,
@item chardev_remove id
@findex chardev_remove
Removes the chardev @var{id}.
......@@ -1336,3 +1336,26 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict)
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);
......@@ -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);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment