From: Stefano Garzarella <sgarzare@redhat.com>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
Hanna Reitz <hreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Stefano Garzarella <sgarzare@redhat.com>
Subject: [PATCH 2/2] block/blkio: use blkio_set_int("fd") to check fd support
Date: Mon, 24 Jul 2023 17:46:11 +0200 [thread overview]
Message-ID: <20230724154611.178858-3-sgarzare@redhat.com> (raw)
In-Reply-To: <20230724154611.178858-1-sgarzare@redhat.com>
The way the virtio-blk driver is implemented in libblkio,
it's much easier to use blkio_set_int() instead of blkio_get_int()
and have it fail right away to see if `fd` is supported by the
transport. See https://gitlab.com/libblkio/libblkio/-/merge_requests/208
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
block/blkio.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/blkio.c b/block/blkio.c
index ca1149042a..719b19324b 100644
--- a/block/blkio.c
+++ b/block/blkio.c
@@ -665,7 +665,7 @@ static int blkio_virtio_blk_common_open(BlockDriverState *bs,
const char *blkio_driver = bs->drv->protocol_name;
BDRVBlkioState *s = bs->opaque;
bool fd_supported = false;
- int fd, ret;
+ int ret;
if (!path) {
error_setg(errp, "missing 'path' option");
@@ -678,7 +678,7 @@ static int blkio_virtio_blk_common_open(BlockDriverState *bs,
}
if (strcmp(blkio_driver, "virtio-blk-vhost-vdpa") == 0 &&
- blkio_get_int(s->blkio, "fd", &fd) == 0) {
+ blkio_set_int(s->blkio, "fd", -1) == 0) {
fd_supported = true;
}
@@ -688,7 +688,7 @@ static int blkio_virtio_blk_common_open(BlockDriverState *bs,
* layer through the "/dev/fdset/N" special path.
*/
if (fd_supported) {
- int open_flags;
+ int open_flags, fd;
if (flags & BDRV_O_RDWR) {
open_flags = O_RDWR;
--
2.41.0
next prev parent reply other threads:[~2023-07-24 15:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 15:46 [PATCH 0/2] block/blkio: fix opening virtio-blk drivers Stefano Garzarella
2023-07-24 15:46 ` [PATCH 1/2] " Stefano Garzarella
2023-07-25 20:00 ` Stefan Hajnoczi
2023-07-26 7:26 ` Stefano Garzarella
2023-07-26 15:32 ` Stefan Hajnoczi
2023-07-26 15:45 ` Stefano Garzarella
2023-07-24 15:46 ` Stefano Garzarella [this message]
2023-07-25 20:05 ` [PATCH 2/2] block/blkio: use blkio_set_int("fd") to check fd support Stefan Hajnoczi
2023-07-26 7:28 ` Stefano Garzarella
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=20230724154611.178858-3-sgarzare@redhat.com \
--to=sgarzare@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).