mirror of
https://github.com/torvalds/linux.git
synced 2025-12-01 07:26:02 +07:00
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>
This commit is contained in:
13
net/socket.c
13
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;
|
||||
|
||||
Reference in New Issue
Block a user