[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 20/23] block/qapi: Convert qmp_query_block() to B
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH v5 20/23] block/qapi: Convert qmp_query_block() to BlockBackend |
Date: |
Thu, 2 Oct 2014 11:04:55 +0200 |
Much more command code needs conversion. I start with this one
because it's using bdrv_dev_* functions, which I'm about to lift into
BlockBackend.
While there, give bdrv_query_info() internal linkage.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: BenoƮt Canet <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
---
block/qapi.c | 15 ++++++++-------
include/block/qapi.h | 3 ---
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/block/qapi.c b/block/qapi.c
index d071ee5..fca981d 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -28,6 +28,7 @@
#include "qapi-visit.h"
#include "qapi/qmp-output-visitor.h"
#include "qapi/qmp/types.h"
+#include "sysemu/block-backend.h"
#ifdef __linux__
#include <linux/fs.h>
#include <sys/ioctl.h>
@@ -264,15 +265,15 @@ void bdrv_query_image_info(BlockDriverState *bs,
}
/* @p_info will be set only on success. */
-void bdrv_query_info(BlockDriverState *bs,
- BlockInfo **p_info,
- Error **errp)
+static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info,
+ Error **errp)
{
BlockInfo *info = g_malloc0(sizeof(*info));
+ BlockDriverState *bs = blk_bs(blk);
BlockDriverState *bs0;
ImageInfo **p_image_info;
Error *local_err = NULL;
- info->device = g_strdup(bdrv_get_device_name(bs));
+ info->device = g_strdup(blk_name(blk));
info->type = g_strdup("unknown");
info->locked = bdrv_dev_is_medium_locked(bs);
info->removable = bdrv_dev_has_removable_media(bs);
@@ -360,12 +361,12 @@ static BlockStats *bdrv_query_stats(const
BlockDriverState *bs)
BlockInfoList *qmp_query_block(Error **errp)
{
BlockInfoList *head = NULL, **p_next = &head;
- BlockDriverState *bs = NULL;
+ BlockBackend *blk;
Error *local_err = NULL;
- while ((bs = bdrv_next(bs))) {
+ for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
BlockInfoList *info = g_malloc0(sizeof(*info));
- bdrv_query_info(bs, &info->value, &local_err);
+ bdrv_query_info(blk, &info->value, &local_err);
if (local_err) {
error_propagate(errp, local_err);
goto err;
diff --git a/include/block/qapi.h b/include/block/qapi.h
index 0374546..168d788 100644
--- a/include/block/qapi.h
+++ b/include/block/qapi.h
@@ -36,9 +36,6 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs,
void bdrv_query_image_info(BlockDriverState *bs,
ImageInfo **p_info,
Error **errp);
-void bdrv_query_info(BlockDriverState *bs,
- BlockInfo **p_info,
- Error **errp);
void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
QEMUSnapshotInfo *sn);
--
1.9.3
- Re: [Qemu-devel] [PATCH v5 03/23] block: Connect BlockBackend to BlockDriverState, (continued)
- [Qemu-devel] [PATCH v5 09/23] block: Merge BlockBackend and BlockDriverState name spaces, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 02/23] block: New BlockBackend, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 04/23] block: Connect BlockBackend and DriveInfo, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 10/23] block: Eliminate DriveInfo member bdrv, use blk_by_legacy_dinfo(), Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 06/23] block: Make BlockBackend own its BlockDriverState, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 21/23] blockdev: Convert qmp_eject(), qmp_change_blockdev() to BlockBackend, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 14/23] virtio-blk: Rename VirtIOBlkConf variables to conf, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 20/23] block/qapi: Convert qmp_query_block() to BlockBackend,
Markus Armbruster <=
- [Qemu-devel] [PATCH v5 18/23] blockdev: Drop superfluous DriveInfo member id, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 08/23] block: Eliminate BlockDriverState member device_name[], Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 23/23] block: Make device model's references to BlockBackend strong, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 17/23] pc87312: Drop unused members of PC87312State, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 12/23] block: Rename BlockDriverCompletionFunc to BlockCompletionFunc, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 16/23] ide: Complete conversion from BlockDriverState to BlockBackend, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 11/23] block: Rename BlockDriverAIOCB* to BlockAIOCB*, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 22/23] block: Lift device model API into BlockBackend, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 19/23] blockdev: Fix blockdev-add not to create DriveInfo, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 15/23] hw: Convert from BlockDriverState to BlockBackend, mostly, Markus Armbruster, 2014/10/02