[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/21] monitor: Use traditional command interface for
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 05/21] monitor: Use traditional command interface for HMP drive_del |
Date: |
Tue, 2 Jun 2015 10:23:43 +0200 |
All QMP commands use the "new" handler interface (mhandler.cmd_new).
Most HMP commands still use the traditional interface (mhandler.cmd),
but a few use the "new" one. Complicates handle_user_command() for no
gain, so I'm converting these to the traditional interface.
For drive_del, that's easy: hmp_drive_del() sheds its unused last
parameter, and its return value, which the caller ignored anyway.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Luiz Capitulino <address@hidden>
---
blockdev.c | 9 ++++-----
hmp-commands.hx | 3 +--
include/sysemu/blockdev.h | 2 +-
3 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 5eaf77e..de94a8b 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2113,7 +2113,7 @@ void qmp_block_dirty_bitmap_clear(const char *node, const
char *name,
aio_context_release(aio_context);
}
-int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
+void hmp_drive_del(Monitor *mon, const QDict *qdict)
{
const char *id = qdict_get_str(qdict, "id");
BlockBackend *blk;
@@ -2124,14 +2124,14 @@ int hmp_drive_del(Monitor *mon, const QDict *qdict,
QObject **ret_data)
blk = blk_by_name(id);
if (!blk) {
error_report("Device '%s' not found", id);
- return -1;
+ return;
}
bs = blk_bs(blk);
if (!blk_legacy_dinfo(blk)) {
error_report("Deleting device added with blockdev-add"
" is not supported");
- return -1;
+ return;
}
aio_context = bdrv_get_aio_context(bs);
@@ -2140,7 +2140,7 @@ int hmp_drive_del(Monitor *mon, const QDict *qdict,
QObject **ret_data)
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_DRIVE_DEL, &local_err)) {
error_report_err(local_err);
aio_context_release(aio_context);
- return -1;
+ return;
}
/* quiesce block driver; prevent further io */
@@ -2163,7 +2163,6 @@ int hmp_drive_del(Monitor *mon, const QDict *qdict,
QObject **ret_data)
}
aio_context_release(aio_context);
- return 0;
}
void qmp_block_resize(bool has_device, const char *device,
diff --git a/hmp-commands.hx b/hmp-commands.hx
index af2de61..5257969 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -178,8 +178,7 @@ ETEXI
.args_type = "id:B",
.params = "device",
.help = "remove host block device",
- .user_print = monitor_user_noop,
- .mhandler.cmd_new = hmp_drive_del,
+ .mhandler.cmd = hmp_drive_del,
},
STEXI
diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h
index 7ca59b5..3104150 100644
--- a/include/sysemu/blockdev.h
+++ b/include/sysemu/blockdev.h
@@ -66,5 +66,5 @@ DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType
block_default_type);
void qmp_change_blockdev(const char *device, const char *filename,
const char *format, Error **errp);
void hmp_commit(Monitor *mon, const QDict *qdict);
-int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data);
+void hmp_drive_del(Monitor *mon, const QDict *qdict);
#endif
--
1.9.3
- [Qemu-devel] [PULL 00/21] Monitor patches, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 08/21] monitor: Drop unused "new" HMP command interface, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 11/21] monitor: Propagate errors through invalid_qmp_mode(), Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 02/21] monitor: Clean up after previous commit, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 12/21] monitor: Wean monitor_protocol_emitter() off mon->error, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 05/21] monitor: Use traditional command interface for HMP drive_del,
Markus Armbruster <=
- [Qemu-devel] [PULL 06/21] monitor: Use traditional command interface for HMP device_add, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 09/21] monitor: Propagate errors through qmp_check_client_args(), Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 07/21] monitor: Use trad. command interface for HMP pcie_aer_inject_error, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 03/21] monitor: Improve and document client_migrate_info protocol error, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 04/21] monitor: Convert client_migrate_info to QAPI, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 01/21] monitor: Drop broken, unused asynchronous command interface, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 13/21] monitor: Inline monitor_has_error() into its only caller, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 20/21] monitor: Rename monitor_ctrl_mode() to monitor_is_qmp(), Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 21/21] monitor: Change return type of monitor_cur_is_qmp() to bool, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 10/21] monitor: Propagate errors through qmp_check_input_obj(), Markus Armbruster, 2015/06/02