mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-28 00:33:16 +00:00
switch io_msg_ring() to CLASS(fd)
Use CLASS(fd) to get the file for sync message ring requests, rather than open-code the file retrieval dance. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Link: https://lore.kernel.org/r/20241115034902.GP3387508@ZenIV [axboe: make a more coherent commit message] Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
b9d69371e8
commit
56cec28dc4
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user