diff options
author | Dmitry Mishin <dim@openvz.org> | 2006-03-21 01:45:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:45:21 -0500 |
commit | 3fdadf7d27e3fbcf72930941884387d1f4936f04 (patch) | |
tree | 167072cf1e60b6b307610563614b435ff0caa52d /net/core | |
parent | c750360938b403e6cc193d293cfbcb099dd6c60e (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.c | 28 |
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 | ||
1386 | EXPORT_SYMBOL(sock_common_getsockopt); | 1386 | EXPORT_SYMBOL(sock_common_getsockopt); |
1387 | 1387 | ||
1388 | #ifdef CONFIG_COMPAT | ||
1389 | int 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 | } | ||
1399 | EXPORT_SYMBOL(compat_sock_common_getsockopt); | ||
1400 | #endif | ||
1401 | |||
1388 | int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, | 1402 | int 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 | ||
1415 | EXPORT_SYMBOL(sock_common_setsockopt); | 1429 | EXPORT_SYMBOL(sock_common_setsockopt); |
1416 | 1430 | ||
1431 | #ifdef CONFIG_COMPAT | ||
1432 | int 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 | } | ||
1442 | EXPORT_SYMBOL(compat_sock_common_setsockopt); | ||
1443 | #endif | ||
1444 | |||
1417 | void sk_common_release(struct sock *sk) | 1445 | void sk_common_release(struct sock *sk) |
1418 | { | 1446 | { |
1419 | if (sk->sk_prot->destroy) | 1447 | if (sk->sk_prot->destroy) |