Commit 65390587 authored by Gustavo F. Padovan's avatar Gustavo F. Padovan

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: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent bb58f747
...@@ -438,6 +438,18 @@ void l2cap_sock_init(struct sock *sk, struct sock *parent); ...@@ -438,6 +438,18 @@ void l2cap_sock_init(struct sock *sk, struct sock *parent);
struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
int proto, gfp_t prio); int proto, gfp_t prio);
int l2cap_sock_release(struct socket *sock);
int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen);
int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags);
int l2cap_sock_listen(struct socket *sock, int backlog);
int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int flags);
int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer);
int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len);
int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags);
int l2cap_sock_shutdown(struct socket *sock, int how);
int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen);
int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen);
void l2cap_load(void); void l2cap_load(void);
......
...@@ -859,7 +859,7 @@ static void l2cap_sock_close(struct sock *sk) ...@@ -859,7 +859,7 @@ static void l2cap_sock_close(struct sock *sk)
l2cap_sock_kill(sk); l2cap_sock_kill(sk);
} }
static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct sockaddr_l2 la; struct sockaddr_l2 la;
...@@ -983,7 +983,7 @@ static int l2cap_do_connect(struct sock *sk) ...@@ -983,7 +983,7 @@ static int l2cap_do_connect(struct sock *sk)
return err; return err;
} }
static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags) int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct sockaddr_l2 la; struct sockaddr_l2 la;
...@@ -1068,7 +1068,7 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al ...@@ -1068,7 +1068,7 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al
return err; return err;
} }
static int l2cap_sock_listen(struct socket *sock, int backlog) int l2cap_sock_listen(struct socket *sock, int backlog)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int err = 0; int err = 0;
...@@ -1127,7 +1127,7 @@ static int l2cap_sock_listen(struct socket *sock, int backlog) ...@@ -1127,7 +1127,7 @@ static int l2cap_sock_listen(struct socket *sock, int backlog)
return err; return err;
} }
static int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int flags) int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int flags)
{ {
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
struct sock *sk = sock->sk, *nsk; struct sock *sk = sock->sk, *nsk;
...@@ -1183,7 +1183,7 @@ static int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int fl ...@@ -1183,7 +1183,7 @@ static int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int fl
return err; return err;
} }
static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer) int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer)
{ {
struct sockaddr_l2 *la = (struct sockaddr_l2 *) addr; struct sockaddr_l2 *la = (struct sockaddr_l2 *) addr;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
...@@ -1665,7 +1665,7 @@ static inline int l2cap_sar_segment_sdu(struct sock *sk, struct msghdr *msg, siz ...@@ -1665,7 +1665,7 @@ static inline int l2cap_sar_segment_sdu(struct sock *sk, struct msghdr *msg, siz
return size; return size;
} }
static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct l2cap_pinfo *pi = l2cap_pi(sk); struct l2cap_pinfo *pi = l2cap_pi(sk);
...@@ -1767,7 +1767,7 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms ...@@ -1767,7 +1767,7 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms
return err; return err;
} }
static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags) int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
...@@ -1894,7 +1894,7 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us ...@@ -1894,7 +1894,7 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
return err; return err;
} }
static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct bt_security sec; struct bt_security sec;
...@@ -2067,7 +2067,7 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us ...@@ -2067,7 +2067,7 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
return err; return err;
} }
static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct bt_security sec; struct bt_security sec;
...@@ -2128,7 +2128,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch ...@@ -2128,7 +2128,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
return err; return err;
} }
static int l2cap_sock_shutdown(struct socket *sock, int how) int l2cap_sock_shutdown(struct socket *sock, int how)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int err = 0; int err = 0;
...@@ -2159,7 +2159,7 @@ static int l2cap_sock_shutdown(struct socket *sock, int how) ...@@ -2159,7 +2159,7 @@ static int l2cap_sock_shutdown(struct socket *sock, int how)
return err; return err;
} }
static int l2cap_sock_release(struct socket *sock) int l2cap_sock_release(struct socket *sock)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int err; int err;
...@@ -4715,26 +4715,6 @@ static const struct file_operations l2cap_debugfs_fops = { ...@@ -4715,26 +4715,6 @@ static const struct file_operations l2cap_debugfs_fops = {
static struct dentry *l2cap_debugfs; static struct dentry *l2cap_debugfs;
const struct proto_ops l2cap_sock_ops = {
.family = PF_BLUETOOTH,
.owner = THIS_MODULE,
.release = l2cap_sock_release,
.bind = l2cap_sock_bind,
.connect = l2cap_sock_connect,
.listen = l2cap_sock_listen,
.accept = l2cap_sock_accept,
.getname = l2cap_sock_getname,
.sendmsg = l2cap_sock_sendmsg,
.recvmsg = l2cap_sock_recvmsg,
.poll = bt_sock_poll,
.ioctl = bt_sock_ioctl,
.mmap = sock_no_mmap,
.socketpair = sock_no_socketpair,
.shutdown = l2cap_sock_shutdown,
.setsockopt = l2cap_sock_setsockopt,
.getsockopt = l2cap_sock_getsockopt
};
static struct hci_proto l2cap_hci_proto = { static struct hci_proto l2cap_hci_proto = {
.name = "L2CAP", .name = "L2CAP",
.id = HCI_PROTO_L2CAP, .id = HCI_PROTO_L2CAP,
......
...@@ -62,7 +62,6 @@ static void l2cap_sock_timeout(unsigned long arg) ...@@ -62,7 +62,6 @@ static void l2cap_sock_timeout(unsigned long arg)
sock_put(sk); sock_put(sk);
} }
static void l2cap_sock_destruct(struct sock *sk) static void l2cap_sock_destruct(struct sock *sk)
{ {
BT_DBG("sk %p", sk); BT_DBG("sk %p", sk);
...@@ -176,6 +175,26 @@ static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol, ...@@ -176,6 +175,26 @@ static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol,
return 0; return 0;
} }
const struct proto_ops l2cap_sock_ops = {
.family = PF_BLUETOOTH,
.owner = THIS_MODULE,
.release = l2cap_sock_release,
.bind = l2cap_sock_bind,
.connect = l2cap_sock_connect,
.listen = l2cap_sock_listen,
.accept = l2cap_sock_accept,
.getname = l2cap_sock_getname,
.sendmsg = l2cap_sock_sendmsg,
.recvmsg = l2cap_sock_recvmsg,
.poll = bt_sock_poll,
.ioctl = bt_sock_ioctl,
.mmap = sock_no_mmap,
.socketpair = sock_no_socketpair,
.shutdown = l2cap_sock_shutdown,
.setsockopt = l2cap_sock_setsockopt,
.getsockopt = l2cap_sock_getsockopt
};
static const struct net_proto_family l2cap_sock_family_ops = { static const struct net_proto_family l2cap_sock_family_ops = {
.family = PF_BLUETOOTH, .family = PF_BLUETOOTH,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
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