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

Bluetooth: Create struct l2cap_chan

struct l2cap_chan cames to create a clear separation between what
properties and data belongs to the L2CAP channel and what belongs to the
socket. By now we just fold the struct sock * in struct l2cap_chan as all
the channel info is struct l2cap_pinfo today.

In the next commits we will see a move of channel stuff to struct
l2cap_chan.
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent db940cb0
......@@ -276,9 +276,16 @@ struct l2cap_conn_param_update_rsp {
#define L2CAP_CONN_PARAM_ACCEPTED 0x0000
#define L2CAP_CONN_PARAM_REJECTED 0x0001
/* ----- L2CAP connections ----- */
/* ----- L2CAP channels and connections ----- */
struct l2cap_chan {
struct sock *sk;
struct l2cap_chan *next_c;
struct l2cap_chan *prev_c;
};
struct l2cap_chan_list {
struct sock *head;
struct l2cap_chan *head;
rwlock_t lock;
};
......@@ -317,7 +324,7 @@ struct sock_del_list {
#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04
#define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08
/* ----- L2CAP channel and socket info ----- */
/* ----- L2CAP socket info ----- */
#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
#define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue)
#define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue)
......@@ -389,8 +396,7 @@ struct l2cap_pinfo {
struct work_struct busy_work;
struct srej_list srej_l;
struct l2cap_conn *conn;
struct sock *next_c;
struct sock *prev_c;
struct l2cap_chan *chan;
};
#define L2CAP_CONF_REQ_SENT 0x01
......@@ -471,7 +477,7 @@ void l2cap_sock_init(struct sock *sk, struct sock *parent);
struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
int proto, gfp_t prio);
void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk, int err);
void l2cap_chan_del(struct sock *sk, int err);
void l2cap_chan_del(struct l2cap_chan *chan, int err);
int l2cap_do_connect(struct sock *sk);
#endif /* __L2CAP_H */
This diff is collapsed.
......@@ -902,7 +902,7 @@ void __l2cap_sock_close(struct sock *sk, int reason)
l2cap_sock_set_timer(sk, sk->sk_sndtimeo);
l2cap_send_disconn_req(conn, sk, reason);
} else
l2cap_chan_del(sk, reason);
l2cap_chan_del(l2cap_pi(sk)->chan, reason);
break;
case BT_CONNECT2:
......@@ -925,12 +925,12 @@ void __l2cap_sock_close(struct sock *sk, int reason)
L2CAP_CONN_RSP, sizeof(rsp), &rsp);
}
l2cap_chan_del(sk, reason);
l2cap_chan_del(l2cap_pi(sk)->chan, reason);
break;
case BT_CONNECT:
case BT_DISCONN:
l2cap_chan_del(sk, reason);
l2cap_chan_del(l2cap_pi(sk)->chan, reason);
break;
default:
......
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