From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: [PULL 09/51] block: Add blk_make_empty()
Date: Fri, 15 May 2020 14:44:39 +0200 [thread overview]
Message-ID: <20200515124521.335403-10-kwolf@redhat.com> (raw)
In-Reply-To: <20200515124521.335403-1-kwolf@redhat.com>
From: Max Reitz <mreitz@redhat.com>
Two callers of BlockDriver.bdrv_make_empty() remain that should not call
this method directly. Both do not have access to a BdrvChild, but they
can use a BlockBackend, so we add this function that lets them use it.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200429141126.85159-4-mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/sysemu/block-backend.h | 2 ++
block/block-backend.c | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 0917663d89..8203d7f6f9 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -266,4 +266,6 @@ int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in,
const BdrvChild *blk_root(BlockBackend *blk);
+int blk_make_empty(BlockBackend *blk, Error **errp);
+
#endif
diff --git a/block/block-backend.c b/block/block-backend.c
index f4944861fa..47bd56244d 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -2402,3 +2402,13 @@ const BdrvChild *blk_root(BlockBackend *blk)
{
return blk->root;
}
+
+int blk_make_empty(BlockBackend *blk, Error **errp)
+{
+ if (!blk_is_available(blk)) {
+ error_setg(errp, "No medium inserted");
+ return -ENOMEDIUM;
+ }
+
+ return bdrv_make_empty(blk->root, errp);
+}
--
2.25.4
next prev parent reply other threads:[~2020-05-15 12:54 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 12:44 [PULL 00/51] Block layer patches Kevin Wolf
2020-05-15 12:44 ` [PULL 01/51] iotests/109: Don't mirror with mismatched size Kevin Wolf
2020-05-15 12:44 ` [PULL 02/51] iotests/229: Use blkdebug to inject an error Kevin Wolf
2020-05-15 12:44 ` [PULL 03/51] mirror: Make sure that source and target size match Kevin Wolf
2020-05-15 12:44 ` [PULL 04/51] iotests: Mirror with different source/target size Kevin Wolf
2020-05-15 12:44 ` [PULL 05/51] block/replication.c: Avoid cancelling the job twice Kevin Wolf
2020-05-15 12:44 ` [PULL 06/51] iotests: Fix incomplete type declarations Kevin Wolf
2020-05-15 12:44 ` [PULL 07/51] iotests: Run pylint and mypy in a testcase Kevin Wolf
2020-05-15 12:44 ` [PULL 08/51] block: Add bdrv_make_empty() Kevin Wolf
2020-05-15 12:44 ` Kevin Wolf [this message]
2020-05-15 12:44 ` [PULL 10/51] block: Use blk_make_empty() after commits Kevin Wolf
2020-05-15 12:44 ` [PULL 11/51] replication: Avoid blk_make_empty() on read-only child Kevin Wolf
2020-05-15 12:44 ` [PULL 12/51] block: Use bdrv_make_empty() where possible Kevin Wolf
2020-05-15 12:44 ` [PULL 13/51] block: Mark commit, mirror, blkreplay as filters Kevin Wolf
2020-05-15 12:44 ` [PULL 14/51] block: Add BlockDriver.is_format Kevin Wolf
2020-05-15 12:44 ` [PULL 15/51] block: Rename BdrvChildRole to BdrvChildClass Kevin Wolf
2020-05-15 12:44 ` [PULL 16/51] block: Add BdrvChildRole and BdrvChildRoleBits Kevin Wolf
2020-05-15 12:44 ` [PULL 17/51] block: Add BdrvChildRole to BdrvChild Kevin Wolf
2020-05-15 12:44 ` [PULL 18/51] block: Pass BdrvChildRole to bdrv_child_perm() Kevin Wolf
2020-05-15 12:44 ` [PULL 19/51] block: Pass BdrvChildRole to .inherit_options() Kevin Wolf
2020-05-15 12:44 ` [PULL 20/51] block: Pass parent_is_format " Kevin Wolf
2020-05-15 12:44 ` [PULL 21/51] block: Rename bdrv_inherited_options() Kevin Wolf
2020-05-15 12:44 ` [PULL 22/51] block: Add generic bdrv_inherited_options() Kevin Wolf
2020-05-15 12:44 ` [PULL 23/51] block: Use bdrv_inherited_options() Kevin Wolf
2020-05-15 12:44 ` [PULL 24/51] block: Unify bdrv_child_cb_attach() Kevin Wolf
2020-05-15 12:44 ` [PULL 25/51] block: Unify bdrv_child_cb_detach() Kevin Wolf
2020-05-15 12:44 ` [PULL 26/51] block: Add child_of_bds Kevin Wolf
2020-05-15 12:44 ` [PULL 27/51] block: Distinguish paths in *_format_default_perms Kevin Wolf
2020-05-15 12:44 ` [PULL 28/51] block: Pull out bdrv_default_perms_for_cow() Kevin Wolf
2020-05-15 12:44 ` [PULL 29/51] block: Pull out bdrv_default_perms_for_storage() Kevin Wolf
2020-05-15 12:45 ` [PULL 30/51] block: Relax *perms_for_storage for data children Kevin Wolf
2020-05-15 12:45 ` [PULL 31/51] block: Add bdrv_default_perms() Kevin Wolf
2020-05-15 12:45 ` [PULL 32/51] raw-format: Split raw_read_options() Kevin Wolf
2020-05-15 12:45 ` [PULL 33/51] block: Switch child_format users to child_of_bds Kevin Wolf
2020-05-15 12:45 ` [PULL 34/51] block: Drop child_format Kevin Wolf
2020-05-15 12:45 ` [PULL 35/51] block: Make backing files child_of_bds children Kevin Wolf
2020-05-15 12:45 ` [PULL 36/51] block: Drop child_backing Kevin Wolf
2020-05-15 12:45 ` [PULL 37/51] block: Make format drivers use child_of_bds Kevin Wolf
2020-05-15 12:45 ` [PULL 38/51] block: Make filter " Kevin Wolf
2020-05-15 12:45 ` [PULL 39/51] block: Use child_of_bds in remaining places Kevin Wolf
2020-05-15 12:45 ` [PULL 40/51] tests: Use child_of_bds instead of child_file Kevin Wolf
2020-05-15 12:45 ` [PULL 41/51] block: Use bdrv_default_perms() Kevin Wolf
2020-05-15 12:45 ` [PULL 42/51] block: Make bdrv_filter_default_perms() static Kevin Wolf
2020-05-15 12:45 ` [PULL 43/51] block: Drop bdrv_format_default_perms() Kevin Wolf
2020-05-15 12:45 ` [PULL 44/51] block: Drop child_file Kevin Wolf
2020-05-15 12:45 ` [PULL 45/51] block: Pass BdrvChildRole in remaining cases Kevin Wolf
2020-05-15 12:45 ` [PULL 46/51] block: Drop @child_class from bdrv_child_perm() Kevin Wolf
2020-05-15 12:45 ` [PULL 47/51] block/block-copy: Fix uninitialized variable in block_copy_task_entry Kevin Wolf
2020-05-15 12:45 ` [PULL 48/51] block/block-copy: Simplify block_copy_do_copy() Kevin Wolf
2020-05-15 12:45 ` [PULL 49/51] iotests: log messages from notrun() Kevin Wolf
2020-05-15 12:45 ` [PULL 50/51] hw/ide/ahci: Log lost IRQs Kevin Wolf
2020-05-15 12:45 ` [PULL 51/51] iotests/030: Reduce run time by unthrottling job earlier Kevin Wolf
2020-05-15 14:28 ` [PULL 00/51] Block layer patches Peter Maydell
2020-05-15 20:30 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200515124521.335403-10-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).