From: Al Viro <viro@zeniv.linux.org.uk>
To: io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, linux-fsdevel@vger.kernel.org
Subject: [PATCH] switch io_msg_ring() to CLASS(fd)
Date: Fri, 15 Nov 2024 03:49:02 +0000 [thread overview]
Message-ID: <20241115034902.GP3387508@ZenIV> (raw)
Trivial conversion, on top of for-6.13/io_uring.
No point backmerging and doing that in #work.fd, seeing that
it's independent from anything in there...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/io_uring/msg_ring.c b/io_uring/msg_ring.c
index e63af34004b7..333c220d322a 100644
--- a/io_uring/msg_ring.c
+++ b/io_uring/msg_ring.c
@@ -333,7 +333,6 @@ int io_msg_ring(struct io_kiocb *req, unsigned int issue_flags)
int io_uring_sync_msg_ring(struct io_uring_sqe *sqe)
{
struct io_msg io_msg = { };
- struct fd f;
int ret;
ret = __io_msg_ring_prep(&io_msg, sqe);
@@ -347,16 +346,13 @@ int io_uring_sync_msg_ring(struct io_uring_sqe *sqe)
if (io_msg.cmd != IORING_MSG_DATA)
return -EINVAL;
- ret = -EBADF;
- f = fdget(sqe->fd);
- if (fd_file(f)) {
- ret = -EBADFD;
- if (io_is_uring_fops(fd_file(f)))
- ret = __io_msg_ring_data(fd_file(f)->private_data,
- &io_msg, IO_URING_F_UNLOCKED);
- fdput(f);
- }
- return ret;
+ CLASS(fd, f)(sqe->fd);
+ if (fd_empty(f))
+ return -EBADF;
+ if (!io_is_uring_fops(fd_file(f)))
+ return -EBADFD;
+ return __io_msg_ring_data(fd_file(f)->private_data,
+ &io_msg, IO_URING_F_UNLOCKED);
}
void io_msg_cache_free(const void *entry)
next reply other threads:[~2024-11-15 3:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 3:49 Al Viro [this message]
2024-11-15 15:43 ` [PATCH] switch io_msg_ring() to CLASS(fd) 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=20241115034902.GP3387508@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=linux-fsdevel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.