Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: add helper for *REGISTER_SEND_MSG_RING

Move handling of IORING_REGISTER_SEND_MSG_RING into a separate function
in preparation to growing io_uring_register_blind().

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Pavel Begunkov and committed by
Jens Axboe
da8bc3c8 c2685729

+19 -14
+19 -14
io_uring/register.c
··· 874 874 return ERR_PTR(-EOPNOTSUPP); 875 875 } 876 876 877 + static int io_uring_register_send_msg_ring(void __user *arg, unsigned int nr_args) 878 + { 879 + struct io_uring_sqe sqe; 880 + 881 + if (!arg || nr_args != 1) 882 + return -EINVAL; 883 + if (copy_from_user(&sqe, arg, sizeof(sqe))) 884 + return -EFAULT; 885 + /* no flags supported */ 886 + if (sqe.flags) 887 + return -EINVAL; 888 + if (sqe.opcode != IORING_OP_MSG_RING) 889 + return -EINVAL; 890 + 891 + return io_uring_sync_msg_ring(&sqe); 892 + } 893 + 877 894 /* 878 895 * "blind" registration opcodes are ones where there's no ring given, and 879 896 * hence the source fd must be -1. ··· 899 882 unsigned int nr_args) 900 883 { 901 884 switch (opcode) { 902 - case IORING_REGISTER_SEND_MSG_RING: { 903 - struct io_uring_sqe sqe; 904 - 905 - if (!arg || nr_args != 1) 906 - return -EINVAL; 907 - if (copy_from_user(&sqe, arg, sizeof(sqe))) 908 - return -EFAULT; 909 - /* no flags supported */ 910 - if (sqe.flags) 911 - return -EINVAL; 912 - if (sqe.opcode == IORING_OP_MSG_RING) 913 - return io_uring_sync_msg_ring(&sqe); 914 - } 885 + case IORING_REGISTER_SEND_MSG_RING: 886 + return io_uring_register_send_msg_ring(arg, nr_args); 915 887 } 916 - 917 888 return -EINVAL; 918 889 } 919 890