summaryrefslogtreecommitdiff
path: root/net/socket.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-05-09 18:20:08 +0300
committerJens Axboe <axboe@kernel.dk>2024-05-14 03:19:09 +0300
commit92ef0fd55ac80dfc2e4654edfe5d1ddfa6e070fe (patch)
tree7356b1c61b8d9bd942cc517a1050bdecb9c2c5c2 /net/socket.c
parentfe6532b44af402d0900c5be3e5359f4b293524b1 (diff)
downloadlinux-92ef0fd55ac80dfc2e4654edfe5d1ddfa6e070fe.tar.xz
net: change proto and proto_ops accept type
Rather than pass in flags, error pointer, and whether this is a kernel invocation or not, add a struct proto_accept_arg struct as the argument. This then holds all of these arguments, and prepares accept for being able to pass back more information. No functional changes in this patch. Acked-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/net/socket.c b/net/socket.c
index 01a71ae10c35..6ff5f21d9633 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1898,6 +1898,9 @@ struct file *do_accept(struct file *file, unsigned file_flags,
struct file *newfile;
int err, len;
struct sockaddr_storage address;
+ struct proto_accept_arg arg = {
+ .flags = file_flags,
+ };
const struct proto_ops *ops;
sock = sock_from_file(file);
@@ -1926,8 +1929,8 @@ struct file *do_accept(struct file *file, unsigned file_flags,
if (err)
goto out_fd;
- err = ops->accept(sock, newsock, sock->file->f_flags | file_flags,
- false);
+ arg.flags |= sock->file->f_flags;
+ err = ops->accept(sock, newsock, &arg);
if (err < 0)
goto out_fd;
@@ -3580,6 +3583,10 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags)
{
struct sock *sk = sock->sk;
const struct proto_ops *ops = READ_ONCE(sock->ops);
+ struct proto_accept_arg arg = {
+ .flags = flags,
+ .kern = true,
+ };
int err;
err = sock_create_lite(sk->sk_family, sk->sk_type, sk->sk_protocol,
@@ -3587,7 +3594,7 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags)
if (err < 0)
goto done;
- err = ops->accept(sock, *newsock, flags, true);
+ err = ops->accept(sock, *newsock, &arg);
if (err < 0) {
sock_release(*newsock);
*newsock = NULL;