aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorDmitry Mishin <dim@openvz.org>2006-03-21 01:45:21 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-21 01:45:21 -0500
commit3fdadf7d27e3fbcf72930941884387d1f4936f04 (patch)
tree167072cf1e60b6b307610563614b435ff0caa52d /net/core
parentc750360938b403e6cc193d293cfbcb099dd6c60e (diff)
[NET]: {get|set}sockopt compatibility layer
This patch extends {get|set}sockopt compatibility layer in order to move protocol specific parts to their place and avoid huge universal net/compat.c file in the future. Signed-off-by: Dmitry Mishin <dim@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 5038a5a7bd84..dd63cdea3fe7 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1385,6 +1385,20 @@ int sock_common_getsockopt(struct socket *sock, int level, int optname,
1385 1385
1386EXPORT_SYMBOL(sock_common_getsockopt); 1386EXPORT_SYMBOL(sock_common_getsockopt);
1387 1387
1388#ifdef CONFIG_COMPAT
1389int compat_sock_common_getsockopt(struct socket *sock, int level,
1390 int optname, char __user *optval, int __user *optlen)
1391{
1392 struct sock *sk = sock->sk;
1393
1394 if (sk->sk_prot->compat_setsockopt)
1395 return sk->sk_prot->compat_getsockopt(sk, level,
1396 optname, optval, optlen);
1397 return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen);
1398}
1399EXPORT_SYMBOL(compat_sock_common_getsockopt);
1400#endif
1401
1388int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, 1402int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
1389 struct msghdr *msg, size_t size, int flags) 1403 struct msghdr *msg, size_t size, int flags)
1390{ 1404{
@@ -1414,6 +1428,20 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname,
1414 1428
1415EXPORT_SYMBOL(sock_common_setsockopt); 1429EXPORT_SYMBOL(sock_common_setsockopt);
1416 1430
1431#ifdef CONFIG_COMPAT
1432int compat_sock_common_setsockopt(struct socket *sock,
1433 int level, int optname, char __user *optval, int optlen)
1434{
1435 struct sock *sk = sock->sk;
1436
1437 if (sk->sk_prot->compat_setsockopt)
1438 return sk->sk_prot->compat_setsockopt(sk, level,
1439 optname, optval, optlen);
1440 return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen);
1441}
1442EXPORT_SYMBOL(compat_sock_common_setsockopt);
1443#endif
1444
1417void sk_common_release(struct sock *sk) 1445void sk_common_release(struct sock *sk)
1418{ 1446{
1419 if (sk->sk_prot->destroy) 1447 if (sk->sk_prot->destroy)