Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
c47b7c72
Commit
c47b7c72
authored
Feb 04, 2011
by
Gustavo F. Padovan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bluetooth: move l2cap_sock_accept() to l2cap_sock.c
Signed-off-by:
Gustavo F. Padovan
<
padovan@profusion.mobi
>
parent
af6bcd82
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
57 deletions
+56
-57
include/net/bluetooth/l2cap.h
include/net/bluetooth/l2cap.h
+0
-1
net/bluetooth/l2cap_core.c
net/bluetooth/l2cap_core.c
+0
-56
net/bluetooth/l2cap_sock.c
net/bluetooth/l2cap_sock.c
+56
-0
No files found.
include/net/bluetooth/l2cap.h
View file @
c47b7c72
...
...
@@ -439,7 +439,6 @@ struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
int
proto
,
gfp_t
prio
);
int
l2cap_sock_connect
(
struct
socket
*
sock
,
struct
sockaddr
*
addr
,
int
alen
,
int
flags
);
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
);
...
...
net/bluetooth/l2cap_core.c
View file @
c47b7c72
...
...
@@ -993,62 +993,6 @@ int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int
return
err
;
}
int
l2cap_sock_accept
(
struct
socket
*
sock
,
struct
socket
*
newsock
,
int
flags
)
{
DECLARE_WAITQUEUE
(
wait
,
current
);
struct
sock
*
sk
=
sock
->
sk
,
*
nsk
;
long
timeo
;
int
err
=
0
;
lock_sock_nested
(
sk
,
SINGLE_DEPTH_NESTING
);
if
(
sk
->
sk_state
!=
BT_LISTEN
)
{
err
=
-
EBADFD
;
goto
done
;
}
timeo
=
sock_rcvtimeo
(
sk
,
flags
&
O_NONBLOCK
);
BT_DBG
(
"sk %p timeo %ld"
,
sk
,
timeo
);
/* Wait for an incoming connection. (wake-one). */
add_wait_queue_exclusive
(
sk_sleep
(
sk
),
&
wait
);
while
(
!
(
nsk
=
bt_accept_dequeue
(
sk
,
newsock
)))
{
set_current_state
(
TASK_INTERRUPTIBLE
);
if
(
!
timeo
)
{
err
=
-
EAGAIN
;
break
;
}
release_sock
(
sk
);
timeo
=
schedule_timeout
(
timeo
);
lock_sock_nested
(
sk
,
SINGLE_DEPTH_NESTING
);
if
(
sk
->
sk_state
!=
BT_LISTEN
)
{
err
=
-
EBADFD
;
break
;
}
if
(
signal_pending
(
current
))
{
err
=
sock_intr_errno
(
timeo
);
break
;
}
}
set_current_state
(
TASK_RUNNING
);
remove_wait_queue
(
sk_sleep
(
sk
),
&
wait
);
if
(
err
)
goto
done
;
newsock
->
state
=
SS_CONNECTED
;
BT_DBG
(
"new socket %p"
,
nsk
);
done:
release_sock
(
sk
);
return
err
;
}
int
l2cap_sock_getname
(
struct
socket
*
sock
,
struct
sockaddr
*
addr
,
int
*
len
,
int
peer
)
{
struct
sockaddr_l2
*
la
=
(
struct
sockaddr_l2
*
)
addr
;
...
...
net/bluetooth/l2cap_sock.c
View file @
c47b7c72
...
...
@@ -197,6 +197,62 @@ static int l2cap_sock_listen(struct socket *sock, int backlog)
return
err
;
}
static
int
l2cap_sock_accept
(
struct
socket
*
sock
,
struct
socket
*
newsock
,
int
flags
)
{
DECLARE_WAITQUEUE
(
wait
,
current
);
struct
sock
*
sk
=
sock
->
sk
,
*
nsk
;
long
timeo
;
int
err
=
0
;
lock_sock_nested
(
sk
,
SINGLE_DEPTH_NESTING
);
if
(
sk
->
sk_state
!=
BT_LISTEN
)
{
err
=
-
EBADFD
;
goto
done
;
}
timeo
=
sock_rcvtimeo
(
sk
,
flags
&
O_NONBLOCK
);
BT_DBG
(
"sk %p timeo %ld"
,
sk
,
timeo
);
/* Wait for an incoming connection. (wake-one). */
add_wait_queue_exclusive
(
sk_sleep
(
sk
),
&
wait
);
while
(
!
(
nsk
=
bt_accept_dequeue
(
sk
,
newsock
)))
{
set_current_state
(
TASK_INTERRUPTIBLE
);
if
(
!
timeo
)
{
err
=
-
EAGAIN
;
break
;
}
release_sock
(
sk
);
timeo
=
schedule_timeout
(
timeo
);
lock_sock_nested
(
sk
,
SINGLE_DEPTH_NESTING
);
if
(
sk
->
sk_state
!=
BT_LISTEN
)
{
err
=
-
EBADFD
;
break
;
}
if
(
signal_pending
(
current
))
{
err
=
sock_intr_errno
(
timeo
);
break
;
}
}
set_current_state
(
TASK_RUNNING
);
remove_wait_queue
(
sk_sleep
(
sk
),
&
wait
);
if
(
err
)
goto
done
;
newsock
->
state
=
SS_CONNECTED
;
BT_DBG
(
"new socket %p"
,
nsk
);
done:
release_sock
(
sk
);
return
err
;
}
static
int
l2cap_sock_release
(
struct
socket
*
sock
)
{
struct
sock
*
sk
=
sock
->
sk
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment