[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/73] block/hmp: Allow info = NULL in print_block_in
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 15/73] block/hmp: Allow info = NULL in print_block_info() |
Date: |
Wed, 10 Dec 2014 11:33:41 +0100 |
This allows printing infos of BlockDriverStates that aren't at the root
of the graph (and logically implementing a BlockBackend).
Signed-off-by: Kevin Wolf <address@hidden>
---
hmp.c | 34 +++++++++++++++++++++++++---------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/hmp.c b/hmp.c
index 2e2b91b..05ccf5f 100644
--- a/hmp.c
+++ b/hmp.c
@@ -295,7 +295,21 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
{
ImageInfo *image_info;
- monitor_printf(mon, "%s", info->device);
+ assert(!info || !info->has_inserted || info->inserted == inserted);
+
+ if (info) {
+ monitor_printf(mon, "%s", info->device);
+ if (inserted && inserted->has_node_name) {
+ monitor_printf(mon, " (%s)", inserted->node_name);
+ }
+ } else {
+ assert(inserted);
+ monitor_printf(mon, "%s",
+ inserted->has_node_name
+ ? inserted->node_name
+ : "<anonymous>");
+ }
+
if (inserted) {
monitor_printf(mon, ": %s (%s%s%s)\n",
inserted->file,
@@ -306,15 +320,17 @@ static void print_block_info(Monitor *mon, BlockInfo
*info,
monitor_printf(mon, ": [not inserted]\n");
}
- if (info->has_io_status && info->io_status != BLOCK_DEVICE_IO_STATUS_OK) {
- monitor_printf(mon, " I/O status: %s\n",
- BlockDeviceIoStatus_lookup[info->io_status]);
- }
+ if (info) {
+ if (info->has_io_status && info->io_status !=
BLOCK_DEVICE_IO_STATUS_OK) {
+ monitor_printf(mon, " I/O status: %s\n",
+ BlockDeviceIoStatus_lookup[info->io_status]);
+ }
- if (info->removable) {
- monitor_printf(mon, " Removable device: %slocked, tray %s\n",
- info->locked ? "" : "not ",
- info->tray_open ? "open" : "closed");
+ if (info->removable) {
+ monitor_printf(mon, " Removable device: %slocked, tray %s\n",
+ info->locked ? "" : "not ",
+ info->tray_open ? "open" : "closed");
+ }
}
--
1.8.3.1
- [Qemu-devel] [PULL 00/73] Merging block-next for 2.3, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 01/73] block: Add bdrv_next_node, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 06/73] chardev: Add -qmp-pretty, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 07/73] iotests: _filter_qmp for pretty JSON output, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 09/73] blockdev: acquire AioContext in blockdev-snapshot-delete-internal-sync, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 02/73] block: Add bdrv_get_node_name, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 11/73] blockdev: acquire AioContext in eject, change, and block_passwd, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 03/73] block: Include "node-name" if present in query-blockstats, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 15/73] block/hmp: Allow info = NULL in print_block_info(),
Kevin Wolf <=
- [Qemu-devel] [PULL 13/73] block/qapi: Add cache information to query-block, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 10/73] blockdev: check for BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 14/73] block/hmp: Factor out print_block_info(), Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 16/73] block/hmp: Allow node-name in 'info block', Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 17/73] monitor: Fix HMP tab completion, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 21/73] ahci: replace SATA FIS type magic numbers with constants, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 23/73] block: Add AioContextNotifier functions to BB, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 19/73] iotests: Plain blkdebug filename generation, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 20/73] ahci: avoid #ifdef DEBUG_AHCI bitrot, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 22/73] block: Lift more functions into BlockBackend, Kevin Wolf, 2014/12/10