don't open-code kernel_setsockopt()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Родитель
c1ae3cfa0e
Коммит
e73a67f7cd
|
@ -1460,27 +1460,10 @@ static void o2net_rx_until_empty(struct work_struct *work)
|
|||
|
||||
static int o2net_set_nodelay(struct socket *sock)
|
||||
{
|
||||
int ret, val = 1;
|
||||
mm_segment_t oldfs;
|
||||
int val = 1;
|
||||
|
||||
oldfs = get_fs();
|
||||
set_fs(KERNEL_DS);
|
||||
|
||||
/*
|
||||
* Dear unsuspecting programmer,
|
||||
*
|
||||
* Don't use sock_setsockopt() for SOL_TCP. It doesn't check its level
|
||||
* argument and assumes SOL_SOCKET so, say, your TCP_NODELAY will
|
||||
* silently turn into SO_DEBUG.
|
||||
*
|
||||
* Yours,
|
||||
* Keeper of hilariously fragile interfaces.
|
||||
*/
|
||||
ret = sock->ops->setsockopt(sock, SOL_TCP, TCP_NODELAY,
|
||||
(char __user *)&val, sizeof(val));
|
||||
|
||||
set_fs(oldfs);
|
||||
return ret;
|
||||
return kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY,
|
||||
(void *)&val, sizeof(val));
|
||||
}
|
||||
|
||||
static int o2net_set_usertimeout(struct socket *sock)
|
||||
|
@ -1488,7 +1471,7 @@ static int o2net_set_usertimeout(struct socket *sock)
|
|||
int user_timeout = O2NET_TCP_USER_TIMEOUT;
|
||||
|
||||
return kernel_setsockopt(sock, SOL_TCP, TCP_USER_TIMEOUT,
|
||||
(char *)&user_timeout, sizeof(user_timeout));
|
||||
(void *)&user_timeout, sizeof(user_timeout));
|
||||
}
|
||||
|
||||
static void o2net_initialize_handshake(void)
|
||||
|
|
|
@ -84,13 +84,10 @@ static struct ctl_table rds_tcp_sysctl_table[] = {
|
|||
/* doing it this way avoids calling tcp_sk() */
|
||||
void rds_tcp_nonagle(struct socket *sock)
|
||||
{
|
||||
mm_segment_t oldfs = get_fs();
|
||||
int val = 1;
|
||||
|
||||
set_fs(KERNEL_DS);
|
||||
sock->ops->setsockopt(sock, SOL_TCP, TCP_NODELAY, (char __user *)&val,
|
||||
kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY, (void *)&val,
|
||||
sizeof(val));
|
||||
set_fs(oldfs);
|
||||
}
|
||||
|
||||
u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc)
|
||||
|
|
|
@ -40,13 +40,7 @@
|
|||
|
||||
static void rds_tcp_cork(struct socket *sock, int val)
|
||||
{
|
||||
mm_segment_t oldfs;
|
||||
|
||||
oldfs = get_fs();
|
||||
set_fs(KERNEL_DS);
|
||||
sock->ops->setsockopt(sock, SOL_TCP, TCP_CORK, (char __user *)&val,
|
||||
sizeof(val));
|
||||
set_fs(oldfs);
|
||||
kernel_setsockopt(sock, SOL_TCP, TCP_CORK, (void *)&val, sizeof(val));
|
||||
}
|
||||
|
||||
void rds_tcp_xmit_path_prepare(struct rds_conn_path *cp)
|
||||
|
|
Загрузка…
Ссылка в новой задаче