From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org
Subject: [PATCH v2 1/3] block: make assertion more generic
Date: Thu, 1 Jun 2023 13:51:37 +0200 [thread overview]
Message-ID: <20230601115139.196369-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20230601115139.196369-1-pbonzini@redhat.com>
.bdrv_needs_filename is only set for drivers that also set bdrv_file_open,
i.e. protocol drivers.
So we can make the assertion always, it will always pass for those drivers
that use bdrv_open.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block.c b/block.c
index dae629075c2c..a1452e747b62 100644
--- a/block.c
+++ b/block.c
@@ -1627,8 +1627,8 @@ bdrv_open_driver(BlockDriverState *bs, BlockDriver *drv, const char *node_name,
bs->drv = drv;
bs->opaque = g_malloc0(drv->instance_size);
+ assert(!drv->bdrv_needs_filename || bs->filename[0]);
if (drv->bdrv_file_open) {
- assert(!drv->bdrv_needs_filename || bs->filename[0]);
ret = drv->bdrv_file_open(bs, options, open_flags, &local_err);
} else if (drv->bdrv_open) {
ret = drv->bdrv_open(bs, options, open_flags, &local_err);
--
2.40.1
next prev parent reply other threads:[~2023-06-01 11:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 11:51 [PATCH v2 0/3] block: remove separate bdrv_file_open callback Paolo Bonzini
2023-06-01 11:51 ` Paolo Bonzini [this message]
2023-06-01 11:51 ` [PATCH v2 2/3] block: do not check bdrv_file_open Paolo Bonzini
2023-06-01 11:51 ` [PATCH v2 3/3] block: remove separate bdrv_file_open callback Paolo Bonzini
2023-06-28 7:40 ` Kevin Wolf
2023-06-01 13:42 ` [PATCH v2 0/3] " Eric Blake
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=20230601115139.196369-2-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--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).