Hi Gustavo -
On Thu, 2 Jun 2011, Gustavo F. Padovan wrote:
close() calls l2cap_sock_kill() on l2cap_sock.c
Signed-off-by: Gustavo F. Padovan <padovan@xxxxxxxxxxxxxx>
---
include/net/bluetooth/l2cap.h | 3 +--
net/bluetooth/l2cap_core.c | 17 +++++++++--------
net/bluetooth/l2cap_sock.c | 10 +++++++++-
3 files changed, 19 insertions(+), 11 deletions(-)
<snip>
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -679,7 +679,7 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct ms
/* Kill socket (only if zapped and orphan)
* Must be called on unlocked socket.
*/
-void l2cap_sock_kill(struct sock *sk)
+static void l2cap_sock_kill(struct sock *sk)
{
if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
return;
@@ -762,10 +762,18 @@ static int l2cap_chan_recv_cb(void *data, struct sk_buff *skb)
return sock_queue_rcv_skb(sk, skb);
}
+static void l2cap_chan_close_cb(void *data)
+{
+ struct sock *sk = data;
+
+ l2cap_sock_kill(sk);
+}
+
static struct l2cap_ops l2cap_chan_ops = {
.name = "L2CAP Socket Interface",
.new_connection = l2cap_chan_new_connection_cb,
.recv = l2cap_chan_recv_cb,
+ .close = l2cap_chan_close_cb,
};
static void l2cap_sock_destruct(struct sock *sk)
It looks like we'll have l2cap_ops for sock, rfcomm, and AMP's A2MP
channel -- so I would suggest using unique names for the callbacks for
each of those modules:
l2cap_sock_new_connection_cb
l2cap_sock_recv_cb
l2cap_sock_close_cb
l2cap_a2mp_new_connection_cb
l2cap_a2mp_recv_cb
l2cap_a2mp_close_cb
etc., instead of "l2cap_chan_*_cb"
Even though the functions are (or will be) static within their
respective files, it will be less confusing if their names tie them
to the specific module.
I hope you can check these in to bluetooth-next soon, it would help
with the patch set I'm working on.
Regards,
--
Mat Martineau
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html