diff options
author | Mat Martineau <mathewm@codeaurora.org> | 2010-09-08 13:05:27 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2010-10-12 11:44:51 -0400 |
commit | 796c86eec84ddfd02281c5071838ed1fefda6b90 (patch) | |
tree | 5b6c705846e46c39b4ddc233e5a1604d9fb9476d /include | |
parent | 0fba2558cbb3fae3a09147b7d6e18a6204204e0e (diff) |
Bluetooth: Add common code for stream-oriented recvmsg()
This commit adds a bt_sock_stream_recvmsg() function for use by any
Bluetooth code that uses SOCK_STREAM sockets. This code is copied
from rfcomm_sock_recvmsg() with minimal modifications to remove
RFCOMM-specific functionality and improve readability.
L2CAP (with the SOCK_STREAM socket type) and RFCOMM have common needs
when it comes to reading data. Proper stream read semantics require
that applications can read from a stream one byte at a time and not
lose any data. The RFCOMM code already operated on and pulled data
from the underlying L2CAP socket, so very few changes were required to
make the code more generic for use with non-RFCOMM data over L2CAP.
Applications that need more awareness of L2CAP frame boundaries are
still free to use SOCK_SEQPACKET sockets, and may verify that they
connection did not fall back to basic mode by calling getsockopt().
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 30fce0128dd7..d81ea7997701 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -126,6 +126,8 @@ int bt_sock_unregister(int proto); | |||
126 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); | 126 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); |
127 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); | 127 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); |
128 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags); | 128 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags); |
129 | int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | ||
130 | struct msghdr *msg, size_t len, int flags); | ||
129 | uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); | 131 | uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); |
130 | int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | 132 | int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
131 | int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); | 133 | int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); |