[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 07/17] blockdev: Rename blk_backends
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v4 07/17] blockdev: Rename blk_backends |
Date: |
Wed, 16 Mar 2016 19:54:35 +0100 |
The blk_backends list does not contain all BlockBackends but only the
ones which are referenced by the monitor, and that is not necessarily
true for every BlockBackend. Rename the list to monitor_block_backends
to make that fact clear.
Signed-off-by: Max Reitz <address@hidden>
---
block/block-backend.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index e75b8fe..3bb2a6a 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -29,7 +29,7 @@ struct BlockBackend {
int refcnt;
BlockDriverState *bs;
DriveInfo *legacy_dinfo; /* null unless created by drive_new() */
- QTAILQ_ENTRY(BlockBackend) link; /* for blk_backends */
+ QTAILQ_ENTRY(BlockBackend) monitor_link; /* for monitor_block_backends */
void *dev; /* attached device model, if any */
/* TODO change to DeviceState when all users are qdevified */
@@ -69,9 +69,10 @@ static const AIOCBInfo block_backend_aiocb_info = {
static void drive_info_del(DriveInfo *dinfo);
-/* All the BlockBackends (except for hidden ones) */
-static QTAILQ_HEAD(, BlockBackend) blk_backends =
- QTAILQ_HEAD_INITIALIZER(blk_backends);
+/* All BlockBackends referenced by the monitor and which are iterated through
by
+ * blk_next() */
+static QTAILQ_HEAD(, BlockBackend) monitor_block_backends =
+ QTAILQ_HEAD_INITIALIZER(monitor_block_backends);
/*
* Create a new BlockBackend with @name, with a reference count of one.
@@ -105,7 +106,7 @@ BlockBackend *blk_new(const char *name, Error **errp)
blk->refcnt = 1;
notifier_list_init(&blk->remove_bs_notifiers);
notifier_list_init(&blk->insert_bs_notifiers);
- QTAILQ_INSERT_TAIL(&blk_backends, blk, link);
+ QTAILQ_INSERT_TAIL(&monitor_block_backends, blk, monitor_link);
return blk;
}
@@ -178,7 +179,7 @@ static void blk_delete(BlockBackend *blk)
}
/* Avoid double-remove after blk_hide_on_behalf_of_hmp_drive_del() */
if (blk->name[0]) {
- QTAILQ_REMOVE(&blk_backends, blk, link);
+ QTAILQ_REMOVE(&monitor_block_backends, blk, monitor_link);
}
g_free(blk->name);
drive_info_del(blk->legacy_dinfo);
@@ -241,7 +242,7 @@ void blk_remove_all_bs(void)
}
/*
- * Return the BlockBackend after @blk.
+ * Return the monitor-owned BlockBackend after @blk.
* If @blk is null, return the first one.
* Else, return @blk's next sibling, which may be null.
*
@@ -252,7 +253,8 @@ void blk_remove_all_bs(void)
*/
BlockBackend *blk_next(BlockBackend *blk)
{
- return blk ? QTAILQ_NEXT(blk, link) : QTAILQ_FIRST(&blk_backends);
+ return blk ? QTAILQ_NEXT(blk, monitor_link)
+ : QTAILQ_FIRST(&monitor_block_backends);
}
/*
@@ -353,7 +355,7 @@ BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo)
*/
void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk)
{
- QTAILQ_REMOVE(&blk_backends, blk, link);
+ QTAILQ_REMOVE(&monitor_block_backends, blk, monitor_link);
blk->name[0] = 0;
if (blk->bs) {
bdrv_make_anon(blk->bs);
--
2.7.3
- [Qemu-devel] [PATCH v4 00/17] blockdev: Further BlockBackend work, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 01/17] monitor: Use BB list for BB name completion, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 03/17] block: Add blk_commit_all(), Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 02/17] block: Use blk_next() in block-backend.c, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 06/17] block: Drop BB name from bad option error, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 04/17] block: Use blk_{commit, flush}_all() consistently, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 07/17] blockdev: Rename blk_backends,
Max Reitz <=
- [Qemu-devel] [PATCH v4 08/17] blockdev: Add list of all BlockBackends, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 09/17] blockdev: Separate BB name management, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 05/17] qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 13/17] block: Add bdrv_next_monitor_owned(), Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 10/17] blockdev: Split monitor reference from BB creation, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 11/17] blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del(), Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 14/17] block: Add blk_next_root_bs(), Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 12/17] block: Move some bdrv_*_all() functions to BB, Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 15/17] block: Rewrite bdrv_next(), Max Reitz, 2016/03/16
- [Qemu-devel] [PATCH v4 16/17] block: Use bdrv_next() instead of bdrv_states, Max Reitz, 2016/03/16