Skip to content

Commit

Permalink
Bluetooth: Create struct l2cap_chan
Browse files Browse the repository at this point in the history
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: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Gustavo F. Padovan committed Apr 7, 2011
1 parent db940cb commit 4845407
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 96 deletions.
18 changes: 12 additions & 6 deletions include/net/bluetooth/l2cap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Loading

0 comments on commit 4845407

Please sign in to comment.