diff options
author | Max Reitz <mreitz@redhat.com> | 2016-03-16 19:54:35 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-03-17 15:47:56 +0100 |
commit | 9492b0b928ca23e9537c1c601a0dc9a00f65c330 (patch) | |
tree | 8b51a69a0440cade8a689e6a097199b812e8c43f /block/block-backend.c | |
parent | d0e46a55776a59c8fdbb75620e7c5fcf0d6aa029 (diff) |
blockdev: Rename blk_backends
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 <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/block-backend.c')
-rw-r--r-- | block/block-backend.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/block/block-backend.c b/block/block-backend.c index e75b8febb0..3bb2a6a097 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); |