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

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

89 int parent_flags, QDict *parent_options)
90{
91 /* We're not supposed to call this function for root nodes */
92 abort();
93}
94static void blk_root_drained_begin(BdrvChild *child);
95static void blk_root_drained_end(BdrvChild *child);
96
1/*
2 * QEMU Block backends
3 *
4 * Copyright (C) 2014-2016 Red Hat, Inc.
5 *
6 * Authors:
7 * Markus Armbruster <armbru@redhat.com>,
8 *

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

89 int parent_flags, QDict *parent_options)
90{
91 /* We're not supposed to call this function for root nodes */
92 abort();
93}
94static void blk_root_drained_begin(BdrvChild *child);
95static void blk_root_drained_end(BdrvChild *child);
96
97static void blk_root_change_media(BdrvChild *child, bool load);
98static void blk_root_resize(BdrvChild *child);
99
97static const BdrvChildRole child_root = {
98 .inherit_options = blk_root_inherit_options,
99
100static const BdrvChildRole child_root = {
101 .inherit_options = blk_root_inherit_options,
102
103 .change_media = blk_root_change_media,
104 .resize = blk_root_resize,
105
100 .drained_begin = blk_root_drained_begin,
101 .drained_end = blk_root_drained_end,
102};
103
104/*
105 * Create a new BlockBackend with a reference count of one.
106 * Store an error through @errp on failure, unless it's null.
107 * Return the new BlockBackend on success, null on failure.

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

551
552 if (tray_was_open != tray_is_open) {
553 qapi_event_send_device_tray_moved(blk_name(blk), tray_is_open,
554 &error_abort);
555 }
556 }
557}
558
106 .drained_begin = blk_root_drained_begin,
107 .drained_end = blk_root_drained_end,
108};
109
110/*
111 * Create a new BlockBackend with a reference count of one.
112 * Store an error through @errp on failure, unless it's null.
113 * Return the new BlockBackend on success, null on failure.

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

557
558 if (tray_was_open != tray_is_open) {
559 qapi_event_send_device_tray_moved(blk_name(blk), tray_is_open,
560 &error_abort);
561 }
562 }
563}
564
565static void blk_root_change_media(BdrvChild *child, bool load)
566{
567 blk_dev_change_media_cb(child->opaque, load);
568}
569
559/*
560 * Does @blk's attached device model have removable media?
561 * %true if no device model is attached.
562 */
563bool blk_dev_has_removable_media(BlockBackend *blk)
564{
565 return !blk->dev || (blk->dev_ops && blk->dev_ops->change_media_cb);
566}

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

605 return blk->dev_ops->is_medium_locked(blk->dev_opaque);
606 }
607 return false;
608}
609
610/*
611 * Notify @blk's attached device model of a backend size change.
612 */
570/*
571 * Does @blk's attached device model have removable media?
572 * %true if no device model is attached.
573 */
574bool blk_dev_has_removable_media(BlockBackend *blk)
575{
576 return !blk->dev || (blk->dev_ops && blk->dev_ops->change_media_cb);
577}

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

616 return blk->dev_ops->is_medium_locked(blk->dev_opaque);
617 }
618 return false;
619}
620
621/*
622 * Notify @blk's attached device model of a backend size change.
623 */
613void blk_dev_resize_cb(BlockBackend *blk)
624static void blk_root_resize(BdrvChild *child)
614{
625{
626 BlockBackend *blk = child->opaque;
627
615 if (blk->dev_ops && blk->dev_ops->resize_cb) {
616 blk->dev_ops->resize_cb(blk->dev_opaque);
617 }
618}
619
620void blk_iostatus_enable(BlockBackend *blk)
621{
622 blk->iostatus_enabled = true;

--- 1054 unchanged lines hidden ---
628 if (blk->dev_ops && blk->dev_ops->resize_cb) {
629 blk->dev_ops->resize_cb(blk->dev_opaque);
630 }
631}
632
633void blk_iostatus_enable(BlockBackend *blk)
634{
635 blk->iostatus_enabled = true;

--- 1054 unchanged lines hidden ---