diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-02-03 23:33:56 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-02-07 22:43:30 -0500 |
commit | 65390587c7bcf8bb60b48387db766d8d7dfea982 (patch) | |
tree | 51037c1b24f8234f9e8ddc07cf594ce42fed1b91 | |
parent | bb58f747e519aba07a6f05a78d58cf8a0788e2d5 (diff) |
Bluetooth: move l2cap_sock_ops to l2cap_sock.c
First step to move all l2cap_sock_ops function to l2cap_sock.c
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r-- | include/net/bluetooth/l2cap.h | 12 | ||||
-rw-r--r-- | net/bluetooth/l2cap_core.c | 42 | ||||
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 21 |
3 files changed, 43 insertions, 32 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index fce5274a4f7b..533bef5f6341 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -438,6 +438,18 @@ void l2cap_sock_init(struct sock *sk, struct sock *parent); | |||
438 | struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, | 438 | struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, |
439 | int proto, gfp_t prio); | 439 | int proto, gfp_t prio); |
440 | 440 | ||
441 | int l2cap_sock_release(struct socket *sock); | ||
442 | int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen); | ||
443 | int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags); | ||
444 | int l2cap_sock_listen(struct socket *sock, int backlog); | ||
445 | int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int flags); | ||
446 | int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer); | ||
447 | int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len); | ||
448 | int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags); | ||
449 | int l2cap_sock_shutdown(struct socket *sock, int how); | ||
450 | int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen); | ||
451 | int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen); | ||
452 | |||
441 | 453 | ||
442 | void l2cap_load(void); | 454 | void l2cap_load(void); |
443 | 455 | ||
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index af678efec15f..74a3ea3625d6 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -859,7 +859,7 @@ static void l2cap_sock_close(struct sock *sk) | |||
859 | l2cap_sock_kill(sk); | 859 | l2cap_sock_kill(sk); |
860 | } | 860 | } |
861 | 861 | ||
862 | static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) | 862 | int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) |
863 | { | 863 | { |
864 | struct sock *sk = sock->sk; | 864 | struct sock *sk = sock->sk; |
865 | struct sockaddr_l2 la; | 865 | struct sockaddr_l2 la; |
@@ -983,7 +983,7 @@ done: | |||
983 | return err; | 983 | return err; |
984 | } | 984 | } |
985 | 985 | ||
986 | static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags) | 986 | int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags) |
987 | { | 987 | { |
988 | struct sock *sk = sock->sk; | 988 | struct sock *sk = sock->sk; |
989 | struct sockaddr_l2 la; | 989 | struct sockaddr_l2 la; |
@@ -1068,7 +1068,7 @@ done: | |||
1068 | return err; | 1068 | return err; |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | static int l2cap_sock_listen(struct socket *sock, int backlog) | 1071 | int l2cap_sock_listen(struct socket *sock, int backlog) |
1072 | { | 1072 | { |
1073 | struct sock *sk = sock->sk; | 1073 | struct sock *sk = sock->sk; |
1074 | int err = 0; | 1074 | int err = 0; |
@@ -1127,7 +1127,7 @@ done: | |||
1127 | return err; | 1127 | return err; |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | static int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int flags) | 1130 | int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int flags) |
1131 | { | 1131 | { |
1132 | DECLARE_WAITQUEUE(wait, current); | 1132 | DECLARE_WAITQUEUE(wait, current); |
1133 | struct sock *sk = sock->sk, *nsk; | 1133 | struct sock *sk = sock->sk, *nsk; |
@@ -1183,7 +1183,7 @@ done: | |||
1183 | return err; | 1183 | return err; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer) | 1186 | int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer) |
1187 | { | 1187 | { |
1188 | struct sockaddr_l2 *la = (struct sockaddr_l2 *) addr; | 1188 | struct sockaddr_l2 *la = (struct sockaddr_l2 *) addr; |
1189 | struct sock *sk = sock->sk; | 1189 | struct sock *sk = sock->sk; |
@@ -1665,7 +1665,7 @@ static inline int l2cap_sar_segment_sdu(struct sock *sk, struct msghdr *msg, siz | |||
1665 | return size; | 1665 | return size; |
1666 | } | 1666 | } |
1667 | 1667 | ||
1668 | static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) | 1668 | int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) |
1669 | { | 1669 | { |
1670 | struct sock *sk = sock->sk; | 1670 | struct sock *sk = sock->sk; |
1671 | struct l2cap_pinfo *pi = l2cap_pi(sk); | 1671 | struct l2cap_pinfo *pi = l2cap_pi(sk); |
@@ -1767,7 +1767,7 @@ done: | |||
1767 | return err; | 1767 | return err; |
1768 | } | 1768 | } |
1769 | 1769 | ||
1770 | static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags) | 1770 | int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags) |
1771 | { | 1771 | { |
1772 | struct sock *sk = sock->sk; | 1772 | struct sock *sk = sock->sk; |
1773 | 1773 | ||
@@ -1894,7 +1894,7 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us | |||
1894 | return err; | 1894 | return err; |
1895 | } | 1895 | } |
1896 | 1896 | ||
1897 | static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) | 1897 | int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) |
1898 | { | 1898 | { |
1899 | struct sock *sk = sock->sk; | 1899 | struct sock *sk = sock->sk; |
1900 | struct bt_security sec; | 1900 | struct bt_security sec; |
@@ -2067,7 +2067,7 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us | |||
2067 | return err; | 2067 | return err; |
2068 | } | 2068 | } |
2069 | 2069 | ||
2070 | static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) | 2070 | int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) |
2071 | { | 2071 | { |
2072 | struct sock *sk = sock->sk; | 2072 | struct sock *sk = sock->sk; |
2073 | struct bt_security sec; | 2073 | struct bt_security sec; |
@@ -2128,7 +2128,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch | |||
2128 | return err; | 2128 | return err; |
2129 | } | 2129 | } |
2130 | 2130 | ||
2131 | static int l2cap_sock_shutdown(struct socket *sock, int how) | 2131 | int l2cap_sock_shutdown(struct socket *sock, int how) |
2132 | { | 2132 | { |
2133 | struct sock *sk = sock->sk; | 2133 | struct sock *sk = sock->sk; |
2134 | int err = 0; | 2134 | int err = 0; |
@@ -2159,7 +2159,7 @@ static int l2cap_sock_shutdown(struct socket *sock, int how) | |||
2159 | return err; | 2159 | return err; |
2160 | } | 2160 | } |
2161 | 2161 | ||
2162 | static int l2cap_sock_release(struct socket *sock) | 2162 | int l2cap_sock_release(struct socket *sock) |
2163 | { | 2163 | { |
2164 | struct sock *sk = sock->sk; | 2164 | struct sock *sk = sock->sk; |
2165 | int err; | 2165 | int err; |
@@ -4715,26 +4715,6 @@ static const struct file_operations l2cap_debugfs_fops = { | |||
4715 | 4715 | ||
4716 | static struct dentry *l2cap_debugfs; | 4716 | static struct dentry *l2cap_debugfs; |
4717 | 4717 | ||
4718 | const struct proto_ops l2cap_sock_ops = { | ||
4719 | .family = PF_BLUETOOTH, | ||
4720 | .owner = THIS_MODULE, | ||
4721 | .release = l2cap_sock_release, | ||
4722 | .bind = l2cap_sock_bind, | ||
4723 | .connect = l2cap_sock_connect, | ||
4724 | .listen = l2cap_sock_listen, | ||
4725 | .accept = l2cap_sock_accept, | ||
4726 | .getname = l2cap_sock_getname, | ||
4727 | .sendmsg = l2cap_sock_sendmsg, | ||
4728 | .recvmsg = l2cap_sock_recvmsg, | ||
4729 | .poll = bt_sock_poll, | ||
4730 | .ioctl = bt_sock_ioctl, | ||
4731 | .mmap = sock_no_mmap, | ||
4732 | .socketpair = sock_no_socketpair, | ||
4733 | .shutdown = l2cap_sock_shutdown, | ||
4734 | .setsockopt = l2cap_sock_setsockopt, | ||
4735 | .getsockopt = l2cap_sock_getsockopt | ||
4736 | }; | ||
4737 | |||
4738 | static struct hci_proto l2cap_hci_proto = { | 4718 | static struct hci_proto l2cap_hci_proto = { |
4739 | .name = "L2CAP", | 4719 | .name = "L2CAP", |
4740 | .id = HCI_PROTO_L2CAP, | 4720 | .id = HCI_PROTO_L2CAP, |
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 6ea1894cecb7..c1455f72bf03 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -62,7 +62,6 @@ static void l2cap_sock_timeout(unsigned long arg) | |||
62 | sock_put(sk); | 62 | sock_put(sk); |
63 | } | 63 | } |
64 | 64 | ||
65 | |||
66 | static void l2cap_sock_destruct(struct sock *sk) | 65 | static void l2cap_sock_destruct(struct sock *sk) |
67 | { | 66 | { |
68 | BT_DBG("sk %p", sk); | 67 | BT_DBG("sk %p", sk); |
@@ -176,6 +175,26 @@ static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol, | |||
176 | return 0; | 175 | return 0; |
177 | } | 176 | } |
178 | 177 | ||
178 | const struct proto_ops l2cap_sock_ops = { | ||
179 | .family = PF_BLUETOOTH, | ||
180 | .owner = THIS_MODULE, | ||
181 | .release = l2cap_sock_release, | ||
182 | .bind = l2cap_sock_bind, | ||
183 | .connect = l2cap_sock_connect, | ||
184 | .listen = l2cap_sock_listen, | ||
185 | .accept = l2cap_sock_accept, | ||
186 | .getname = l2cap_sock_getname, | ||
187 | .sendmsg = l2cap_sock_sendmsg, | ||
188 | .recvmsg = l2cap_sock_recvmsg, | ||
189 | .poll = bt_sock_poll, | ||
190 | .ioctl = bt_sock_ioctl, | ||
191 | .mmap = sock_no_mmap, | ||
192 | .socketpair = sock_no_socketpair, | ||
193 | .shutdown = l2cap_sock_shutdown, | ||
194 | .setsockopt = l2cap_sock_setsockopt, | ||
195 | .getsockopt = l2cap_sock_getsockopt | ||
196 | }; | ||
197 | |||
179 | static const struct net_proto_family l2cap_sock_family_ops = { | 198 | static const struct net_proto_family l2cap_sock_family_ops = { |
180 | .family = PF_BLUETOOTH, | 199 | .family = PF_BLUETOOTH, |
181 | .owner = THIS_MODULE, | 200 | .owner = THIS_MODULE, |