Commit 048ed4b6 authored by wangweidong's avatar wangweidong Committed by David S. Miller

sctp: remove macros sctp_{lock|release}_sock

Redefined {lock|release}_sock to sctp_{lock|release}_sock for user space friendly
code which we haven't use in years, so removing them.
Signed-off-by: default avatarWang Weidong <wangweidong1@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1b0de194
...@@ -713,11 +713,11 @@ static void process_sctp_notification(struct connection *con, ...@@ -713,11 +713,11 @@ static void process_sctp_notification(struct connection *con,
return; return;
/* Peel off a new sock */ /* Peel off a new sock */
sctp_lock_sock(con->sock->sk); lock_sock(con->sock->sk);
ret = sctp_do_peeloff(con->sock->sk, ret = sctp_do_peeloff(con->sock->sk,
sn->sn_assoc_change.sac_assoc_id, sn->sn_assoc_change.sac_assoc_id,
&new_con->sock); &new_con->sock);
sctp_release_sock(con->sock->sk); release_sock(con->sock->sk);
if (ret < 0) { if (ret < 0) {
log_print("Can't peel off a socket for " log_print("Can't peel off a socket for "
"connection %d to node %d: err=%d", "connection %d to node %d: err=%d",
......
...@@ -171,8 +171,6 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly; ...@@ -171,8 +171,6 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
*/ */
/* sock lock wrappers. */ /* sock lock wrappers. */
#define sctp_lock_sock(sk) lock_sock(sk)
#define sctp_release_sock(sk) release_sock(sk)
#define sctp_bh_lock_sock(sk) bh_lock_sock(sk) #define sctp_bh_lock_sock(sk) bh_lock_sock(sk)
#define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk) #define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk)
......
...@@ -272,7 +272,7 @@ static int sctp_bind(struct sock *sk, struct sockaddr *addr, int addr_len) ...@@ -272,7 +272,7 @@ static int sctp_bind(struct sock *sk, struct sockaddr *addr, int addr_len)
{ {
int retval = 0; int retval = 0;
sctp_lock_sock(sk); lock_sock(sk);
pr_debug("%s: sk:%p, addr:%p, addr_len:%d\n", __func__, sk, pr_debug("%s: sk:%p, addr:%p, addr_len:%d\n", __func__, sk,
addr, addr_len); addr, addr_len);
...@@ -284,7 +284,7 @@ static int sctp_bind(struct sock *sk, struct sockaddr *addr, int addr_len) ...@@ -284,7 +284,7 @@ static int sctp_bind(struct sock *sk, struct sockaddr *addr, int addr_len)
else else
retval = -EINVAL; retval = -EINVAL;
sctp_release_sock(sk); release_sock(sk);
return retval; return retval;
} }
...@@ -1461,7 +1461,7 @@ static void sctp_close(struct sock *sk, long timeout) ...@@ -1461,7 +1461,7 @@ static void sctp_close(struct sock *sk, long timeout)
pr_debug("%s: sk:%p, timeout:%ld\n", __func__, sk, timeout); pr_debug("%s: sk:%p, timeout:%ld\n", __func__, sk, timeout);
sctp_lock_sock(sk); lock_sock(sk);
sk->sk_shutdown = SHUTDOWN_MASK; sk->sk_shutdown = SHUTDOWN_MASK;
sk->sk_state = SCTP_SS_CLOSING; sk->sk_state = SCTP_SS_CLOSING;
...@@ -1505,7 +1505,7 @@ static void sctp_close(struct sock *sk, long timeout) ...@@ -1505,7 +1505,7 @@ static void sctp_close(struct sock *sk, long timeout)
sctp_wait_for_close(sk, timeout); sctp_wait_for_close(sk, timeout);
/* This will run the backlog queue. */ /* This will run the backlog queue. */
sctp_release_sock(sk); release_sock(sk);
/* Supposedly, no process has access to the socket, but /* Supposedly, no process has access to the socket, but
* the net layers still may. * the net layers still may.
...@@ -1665,7 +1665,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, ...@@ -1665,7 +1665,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
pr_debug("%s: about to look up association\n", __func__); pr_debug("%s: about to look up association\n", __func__);
sctp_lock_sock(sk); lock_sock(sk);
/* If a msg_name has been specified, assume this is to be used. */ /* If a msg_name has been specified, assume this is to be used. */
if (msg_name) { if (msg_name) {
...@@ -1949,7 +1949,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, ...@@ -1949,7 +1949,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
sctp_association_free(asoc); sctp_association_free(asoc);
} }
out_unlock: out_unlock:
sctp_release_sock(sk); release_sock(sk);
out_nounlock: out_nounlock:
return sctp_error(sk, msg_flags, err); return sctp_error(sk, msg_flags, err);
...@@ -2035,7 +2035,7 @@ static int sctp_recvmsg(struct kiocb *iocb, struct sock *sk, ...@@ -2035,7 +2035,7 @@ static int sctp_recvmsg(struct kiocb *iocb, struct sock *sk,
"addr_len:%p)\n", __func__, sk, msg, len, noblock, flags, "addr_len:%p)\n", __func__, sk, msg, len, noblock, flags,
addr_len); addr_len);
sctp_lock_sock(sk); lock_sock(sk);
if (sctp_style(sk, TCP) && !sctp_sstate(sk, ESTABLISHED)) { if (sctp_style(sk, TCP) && !sctp_sstate(sk, ESTABLISHED)) {
err = -ENOTCONN; err = -ENOTCONN;
...@@ -2119,7 +2119,7 @@ static int sctp_recvmsg(struct kiocb *iocb, struct sock *sk, ...@@ -2119,7 +2119,7 @@ static int sctp_recvmsg(struct kiocb *iocb, struct sock *sk,
sctp_ulpevent_free(event); sctp_ulpevent_free(event);
} }
out: out:
sctp_release_sock(sk); release_sock(sk);
return err; return err;
} }
...@@ -3590,7 +3590,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, ...@@ -3590,7 +3590,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
goto out_nounlock; goto out_nounlock;
} }
sctp_lock_sock(sk); lock_sock(sk);
switch (optname) { switch (optname) {
case SCTP_SOCKOPT_BINDX_ADD: case SCTP_SOCKOPT_BINDX_ADD:
...@@ -3708,7 +3708,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, ...@@ -3708,7 +3708,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
break; break;
} }
sctp_release_sock(sk); release_sock(sk);
out_nounlock: out_nounlock:
return retval; return retval;
...@@ -3736,7 +3736,7 @@ static int sctp_connect(struct sock *sk, struct sockaddr *addr, ...@@ -3736,7 +3736,7 @@ static int sctp_connect(struct sock *sk, struct sockaddr *addr,
int err = 0; int err = 0;
struct sctp_af *af; struct sctp_af *af;
sctp_lock_sock(sk); lock_sock(sk);
pr_debug("%s: sk:%p, sockaddr:%p, addr_len:%d\n", __func__, sk, pr_debug("%s: sk:%p, sockaddr:%p, addr_len:%d\n", __func__, sk,
addr, addr_len); addr, addr_len);
...@@ -3752,7 +3752,7 @@ static int sctp_connect(struct sock *sk, struct sockaddr *addr, ...@@ -3752,7 +3752,7 @@ static int sctp_connect(struct sock *sk, struct sockaddr *addr,
err = __sctp_connect(sk, addr, af->sockaddr_len, NULL); err = __sctp_connect(sk, addr, af->sockaddr_len, NULL);
} }
sctp_release_sock(sk); release_sock(sk);
return err; return err;
} }
...@@ -3778,7 +3778,7 @@ static struct sock *sctp_accept(struct sock *sk, int flags, int *err) ...@@ -3778,7 +3778,7 @@ static struct sock *sctp_accept(struct sock *sk, int flags, int *err)
long timeo; long timeo;
int error = 0; int error = 0;
sctp_lock_sock(sk); lock_sock(sk);
sp = sctp_sk(sk); sp = sctp_sk(sk);
ep = sp->ep; ep = sp->ep;
...@@ -3816,7 +3816,7 @@ static struct sock *sctp_accept(struct sock *sk, int flags, int *err) ...@@ -3816,7 +3816,7 @@ static struct sock *sctp_accept(struct sock *sk, int flags, int *err)
sctp_sock_migrate(sk, newsk, asoc, SCTP_SOCKET_TCP); sctp_sock_migrate(sk, newsk, asoc, SCTP_SOCKET_TCP);
out: out:
sctp_release_sock(sk); release_sock(sk);
*err = error; *err = error;
return newsk; return newsk;
} }
...@@ -3826,7 +3826,7 @@ static int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -3826,7 +3826,7 @@ static int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg)
{ {
int rc = -ENOTCONN; int rc = -ENOTCONN;
sctp_lock_sock(sk); lock_sock(sk);
/* /*
* SEQPACKET-style sockets in LISTENING state are valid, for * SEQPACKET-style sockets in LISTENING state are valid, for
...@@ -3856,7 +3856,7 @@ static int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -3856,7 +3856,7 @@ static int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg)
break; break;
} }
out: out:
sctp_release_sock(sk); release_sock(sk);
return rc; return rc;
} }
...@@ -5754,7 +5754,7 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname, ...@@ -5754,7 +5754,7 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname,
if (get_user(len, optlen)) if (get_user(len, optlen))
return -EFAULT; return -EFAULT;
sctp_lock_sock(sk); lock_sock(sk);
switch (optname) { switch (optname) {
case SCTP_STATUS: case SCTP_STATUS:
...@@ -5878,7 +5878,7 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname, ...@@ -5878,7 +5878,7 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname,
break; break;
} }
sctp_release_sock(sk); release_sock(sk);
return retval; return retval;
} }
...@@ -6144,7 +6144,7 @@ int sctp_inet_listen(struct socket *sock, int backlog) ...@@ -6144,7 +6144,7 @@ int sctp_inet_listen(struct socket *sock, int backlog)
if (unlikely(backlog < 0)) if (unlikely(backlog < 0))
return err; return err;
sctp_lock_sock(sk); lock_sock(sk);
/* Peeled-off sockets are not allowed to listen(). */ /* Peeled-off sockets are not allowed to listen(). */
if (sctp_style(sk, UDP_HIGH_BANDWIDTH)) if (sctp_style(sk, UDP_HIGH_BANDWIDTH))
...@@ -6177,7 +6177,7 @@ int sctp_inet_listen(struct socket *sock, int backlog) ...@@ -6177,7 +6177,7 @@ int sctp_inet_listen(struct socket *sock, int backlog)
err = 0; err = 0;
out: out:
sctp_release_sock(sk); release_sock(sk);
return err; return err;
} }
...@@ -6474,9 +6474,9 @@ static int sctp_wait_for_packet(struct sock *sk, int *err, long *timeo_p) ...@@ -6474,9 +6474,9 @@ static int sctp_wait_for_packet(struct sock *sk, int *err, long *timeo_p)
* does not fit in the user's buffer, but this seems to be the * does not fit in the user's buffer, but this seems to be the
* only way to honor MSG_DONTWAIT realistically. * only way to honor MSG_DONTWAIT realistically.
*/ */
sctp_release_sock(sk); release_sock(sk);
*timeo_p = schedule_timeout(*timeo_p); *timeo_p = schedule_timeout(*timeo_p);
sctp_lock_sock(sk); lock_sock(sk);
ready: ready:
finish_wait(sk_sleep(sk), &wait); finish_wait(sk_sleep(sk), &wait);
...@@ -6659,10 +6659,10 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, ...@@ -6659,10 +6659,10 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
/* Let another process have a go. Since we are going /* Let another process have a go. Since we are going
* to sleep anyway. * to sleep anyway.
*/ */
sctp_release_sock(sk); release_sock(sk);
current_timeo = schedule_timeout(current_timeo); current_timeo = schedule_timeout(current_timeo);
BUG_ON(sk != asoc->base.sk); BUG_ON(sk != asoc->base.sk);
sctp_lock_sock(sk); lock_sock(sk);
*timeo_p = current_timeo; *timeo_p = current_timeo;
} }
...@@ -6767,9 +6767,9 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p) ...@@ -6767,9 +6767,9 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p)
/* Let another process have a go. Since we are going /* Let another process have a go. Since we are going
* to sleep anyway. * to sleep anyway.
*/ */
sctp_release_sock(sk); release_sock(sk);
current_timeo = schedule_timeout(current_timeo); current_timeo = schedule_timeout(current_timeo);
sctp_lock_sock(sk); lock_sock(sk);
*timeo_p = current_timeo; *timeo_p = current_timeo;
} }
...@@ -6812,9 +6812,9 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo) ...@@ -6812,9 +6812,9 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo)
TASK_INTERRUPTIBLE); TASK_INTERRUPTIBLE);
if (list_empty(&ep->asocs)) { if (list_empty(&ep->asocs)) {
sctp_release_sock(sk); release_sock(sk);
timeo = schedule_timeout(timeo); timeo = schedule_timeout(timeo);
sctp_lock_sock(sk); lock_sock(sk);
} }
err = -EINVAL; err = -EINVAL;
...@@ -6847,9 +6847,9 @@ static void sctp_wait_for_close(struct sock *sk, long timeout) ...@@ -6847,9 +6847,9 @@ static void sctp_wait_for_close(struct sock *sk, long timeout)
prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
if (list_empty(&sctp_sk(sk)->ep->asocs)) if (list_empty(&sctp_sk(sk)->ep->asocs))
break; break;
sctp_release_sock(sk); release_sock(sk);
timeout = schedule_timeout(timeout); timeout = schedule_timeout(timeout);
sctp_lock_sock(sk); lock_sock(sk);
} while (!signal_pending(current) && timeout); } while (!signal_pending(current) && timeout);
finish_wait(sk_sleep(sk), &wait); finish_wait(sk_sleep(sk), &wait);
...@@ -7046,7 +7046,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, ...@@ -7046,7 +7046,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
newsk->sk_shutdown |= RCV_SHUTDOWN; newsk->sk_shutdown |= RCV_SHUTDOWN;
newsk->sk_state = SCTP_SS_ESTABLISHED; newsk->sk_state = SCTP_SS_ESTABLISHED;
sctp_release_sock(newsk); release_sock(newsk);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment