[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH for-5.0 25/31] tests: Use child_of_bds instead of child_file
From: |
Max Reitz |
Subject: |
[PATCH for-5.0 25/31] tests: Use child_of_bds instead of child_file |
Date: |
Wed, 27 Nov 2019 14:16:18 +0100 |
Signed-off-by: Max Reitz <address@hidden>
---
tests/test-bdrv-drain.c | 29 +++++++++++++++++------------
tests/test-bdrv-graph-mod.c | 6 ++++--
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
index 15393a0140..91567ca97d 100644
--- a/tests/test-bdrv-drain.c
+++ b/tests/test-bdrv-drain.c
@@ -97,7 +97,7 @@ static void bdrv_test_child_perm(BlockDriverState *bs,
BdrvChild *c,
* detach_by_driver_cb_parent as one of them.
*/
if (child_class != &child_file && child_class != &child_of_bds) {
- child_class = &child_file;
+ child_class = &child_of_bds;
}
bdrv_format_default_perms(bs, c, child_class, role, reopen_queue,
@@ -1203,7 +1203,8 @@ static void do_test_delete_by_drain(bool
detach_instead_of_delete,
null_bs = bdrv_open("null-co://", NULL, NULL, BDRV_O_RDWR |
BDRV_O_PROTOCOL,
&error_abort);
- bdrv_attach_child(bs, null_bs, "null-child", &child_file, 0, &error_abort);
+ bdrv_attach_child(bs, null_bs, "null-child", &child_of_bds,
+ BDRV_CHILD_DATA, &error_abort);
/* This child will be the one to pass to requests through to, and
* it will stall until a drain occurs */
@@ -1211,14 +1212,17 @@ static void do_test_delete_by_drain(bool
detach_instead_of_delete,
&error_abort);
child_bs->total_sectors = 65536 >> BDRV_SECTOR_BITS;
/* Takes our reference to child_bs */
- tts->wait_child = bdrv_attach_child(bs, child_bs, "wait-child",
&child_file,
- 0, &error_abort);
+ tts->wait_child = bdrv_attach_child(bs, child_bs, "wait-child",
+ &child_of_bds,
+ BDRV_CHILD_DATA | BDRV_CHILD_PRIMARY,
+ &error_abort);
/* This child is just there to be deleted
* (for detach_instead_of_delete == true) */
null_bs = bdrv_open("null-co://", NULL, NULL, BDRV_O_RDWR |
BDRV_O_PROTOCOL,
&error_abort);
- bdrv_attach_child(bs, null_bs, "null-child", &child_file, 0, &error_abort);
+ bdrv_attach_child(bs, null_bs, "null-child", &child_of_bds,
BDRV_CHILD_DATA,
+ &error_abort);
blk = blk_new(qemu_get_aio_context(), BLK_PERM_ALL, BLK_PERM_ALL);
blk_insert_bs(blk, bs, &error_abort);
@@ -1315,7 +1319,8 @@ static void detach_indirect_bh(void *opaque)
bdrv_ref(data->c);
data->child_c = bdrv_attach_child(data->parent_b, data->c, "PB-C",
- &child_file, 0, &error_abort);
+ &child_of_bds, BDRV_CHILD_DATA,
+ &error_abort);
}
static void detach_by_parent_aio_cb(void *opaque, int ret)
@@ -1332,7 +1337,7 @@ static void detach_by_driver_cb_drained_begin(BdrvChild
*child)
{
aio_bh_schedule_oneshot(qemu_get_current_aio_context(),
detach_indirect_bh, &detach_by_parent_data);
- child_file.drained_begin(child);
+ child_of_bds.drained_begin(child);
}
static BdrvChildClass detach_by_driver_cb_class;
@@ -1367,7 +1372,7 @@ static void test_detach_indirect(bool by_parent_cb)
QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, NULL, 0);
if (!by_parent_cb) {
- detach_by_driver_cb_class = child_file;
+ detach_by_driver_cb_class = child_of_bds;
detach_by_driver_cb_class.drained_begin =
detach_by_driver_cb_drained_begin;
}
@@ -1397,15 +1402,15 @@ static void test_detach_indirect(bool by_parent_cb)
/* Set child relationships */
bdrv_ref(b);
bdrv_ref(a);
- child_b = bdrv_attach_child(parent_b, b, "PB-B", &child_file, 0,
- &error_abort);
+ child_b = bdrv_attach_child(parent_b, b, "PB-B", &child_of_bds,
+ BDRV_CHILD_DATA, &error_abort);
child_a = bdrv_attach_child(parent_b, a, "PB-A", &child_of_bds,
BDRV_CHILD_COW, &error_abort);
bdrv_ref(a);
bdrv_attach_child(parent_a, a, "PA-A",
- by_parent_cb ? &child_file : &detach_by_driver_cb_class,
- 0, &error_abort);
+ by_parent_cb ? &child_of_bds :
&detach_by_driver_cb_class,
+ BDRV_CHILD_DATA, &error_abort);
g_assert_cmpint(parent_a->refcnt, ==, 1);
g_assert_cmpint(parent_b->refcnt, ==, 1);
diff --git a/tests/test-bdrv-graph-mod.c b/tests/test-bdrv-graph-mod.c
index 3707e2533c..6ae91ff171 100644
--- a/tests/test-bdrv-graph-mod.c
+++ b/tests/test-bdrv-graph-mod.c
@@ -112,7 +112,8 @@ static void test_update_perm_tree(void)
blk_insert_bs(root, bs, &error_abort);
- bdrv_attach_child(filter, bs, "child", &child_file, 0, &error_abort);
+ bdrv_attach_child(filter, bs, "child", &child_of_bds,
+ BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, &error_abort);
bdrv_append(filter, bs, &local_err);
@@ -178,7 +179,8 @@ static void test_should_update_child(void)
bdrv_set_backing_hd(target, bs, &error_abort);
g_assert(target->backing->bs == bs);
- bdrv_attach_child(filter, target, "target", &child_file, 0, &error_abort);
+ bdrv_attach_child(filter, target, "target", &child_of_bds,
+ BDRV_CHILD_DATA, &error_abort);
bdrv_append(filter, bs, &error_abort);
g_assert(target->backing->bs == bs);
--
2.23.0
- [PATCH for-5.0 13/31] block: Pull out bdrv_default_perms_for_backing(), (continued)
- [PATCH for-5.0 13/31] block: Pull out bdrv_default_perms_for_backing(), Max Reitz, 2019/11/27
- [PATCH for-5.0 14/31] block: Pull out bdrv_default_perms_for_storage(), Max Reitz, 2019/11/27
- [PATCH for-5.0 16/31] block: Add bdrv_default_perms(), Max Reitz, 2019/11/27
- [PATCH for-5.0 17/31] raw-format: Split raw_read_options(), Max Reitz, 2019/11/27
- [PATCH for-5.0 19/31] block: Drop child_format, Max Reitz, 2019/11/27
- [PATCH for-5.0 20/31] block: Make backing files child_of_bds children, Max Reitz, 2019/11/27
- [PATCH for-5.0 21/31] block: Drop child_backing, Max Reitz, 2019/11/27
- [PATCH for-5.0 23/31] block: Make filter drivers use child_of_bds, Max Reitz, 2019/11/27
- [PATCH for-5.0 22/31] block: Make format drivers use child_of_bds, Max Reitz, 2019/11/27
- [PATCH for-5.0 24/31] block: Use child_of_bds in remaining places, Max Reitz, 2019/11/27
- [PATCH for-5.0 25/31] tests: Use child_of_bds instead of child_file,
Max Reitz <=
- [PATCH for-5.0 27/31] block: Make bdrv_filter_default_perms() static, Max Reitz, 2019/11/27
- [PATCH for-5.0 26/31] block: Use bdrv_default_perms(), Max Reitz, 2019/11/27
- [PATCH for-5.0 28/31] block: Drop bdrv_format_default_perms(), Max Reitz, 2019/11/27
- [PATCH for-5.0 31/31] block: Drop @child_class from bdrv_child_perm(), Max Reitz, 2019/11/27
- [PATCH for-5.0 30/31] block: Pass BdrvChildRole in remaining cases, Max Reitz, 2019/11/27
- [PATCH for-5.0 29/31] block: Drop child_file, Max Reitz, 2019/11/27
- [PATCH for-5.0 18/31] block: Switch child_format users to child_of_bds, Max Reitz, 2019/11/27