diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-01-15 15:52:14 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-02-27 00:14:22 -0500 |
commit | d58daf42d29a3a4a4d4be46cf47ceee096789680 (patch) | |
tree | c88a5820a44fe993e271437b0fcebdde7e8298d3 /net/bluetooth/sco.c | |
parent | 91aa35a5aa3540223066bf6b51c935418c63a35d (diff) |
Bluetooth: Preparation for usage of SOL_BLUETOOTH
The socket option levels SOL_L2CAP, SOL_RFOMM and SOL_SCO are currently
in use by various Bluetooth applications. Going forward the common
option level SOL_BLUETOOTH should be used. This patch prepares the clean
split of the old and new option levels while keeping everything backward
compatibility.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/sco.c')
-rw-r--r-- | net/bluetooth/sco.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 46fd8bf9a690..dea40d4bb6f5 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -668,7 +668,7 @@ static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char | |||
668 | return err; | 668 | return err; |
669 | } | 669 | } |
670 | 670 | ||
671 | static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) | 671 | static int sco_sock_getsockopt_old(struct socket *sock, int optname, char __user *optval, int __user *optlen) |
672 | { | 672 | { |
673 | struct sock *sk = sock->sk; | 673 | struct sock *sk = sock->sk; |
674 | struct sco_options opts; | 674 | struct sco_options opts; |
@@ -723,6 +723,31 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char | |||
723 | return err; | 723 | return err; |
724 | } | 724 | } |
725 | 725 | ||
726 | static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) | ||
727 | { | ||
728 | struct sock *sk = sock->sk; | ||
729 | int len, err = 0; | ||
730 | |||
731 | BT_DBG("sk %p", sk); | ||
732 | |||
733 | if (level == SOL_SCO) | ||
734 | return sco_sock_getsockopt_old(sock, optname, optval, optlen); | ||
735 | |||
736 | if (get_user(len, optlen)) | ||
737 | return -EFAULT; | ||
738 | |||
739 | lock_sock(sk); | ||
740 | |||
741 | switch (optname) { | ||
742 | default: | ||
743 | err = -ENOPROTOOPT; | ||
744 | break; | ||
745 | } | ||
746 | |||
747 | release_sock(sk); | ||
748 | return err; | ||
749 | } | ||
750 | |||
726 | static int sco_sock_release(struct socket *sock) | 751 | static int sco_sock_release(struct socket *sock) |
727 | { | 752 | { |
728 | struct sock *sk = sock->sk; | 753 | struct sock *sk = sock->sk; |