io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Subject: [PATCH liburing 1/1] io_uring: update buffer update feature testing
Date: Thu, 26 Aug 2021 12:13:16 +0100	[thread overview]
Message-ID: <de5fd2626bd4eabd0eec3eb8310888b4eb1a2539.1629976377.git.asml.silence@gmail.com> (raw)

IORING_FEAT_RSRC_TAGS came late, and it's the best way to check if a
ring supports resource (i.e. buffer or file) tagging and dynamic buffer
updates.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 test/rsrc_tags.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/rsrc_tags.c b/test/rsrc_tags.c
index 337fbb8..a82ba21 100644
--- a/test/rsrc_tags.c
+++ b/test/rsrc_tags.c
@@ -75,17 +75,17 @@ static int update_rsrc(struct io_uring *ring, int type, int nr, int off,
 static bool has_rsrc_update(void)
 {
 	struct io_uring ring;
-	char buf[1024];
-	struct iovec vec = {.iov_base = buf, .iov_len = sizeof(buf), };
 	int ret;
 
 	ret = io_uring_queue_init(1, &ring, 0);
-	if (ret)
-		return false;
+	if (ret) {
+		fprintf(stderr, "io_uring_queue_init() failed, %d\n", ret);
+		exit(1);
+	}
 
-	ret = register_rsrc(&ring, TEST_IORING_RSRC_BUFFER, 1, &vec, NULL);
+	ret = ring.features & IORING_FEAT_RSRC_TAGS;
 	io_uring_queue_exit(&ring);
-	return ret != -EINVAL;
+	return ret;
 }
 
 static int test_tags_generic(int nr, int type, void *rsrc, int ring_flags)
-- 
2.32.0


             reply	other threads:[~2021-08-26 11:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 11:13 Pavel Begunkov [this message]
2021-08-26 14:41 ` [PATCH liburing 1/1] io_uring: update buffer update feature testing Jens Axboe

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=de5fd2626bd4eabd0eec3eb8310888b4eb1a2539.1629976377.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.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).