Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
6de0702b
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6de0702b
编写于
2月 04, 2011
作者:
G
Gustavo F. Padovan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bluetooth: move __l2cap_sock_close() to l2cap_sock.c
Signed-off-by:
N
Gustavo F. Padovan
<
padovan@profusion.mobi
>
上级
05fc1576
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
82 addition
and
83 deletion
+82
-83
include/net/bluetooth/l2cap.h
include/net/bluetooth/l2cap.h
+2
-0
net/bluetooth/l2cap_core.c
net/bluetooth/l2cap_core.c
+2
-83
net/bluetooth/l2cap_sock.c
net/bluetooth/l2cap_sock.c
+78
-0
未找到文件。
include/net/bluetooth/l2cap.h
浏览文件 @
6de0702b
...
@@ -451,6 +451,8 @@ void l2cap_sock_kill(struct sock *sk);
...
@@ -451,6 +451,8 @@ void l2cap_sock_kill(struct sock *sk);
void
l2cap_sock_init
(
struct
sock
*
sk
,
struct
sock
*
parent
);
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
);
void
l2cap_send_disconn_req
(
struct
l2cap_conn
*
conn
,
struct
sock
*
sk
,
int
err
);
void
l2cap_chan_del
(
struct
sock
*
sk
,
int
err
);
int
l2cap_do_connect
(
struct
sock
*
sk
);
int
l2cap_do_connect
(
struct
sock
*
sk
);
void
l2cap_load
(
void
);
void
l2cap_load
(
void
);
...
...
net/bluetooth/l2cap_core.c
浏览文件 @
6de0702b
...
@@ -70,8 +70,6 @@ struct bt_sock_list l2cap_sk_list = {
...
@@ -70,8 +70,6 @@ struct bt_sock_list l2cap_sk_list = {
static
void
l2cap_busy_work
(
struct
work_struct
*
work
);
static
void
l2cap_busy_work
(
struct
work_struct
*
work
);
static
void
l2cap_sock_close
(
struct
sock
*
sk
);
static
struct
sk_buff
*
l2cap_build_cmd
(
struct
l2cap_conn
*
conn
,
static
struct
sk_buff
*
l2cap_build_cmd
(
struct
l2cap_conn
*
conn
,
u8
code
,
u8
ident
,
u16
dlen
,
void
*
data
);
u8
code
,
u8
ident
,
u16
dlen
,
void
*
data
);
...
@@ -207,7 +205,7 @@ static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct so
...
@@ -207,7 +205,7 @@ static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct so
/* Delete channel.
/* Delete channel.
* Must be called on the locked socket. */
* Must be called on the locked socket. */
static
void
l2cap_chan_del
(
struct
sock
*
sk
,
int
err
)
void
l2cap_chan_del
(
struct
sock
*
sk
,
int
err
)
{
{
struct
l2cap_conn
*
conn
=
l2cap_pi
(
sk
)
->
conn
;
struct
l2cap_conn
*
conn
=
l2cap_pi
(
sk
)
->
conn
;
struct
sock
*
parent
=
bt_sk
(
sk
)
->
parent
;
struct
sock
*
parent
=
bt_sk
(
sk
)
->
parent
;
...
@@ -457,7 +455,7 @@ static inline int l2cap_mode_supported(__u8 mode, __u32 feat_mask)
...
@@ -457,7 +455,7 @@ static inline int l2cap_mode_supported(__u8 mode, __u32 feat_mask)
}
}
}
}
static
void
l2cap_send_disconn_req
(
struct
l2cap_conn
*
conn
,
struct
sock
*
sk
,
int
err
)
void
l2cap_send_disconn_req
(
struct
l2cap_conn
*
conn
,
struct
sock
*
sk
,
int
err
)
{
{
struct
l2cap_disconn_req
req
;
struct
l2cap_disconn_req
req
;
...
@@ -739,85 +737,6 @@ static struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src)
...
@@ -739,85 +737,6 @@ static struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src)
return
node
?
sk
:
sk1
;
return
node
?
sk
:
sk1
;
}
}
static
void
l2cap_sock_cleanup_listen
(
struct
sock
*
parent
)
{
struct
sock
*
sk
;
BT_DBG
(
"parent %p"
,
parent
);
/* Close not yet accepted channels */
while
((
sk
=
bt_accept_dequeue
(
parent
,
NULL
)))
l2cap_sock_close
(
sk
);
parent
->
sk_state
=
BT_CLOSED
;
sock_set_flag
(
parent
,
SOCK_ZAPPED
);
}
void
__l2cap_sock_close
(
struct
sock
*
sk
,
int
reason
)
{
BT_DBG
(
"sk %p state %d socket %p"
,
sk
,
sk
->
sk_state
,
sk
->
sk_socket
);
switch
(
sk
->
sk_state
)
{
case
BT_LISTEN
:
l2cap_sock_cleanup_listen
(
sk
);
break
;
case
BT_CONNECTED
:
case
BT_CONFIG
:
if
(
sk
->
sk_type
==
SOCK_SEQPACKET
||
sk
->
sk_type
==
SOCK_STREAM
)
{
struct
l2cap_conn
*
conn
=
l2cap_pi
(
sk
)
->
conn
;
l2cap_sock_set_timer
(
sk
,
sk
->
sk_sndtimeo
);
l2cap_send_disconn_req
(
conn
,
sk
,
reason
);
}
else
l2cap_chan_del
(
sk
,
reason
);
break
;
case
BT_CONNECT2
:
if
(
sk
->
sk_type
==
SOCK_SEQPACKET
||
sk
->
sk_type
==
SOCK_STREAM
)
{
struct
l2cap_conn
*
conn
=
l2cap_pi
(
sk
)
->
conn
;
struct
l2cap_conn_rsp
rsp
;
__u16
result
;
if
(
bt_sk
(
sk
)
->
defer_setup
)
result
=
L2CAP_CR_SEC_BLOCK
;
else
result
=
L2CAP_CR_BAD_PSM
;
sk
->
sk_state
=
BT_DISCONN
;
rsp
.
scid
=
cpu_to_le16
(
l2cap_pi
(
sk
)
->
dcid
);
rsp
.
dcid
=
cpu_to_le16
(
l2cap_pi
(
sk
)
->
scid
);
rsp
.
result
=
cpu_to_le16
(
result
);
rsp
.
status
=
cpu_to_le16
(
L2CAP_CS_NO_INFO
);
l2cap_send_cmd
(
conn
,
l2cap_pi
(
sk
)
->
ident
,
L2CAP_CONN_RSP
,
sizeof
(
rsp
),
&
rsp
);
}
else
l2cap_chan_del
(
sk
,
reason
);
break
;
case
BT_CONNECT
:
case
BT_DISCONN
:
l2cap_chan_del
(
sk
,
reason
);
break
;
default:
sock_set_flag
(
sk
,
SOCK_ZAPPED
);
break
;
}
}
/* Must be called on unlocked socket. */
static
void
l2cap_sock_close
(
struct
sock
*
sk
)
{
l2cap_sock_clear_timer
(
sk
);
lock_sock
(
sk
);
__l2cap_sock_close
(
sk
,
ECONNRESET
);
release_sock
(
sk
);
l2cap_sock_kill
(
sk
);
}
int
l2cap_do_connect
(
struct
sock
*
sk
)
int
l2cap_do_connect
(
struct
sock
*
sk
)
{
{
bdaddr_t
*
src
=
&
bt_sk
(
sk
)
->
src
;
bdaddr_t
*
src
=
&
bt_sk
(
sk
)
->
src
;
...
...
net/bluetooth/l2cap_sock.c
浏览文件 @
6de0702b
...
@@ -854,6 +854,84 @@ void l2cap_sock_kill(struct sock *sk)
...
@@ -854,6 +854,84 @@ void l2cap_sock_kill(struct sock *sk)
sock_put
(
sk
);
sock_put
(
sk
);
}
}
/* Must be called on unlocked socket. */
static
void
l2cap_sock_close
(
struct
sock
*
sk
)
{
l2cap_sock_clear_timer
(
sk
);
lock_sock
(
sk
);
__l2cap_sock_close
(
sk
,
ECONNRESET
);
release_sock
(
sk
);
l2cap_sock_kill
(
sk
);
}
static
void
l2cap_sock_cleanup_listen
(
struct
sock
*
parent
)
{
struct
sock
*
sk
;
BT_DBG
(
"parent %p"
,
parent
);
/* Close not yet accepted channels */
while
((
sk
=
bt_accept_dequeue
(
parent
,
NULL
)))
l2cap_sock_close
(
sk
);
parent
->
sk_state
=
BT_CLOSED
;
sock_set_flag
(
parent
,
SOCK_ZAPPED
);
}
void
__l2cap_sock_close
(
struct
sock
*
sk
,
int
reason
)
{
BT_DBG
(
"sk %p state %d socket %p"
,
sk
,
sk
->
sk_state
,
sk
->
sk_socket
);
switch
(
sk
->
sk_state
)
{
case
BT_LISTEN
:
l2cap_sock_cleanup_listen
(
sk
);
break
;
case
BT_CONNECTED
:
case
BT_CONFIG
:
if
(
sk
->
sk_type
==
SOCK_SEQPACKET
||
sk
->
sk_type
==
SOCK_STREAM
)
{
struct
l2cap_conn
*
conn
=
l2cap_pi
(
sk
)
->
conn
;
l2cap_sock_set_timer
(
sk
,
sk
->
sk_sndtimeo
);
l2cap_send_disconn_req
(
conn
,
sk
,
reason
);
}
else
l2cap_chan_del
(
sk
,
reason
);
break
;
case
BT_CONNECT2
:
if
(
sk
->
sk_type
==
SOCK_SEQPACKET
||
sk
->
sk_type
==
SOCK_STREAM
)
{
struct
l2cap_conn
*
conn
=
l2cap_pi
(
sk
)
->
conn
;
struct
l2cap_conn_rsp
rsp
;
__u16
result
;
if
(
bt_sk
(
sk
)
->
defer_setup
)
result
=
L2CAP_CR_SEC_BLOCK
;
else
result
=
L2CAP_CR_BAD_PSM
;
rsp
.
scid
=
cpu_to_le16
(
l2cap_pi
(
sk
)
->
dcid
);
rsp
.
dcid
=
cpu_to_le16
(
l2cap_pi
(
sk
)
->
scid
);
rsp
.
result
=
cpu_to_le16
(
result
);
rsp
.
status
=
cpu_to_le16
(
L2CAP_CS_NO_INFO
);
l2cap_send_cmd
(
conn
,
l2cap_pi
(
sk
)
->
ident
,
L2CAP_CONN_RSP
,
sizeof
(
rsp
),
&
rsp
);
}
else
l2cap_chan_del
(
sk
,
reason
);
break
;
case
BT_CONNECT
:
case
BT_DISCONN
:
l2cap_chan_del
(
sk
,
reason
);
break
;
default:
sock_set_flag
(
sk
,
SOCK_ZAPPED
);
break
;
}
}
static
int
l2cap_sock_shutdown
(
struct
socket
*
sock
,
int
how
)
static
int
l2cap_sock_shutdown
(
struct
socket
*
sock
,
int
how
)
{
{
struct
sock
*
sk
=
sock
->
sk
;
struct
sock
*
sk
=
sock
->
sk
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录