From 91cf45f02af5c871251165d000c3f42a2a0b0552 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Mon, 12 Nov 2007 18:10:39 -0800 Subject: [NET]: Add the helper kernel_sock_shutdown() ...and fix a couple of bugs in the NBD, CIFS and OCFS2 socket handlers. Looking at the sock->op->shutdown() handlers, it looks as if all of them take a SHUT_RD/SHUT_WR/SHUT_RDWR argument instead of the RCV_SHUTDOWN/SEND_SHUTDOWN arguments. Add a helper, and then define the SHUT_* enum to ensure that kernel users of shutdown() don't get confused. Signed-off-by: Trond Myklebust Acked-by: Mark Fasheh Acked-by: David Howells Signed-off-by: David S. Miller --- net/rxrpc/ar-local.c | 4 ++-- net/socket.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'net') diff --git a/net/rxrpc/ar-local.c b/net/rxrpc/ar-local.c index fe03f71f17da..f3a2bd747a8f 100644 --- a/net/rxrpc/ar-local.c +++ b/net/rxrpc/ar-local.c @@ -114,7 +114,7 @@ static int rxrpc_create_local(struct rxrpc_local *local) return 0; error: - local->socket->ops->shutdown(local->socket, 2); + kernel_sock_shutdown(local->socket, SHUT_RDWR); local->socket->sk->sk_user_data = NULL; sock_release(local->socket); local->socket = NULL; @@ -267,7 +267,7 @@ static void rxrpc_destroy_local(struct work_struct *work) /* finish cleaning up the local descriptor */ rxrpc_purge_queue(&local->accept_queue); rxrpc_purge_queue(&local->reject_queue); - local->socket->ops->shutdown(local->socket, 2); + kernel_sock_shutdown(local->socket, SHUT_RDWR); sock_release(local->socket); up_read(&rxrpc_local_sem); diff --git a/net/socket.c b/net/socket.c index 5d879fd3d01d..74784dfe8e5b 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2319,6 +2319,11 @@ int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg) return err; } +int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how) +{ + return sock->ops->shutdown(sock, how); +} + /* ABI emulation layers need these two */ EXPORT_SYMBOL(move_addr_to_kernel); EXPORT_SYMBOL(move_addr_to_user); @@ -2345,3 +2350,4 @@ EXPORT_SYMBOL(kernel_getsockopt); EXPORT_SYMBOL(kernel_setsockopt); EXPORT_SYMBOL(kernel_sendpage); EXPORT_SYMBOL(kernel_sock_ioctl); +EXPORT_SYMBOL(kernel_sock_shutdown); -- cgit v1.2.3