block-backend.c (2b7bbdbdefe203cf8468c61b4217e578981d6fce) block-backend.c (bd86fb990cfedc50d9705b8ed31d183f01942035)
1/*
2 * QEMU Block backends
3 *
4 * Copyright (C) 2014-2016 Red Hat, Inc.
5 *
6 * Authors:
7 * Markus Armbruster <armbru@redhat.com>,
8 *

--- 283 unchanged lines hidden (view full) ---

292 QLIST_FOREACH(notifier, &blk->aio_notifiers, list) {
293 bdrv_remove_aio_context_notifier(child->bs,
294 notifier->attached_aio_context,
295 notifier->detach_aio_context,
296 notifier->opaque);
297 }
298}
299
1/*
2 * QEMU Block backends
3 *
4 * Copyright (C) 2014-2016 Red Hat, Inc.
5 *
6 * Authors:
7 * Markus Armbruster <armbru@redhat.com>,
8 *

--- 283 unchanged lines hidden (view full) ---

292 QLIST_FOREACH(notifier, &blk->aio_notifiers, list) {
293 bdrv_remove_aio_context_notifier(child->bs,
294 notifier->attached_aio_context,
295 notifier->detach_aio_context,
296 notifier->opaque);
297 }
298}
299
300static const BdrvChildRole child_root = {
300static const BdrvChildClass child_root = {
301 .inherit_options = blk_root_inherit_options,
302
303 .change_media = blk_root_change_media,
304 .resize = blk_root_resize,
305 .get_name = blk_root_get_name,
306 .get_parent_desc = blk_root_get_parent_desc,
307
308 .drained_begin = blk_root_drained_begin,

--- 402 unchanged lines hidden (view full) ---

711{
712 return blk->root ? blk->root->bs : NULL;
713}
714
715static BlockBackend *bdrv_first_blk(BlockDriverState *bs)
716{
717 BdrvChild *child;
718 QLIST_FOREACH(child, &bs->parents, next_parent) {
301 .inherit_options = blk_root_inherit_options,
302
303 .change_media = blk_root_change_media,
304 .resize = blk_root_resize,
305 .get_name = blk_root_get_name,
306 .get_parent_desc = blk_root_get_parent_desc,
307
308 .drained_begin = blk_root_drained_begin,

--- 402 unchanged lines hidden (view full) ---

711{
712 return blk->root ? blk->root->bs : NULL;
713}
714
715static BlockBackend *bdrv_first_blk(BlockDriverState *bs)
716{
717 BdrvChild *child;
718 QLIST_FOREACH(child, &bs->parents, next_parent) {
719 if (child->role == &child_root) {
719 if (child->klass == &child_root) {
720 return child->opaque;
721 }
722 }
723
724 return NULL;
725}
726
727/*

--- 7 unchanged lines hidden (view full) ---

735/*
736 * Returns true if @bs has only BlockBackends as parents.
737 */
738bool bdrv_is_root_node(BlockDriverState *bs)
739{
740 BdrvChild *c;
741
742 QLIST_FOREACH(c, &bs->parents, next_parent) {
720 return child->opaque;
721 }
722 }
723
724 return NULL;
725}
726
727/*

--- 7 unchanged lines hidden (view full) ---

735/*
736 * Returns true if @bs has only BlockBackends as parents.
737 */
738bool bdrv_is_root_node(BlockDriverState *bs)
739{
740 BdrvChild *c;
741
742 QLIST_FOREACH(c, &bs->parents, next_parent) {
743 if (c->role != &child_root) {
743 if (c->klass != &child_root) {
744 return false;
745 }
746 }
747
748 return true;
749}
750
751/*

--- 1663 unchanged lines hidden ---
744 return false;
745 }
746 }
747
748 return true;
749}
750
751/*

--- 1663 unchanged lines hidden ---