Commit 8c918ffb authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David S. Miller

net: remove compat_sock_common_{get,set}sockopt

Add the compat handling to sock_common_{get,set}sockopt instead,
keyed of in_compat_syscall().  This allow to remove the now unused
->compat_{get,set}sockopt methods from struct proto_ops.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Acked-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4d295e54
...@@ -165,12 +165,6 @@ struct proto_ops { ...@@ -165,12 +165,6 @@ struct proto_ops {
int optname, char __user *optval, unsigned int optlen); int optname, char __user *optval, unsigned int optlen);
int (*getsockopt)(struct socket *sock, int level, int (*getsockopt)(struct socket *sock, int level,
int optname, char __user *optval, int __user *optlen); int optname, char __user *optval, int __user *optlen);
#ifdef CONFIG_COMPAT
int (*compat_setsockopt)(struct socket *sock, int level,
int optname, char __user *optval, unsigned int optlen);
int (*compat_getsockopt)(struct socket *sock, int level,
int optname, char __user *optval, int __user *optlen);
#endif
void (*show_fdinfo)(struct seq_file *m, struct socket *sock); void (*show_fdinfo)(struct seq_file *m, struct socket *sock);
int (*sendmsg) (struct socket *sock, struct msghdr *m, int (*sendmsg) (struct socket *sock, struct msghdr *m,
size_t total_len); size_t total_len);
......
...@@ -1744,10 +1744,6 @@ int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, ...@@ -1744,10 +1744,6 @@ int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
int flags); int flags);
int sock_common_setsockopt(struct socket *sock, int level, int optname, int sock_common_setsockopt(struct socket *sock, int level, int optname,
char __user *optval, unsigned int optlen); char __user *optval, unsigned int optlen);
int compat_sock_common_getsockopt(struct socket *sock, int level,
int optname, char __user *optval, int __user *optlen);
int compat_sock_common_setsockopt(struct socket *sock, int level,
int optname, char __user *optval, unsigned int optlen);
void sk_common_release(struct sock *sk); void sk_common_release(struct sock *sk);
......
...@@ -3199,23 +3199,14 @@ int sock_common_getsockopt(struct socket *sock, int level, int optname, ...@@ -3199,23 +3199,14 @@ int sock_common_getsockopt(struct socket *sock, int level, int optname,
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen);
}
EXPORT_SYMBOL(sock_common_getsockopt);
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
int compat_sock_common_getsockopt(struct socket *sock, int level, int optname, if (in_compat_syscal() && sk->sk_prot->compat_getsockopt)
char __user *optval, int __user *optlen)
{
struct sock *sk = sock->sk;
if (sk->sk_prot->compat_getsockopt != NULL)
return sk->sk_prot->compat_getsockopt(sk, level, optname, return sk->sk_prot->compat_getsockopt(sk, level, optname,
optval, optlen); optval, optlen);
#endif
return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen); return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen);
} }
EXPORT_SYMBOL(compat_sock_common_getsockopt); EXPORT_SYMBOL(sock_common_getsockopt);
#endif
int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
int flags) int flags)
...@@ -3240,23 +3231,14 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname, ...@@ -3240,23 +3231,14 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname,
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen);
}
EXPORT_SYMBOL(sock_common_setsockopt);
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
int compat_sock_common_setsockopt(struct socket *sock, int level, int optname, if (in_compat_syscall() && sk->sk_prot->compat_setsockopt)
char __user *optval, unsigned int optlen)
{
struct sock *sk = sock->sk;
if (sk->sk_prot->compat_setsockopt != NULL)
return sk->sk_prot->compat_setsockopt(sk, level, optname, return sk->sk_prot->compat_setsockopt(sk, level, optname,
optval, optlen); optval, optlen);
#endif
return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen); return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen);
} }
EXPORT_SYMBOL(compat_sock_common_setsockopt); EXPORT_SYMBOL(sock_common_setsockopt);
#endif
void sk_common_release(struct sock *sk) void sk_common_release(struct sock *sk)
{ {
......
...@@ -999,10 +999,6 @@ static const struct proto_ops inet_dccp_ops = { ...@@ -999,10 +999,6 @@ static const struct proto_ops inet_dccp_ops = {
.recvmsg = sock_common_recvmsg, .recvmsg = sock_common_recvmsg,
.mmap = sock_no_mmap, .mmap = sock_no_mmap,
.sendpage = sock_no_sendpage, .sendpage = sock_no_sendpage,
#ifdef CONFIG_COMPAT
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif
}; };
static struct inet_protosw dccp_v4_protosw = { static struct inet_protosw dccp_v4_protosw = {
......
...@@ -1083,8 +1083,6 @@ static const struct proto_ops inet6_dccp_ops = { ...@@ -1083,8 +1083,6 @@ static const struct proto_ops inet6_dccp_ops = {
.sendpage = sock_no_sendpage, .sendpage = sock_no_sendpage,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = inet6_compat_ioctl, .compat_ioctl = inet6_compat_ioctl,
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif #endif
}; };
......
...@@ -423,10 +423,6 @@ static const struct proto_ops ieee802154_raw_ops = { ...@@ -423,10 +423,6 @@ static const struct proto_ops ieee802154_raw_ops = {
.recvmsg = sock_common_recvmsg, .recvmsg = sock_common_recvmsg,
.mmap = sock_no_mmap, .mmap = sock_no_mmap,
.sendpage = sock_no_sendpage, .sendpage = sock_no_sendpage,
#ifdef CONFIG_COMPAT
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif
}; };
/* DGRAM Sockets (802.15.4 dataframes) */ /* DGRAM Sockets (802.15.4 dataframes) */
...@@ -986,10 +982,6 @@ static const struct proto_ops ieee802154_dgram_ops = { ...@@ -986,10 +982,6 @@ static const struct proto_ops ieee802154_dgram_ops = {
.recvmsg = sock_common_recvmsg, .recvmsg = sock_common_recvmsg,
.mmap = sock_no_mmap, .mmap = sock_no_mmap,
.sendpage = sock_no_sendpage, .sendpage = sock_no_sendpage,
#ifdef CONFIG_COMPAT
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif
}; };
/* Create a socket. Initialise the socket, blank the addresses /* Create a socket. Initialise the socket, blank the addresses
......
...@@ -1043,8 +1043,6 @@ const struct proto_ops inet_stream_ops = { ...@@ -1043,8 +1043,6 @@ const struct proto_ops inet_stream_ops = {
.sendpage_locked = tcp_sendpage_locked, .sendpage_locked = tcp_sendpage_locked,
.peek_len = tcp_peek_len, .peek_len = tcp_peek_len,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
.compat_ioctl = inet_compat_ioctl, .compat_ioctl = inet_compat_ioctl,
#endif #endif
.set_rcvlowat = tcp_set_rcvlowat, .set_rcvlowat = tcp_set_rcvlowat,
...@@ -1073,8 +1071,6 @@ const struct proto_ops inet_dgram_ops = { ...@@ -1073,8 +1071,6 @@ const struct proto_ops inet_dgram_ops = {
.sendpage = inet_sendpage, .sendpage = inet_sendpage,
.set_peek_off = sk_set_peek_off, .set_peek_off = sk_set_peek_off,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
.compat_ioctl = inet_compat_ioctl, .compat_ioctl = inet_compat_ioctl,
#endif #endif
}; };
...@@ -1105,8 +1101,6 @@ static const struct proto_ops inet_sockraw_ops = { ...@@ -1105,8 +1101,6 @@ static const struct proto_ops inet_sockraw_ops = {
.mmap = sock_no_mmap, .mmap = sock_no_mmap,
.sendpage = inet_sendpage, .sendpage = inet_sendpage,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
.compat_ioctl = inet_compat_ioctl, .compat_ioctl = inet_compat_ioctl,
#endif #endif
}; };
......
...@@ -688,8 +688,6 @@ const struct proto_ops inet6_stream_ops = { ...@@ -688,8 +688,6 @@ const struct proto_ops inet6_stream_ops = {
.peek_len = tcp_peek_len, .peek_len = tcp_peek_len,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = inet6_compat_ioctl, .compat_ioctl = inet6_compat_ioctl,
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif #endif
.set_rcvlowat = tcp_set_rcvlowat, .set_rcvlowat = tcp_set_rcvlowat,
}; };
...@@ -717,8 +715,6 @@ const struct proto_ops inet6_dgram_ops = { ...@@ -717,8 +715,6 @@ const struct proto_ops inet6_dgram_ops = {
.set_peek_off = sk_set_peek_off, .set_peek_off = sk_set_peek_off,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = inet6_compat_ioctl, .compat_ioctl = inet6_compat_ioctl,
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif #endif
}; };
......
...@@ -914,12 +914,8 @@ int compat_ipv6_setsockopt(struct sock *sk, int level, int optname, ...@@ -914,12 +914,8 @@ int compat_ipv6_setsockopt(struct sock *sk, int level, int optname,
{ {
int err; int err;
if (level == SOL_IP && sk->sk_type != SOCK_RAW) { if (level == SOL_IP && sk->sk_type != SOCK_RAW)
if (udp_prot.compat_setsockopt != NULL)
return udp_prot.compat_setsockopt(sk, level, optname,
optval, optlen);
return udp_prot.setsockopt(sk, level, optname, optval, optlen); return udp_prot.setsockopt(sk, level, optname, optval, optlen);
}
if (level != SOL_IPV6) if (level != SOL_IPV6)
return -ENOPROTOOPT; return -ENOPROTOOPT;
...@@ -1480,12 +1476,8 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -1480,12 +1476,8 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
{ {
int err; int err;
if (level == SOL_IP && sk->sk_type != SOCK_RAW) { if (level == SOL_IP && sk->sk_type != SOCK_RAW)
if (udp_prot.compat_getsockopt != NULL)
return udp_prot.compat_getsockopt(sk, level, optname,
optval, optlen);
return udp_prot.getsockopt(sk, level, optname, optval, optlen); return udp_prot.getsockopt(sk, level, optname, optval, optlen);
}
if (level != SOL_IPV6) if (level != SOL_IPV6)
return -ENOPROTOOPT; return -ENOPROTOOPT;
......
...@@ -1378,8 +1378,6 @@ const struct proto_ops inet6_sockraw_ops = { ...@@ -1378,8 +1378,6 @@ const struct proto_ops inet6_sockraw_ops = {
.sendpage = sock_no_sendpage, .sendpage = sock_no_sendpage,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = inet6_compat_ioctl, .compat_ioctl = inet6_compat_ioctl,
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif #endif
}; };
......
...@@ -638,10 +638,6 @@ static const struct proto_ops l2tp_ip_ops = { ...@@ -638,10 +638,6 @@ static const struct proto_ops l2tp_ip_ops = {
.recvmsg = sock_common_recvmsg, .recvmsg = sock_common_recvmsg,
.mmap = sock_no_mmap, .mmap = sock_no_mmap,
.sendpage = sock_no_sendpage, .sendpage = sock_no_sendpage,
#ifdef CONFIG_COMPAT
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif
}; };
static struct inet_protosw l2tp_ip_protosw = { static struct inet_protosw l2tp_ip_protosw = {
......
...@@ -773,8 +773,6 @@ static const struct proto_ops l2tp_ip6_ops = { ...@@ -773,8 +773,6 @@ static const struct proto_ops l2tp_ip6_ops = {
.sendpage = sock_no_sendpage, .sendpage = sock_no_sendpage,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = inet6_compat_ioctl, .compat_ioctl = inet6_compat_ioctl,
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif #endif
}; };
......
...@@ -2166,10 +2166,6 @@ static const struct proto_ops mptcp_stream_ops = { ...@@ -2166,10 +2166,6 @@ static const struct proto_ops mptcp_stream_ops = {
.recvmsg = inet_recvmsg, .recvmsg = inet_recvmsg,
.mmap = sock_no_mmap, .mmap = sock_no_mmap,
.sendpage = inet_sendpage, .sendpage = inet_sendpage,
#ifdef CONFIG_COMPAT
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif
}; };
static struct inet_protosw mptcp_protosw = { static struct inet_protosw mptcp_protosw = {
...@@ -2222,8 +2218,6 @@ static const struct proto_ops mptcp_v6_stream_ops = { ...@@ -2222,8 +2218,6 @@ static const struct proto_ops mptcp_v6_stream_ops = {
.sendpage = inet_sendpage, .sendpage = inet_sendpage,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = inet6_compat_ioctl, .compat_ioctl = inet6_compat_ioctl,
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif #endif
}; };
......
...@@ -441,10 +441,6 @@ const struct proto_ops phonet_dgram_ops = { ...@@ -441,10 +441,6 @@ const struct proto_ops phonet_dgram_ops = {
.shutdown = sock_no_shutdown, .shutdown = sock_no_shutdown,
.setsockopt = sock_no_setsockopt, .setsockopt = sock_no_setsockopt,
.getsockopt = sock_no_getsockopt, .getsockopt = sock_no_getsockopt,
#ifdef CONFIG_COMPAT
.compat_setsockopt = sock_no_setsockopt,
.compat_getsockopt = sock_no_getsockopt,
#endif
.sendmsg = pn_socket_sendmsg, .sendmsg = pn_socket_sendmsg,
.recvmsg = sock_common_recvmsg, .recvmsg = sock_common_recvmsg,
.mmap = sock_no_mmap, .mmap = sock_no_mmap,
...@@ -466,10 +462,6 @@ const struct proto_ops phonet_stream_ops = { ...@@ -466,10 +462,6 @@ const struct proto_ops phonet_stream_ops = {
.shutdown = sock_no_shutdown, .shutdown = sock_no_shutdown,
.setsockopt = sock_common_setsockopt, .setsockopt = sock_common_setsockopt,
.getsockopt = sock_common_getsockopt, .getsockopt = sock_common_getsockopt,
#ifdef CONFIG_COMPAT
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif
.sendmsg = pn_socket_sendmsg, .sendmsg = pn_socket_sendmsg,
.recvmsg = sock_common_recvmsg, .recvmsg = sock_common_recvmsg,
.mmap = sock_no_mmap, .mmap = sock_no_mmap,
......
...@@ -1033,8 +1033,6 @@ static const struct proto_ops inet6_seqpacket_ops = { ...@@ -1033,8 +1033,6 @@ static const struct proto_ops inet6_seqpacket_ops = {
.mmap = sock_no_mmap, .mmap = sock_no_mmap,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = inet6_compat_ioctl, .compat_ioctl = inet6_compat_ioctl,
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif #endif
}; };
......
...@@ -1036,10 +1036,6 @@ static const struct proto_ops inet_seqpacket_ops = { ...@@ -1036,10 +1036,6 @@ static const struct proto_ops inet_seqpacket_ops = {
.recvmsg = inet_recvmsg, .recvmsg = inet_recvmsg,
.mmap = sock_no_mmap, .mmap = sock_no_mmap,
.sendpage = sock_no_sendpage, .sendpage = sock_no_sendpage,
#ifdef CONFIG_COMPAT
.compat_setsockopt = compat_sock_common_setsockopt,
.compat_getsockopt = compat_sock_common_getsockopt,
#endif
}; };
/* Registration with AF_INET family. */ /* Registration with AF_INET family. */
......
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