Commit b5578b5e authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] bluetooth annotations

Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent eb0296b9
......@@ -139,7 +139,7 @@ struct bnep_conninfo {
struct bnep_connlist_req {
__u32 cnum;
struct bnep_conninfo *ci;
struct bnep_conninfo __user *ci;
};
struct bnep_proto_filter {
......
......@@ -99,11 +99,9 @@ static void __bnep_unlink_session(struct bnep_session *s)
static int bnep_send(struct bnep_session *s, void *data, size_t len)
{
struct socket *sock = s->sock;
struct iovec iv = { data, len };
struct kvec iv = { data, len };
s->msg.msg_iov = &iv;
s->msg.msg_iovlen = 1;
return sock_sendmsg(sock, &s->msg, len);
return kernel_sendmsg(sock, &s->msg, &iv, 1, len);
}
static int bnep_send_rsp(struct bnep_session *s, u8 ctrl, u16 resp)
......@@ -389,7 +387,7 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
{
struct ethhdr *eh = (void *) skb->data;
struct socket *sock = s->sock;
struct iovec iv[3];
struct kvec iv[3];
int len = 0, il = 0;
u8 type = 0;
......@@ -400,7 +398,7 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
goto send;
}
iv[il++] = (struct iovec) { &type, 1 };
iv[il++] = (struct kvec) { &type, 1 };
len++;
if (!memcmp(eh->h_dest, s->eh.h_source, ETH_ALEN))
......@@ -415,25 +413,23 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
type = __bnep_tx_types[type];
switch (type) {
case BNEP_COMPRESSED_SRC_ONLY:
iv[il++] = (struct iovec) { eh->h_source, ETH_ALEN };
iv[il++] = (struct kvec) { eh->h_source, ETH_ALEN };
len += ETH_ALEN;
break;
case BNEP_COMPRESSED_DST_ONLY:
iv[il++] = (struct iovec) { eh->h_dest, ETH_ALEN };
iv[il++] = (struct kvec) { eh->h_dest, ETH_ALEN };
len += ETH_ALEN;
break;
}
send:
iv[il++] = (struct iovec) { skb->data, skb->len };
iv[il++] = (struct kvec) { skb->data, skb->len };
len += skb->len;
/* FIXME: linearize skb */
{
s->msg.msg_iov = iv;
s->msg.msg_iovlen = il;
len = sock_sendmsg(sock, &s->msg, len);
len = kernel_sendmsg(sock, &s->msg, iv, il, len);
}
kfree_skb(skb);
......@@ -460,8 +456,6 @@ static int bnep_session(void *arg)
set_user_nice(current, -15);
current->flags |= PF_NOFREEZE;
set_fs(KERNEL_DS);
init_waitqueue_entry(&wait, current);
add_wait_queue(sk->sk_sleep, &wait);
while (!atomic_read(&s->killed)) {
......
......@@ -201,7 +201,7 @@ static inline int cmtp_recv_frame(struct cmtp_session *session, struct sk_buff *
static int cmtp_send_frame(struct cmtp_session *session, unsigned char *data, int len)
{
struct socket *sock = session->sock;
struct iovec iv = { data, len };
struct kvec iv = { data, len };
struct msghdr msg;
BT_DBG("session %p data %p len %d", session, data, len);
......@@ -210,10 +210,8 @@ static int cmtp_send_frame(struct cmtp_session *session, unsigned char *data, in
return 0;
memset(&msg, 0, sizeof(msg));
msg.msg_iovlen = 1;
msg.msg_iov = &iv;
return sock_sendmsg(sock, &msg, len);
return kernel_sendmsg(sock, &msg, &iv, 1, len);
}
static int cmtp_process_transmit(struct cmtp_session *session)
......@@ -295,8 +293,6 @@ static int cmtp_session(void *arg)
set_user_nice(current, -15);
current->flags |= PF_NOFREEZE;
set_fs(KERNEL_DS);
init_waitqueue_entry(&wait, current);
add_wait_queue(sk->sk_sleep, &wait);
while (!atomic_read(&session->terminate)) {
......
......@@ -274,7 +274,7 @@ static inline int hidp_recv_frame(struct hidp_session *session, struct sk_buff *
static int hidp_send_frame(struct socket *sock, unsigned char *data, int len)
{
struct iovec iv = { data, len };
struct kvec iv = { data, len };
struct msghdr msg;
BT_DBG("sock %p data %p len %d", sock, data, len);
......@@ -283,10 +283,8 @@ static int hidp_send_frame(struct socket *sock, unsigned char *data, int len)
return 0;
memset(&msg, 0, sizeof(msg));
msg.msg_iovlen = 1;
msg.msg_iov = &iv;
return sock_sendmsg(sock, &msg, len);
return kernel_sendmsg(sock, &msg, &iv, 1, len);
}
static int hidp_process_transmit(struct hidp_session *session)
......@@ -340,8 +338,6 @@ static int hidp_session(void *arg)
set_user_nice(current, -15);
current->flags |= PF_NOFREEZE;
set_fs(KERNEL_DS);
init_waitqueue_entry(&ctrl_wait, current);
init_waitqueue_entry(&intr_wait, current);
add_wait_queue(ctrl_sk->sk_sleep, &ctrl_wait);
......
......@@ -323,14 +323,11 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel)
{
mm_segment_t fs;
int r;
rfcomm_lock();
fs = get_fs(); set_fs(KERNEL_DS);
r = __rfcomm_dlc_open(d, src, dst, channel);
set_fs(fs);
rfcomm_unlock();
return r;
......@@ -376,14 +373,11 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
int rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
{
mm_segment_t fs;
int r;
rfcomm_lock();
fs = get_fs(); set_fs(KERNEL_DS);
r = __rfcomm_dlc_close(d, err);
set_fs(fs);
rfcomm_unlock();
return r;
......@@ -552,9 +546,8 @@ struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *
{
struct rfcomm_session *s = NULL;
struct sockaddr_l2 addr;
struct l2cap_options opts;
struct socket *sock;
int size;
struct sock *sk;
BT_DBG("%s %s", batostr(src), batostr(dst));
......@@ -570,11 +563,10 @@ struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *
goto failed;
/* Set L2CAP options */
size = sizeof(opts);
sock->ops->getsockopt(sock, SOL_L2CAP, L2CAP_OPTIONS, (void *)&opts, &size);
opts.imtu = RFCOMM_MAX_L2CAP_MTU;
sock->ops->setsockopt(sock, SOL_L2CAP, L2CAP_OPTIONS, (void *)&opts, size);
sk = sock->sk;
lock_sock(sk);
l2cap_pi(sk)->imtu = RFCOMM_MAX_L2CAP_MTU;
release_sock(sk);
s = rfcomm_session_add(sock, BT_BOUND);
if (!s) {
......@@ -612,16 +604,14 @@ void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *d
static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len)
{
struct socket *sock = s->sock;
struct iovec iv = { data, len };
struct kvec iv = { data, len };
struct msghdr msg;
BT_DBG("session %p len %d", s, len);
memset(&msg, 0, sizeof(msg));
msg.msg_iovlen = 1;
msg.msg_iov = &iv;
return sock_sendmsg(sock, &msg, len);
return kernel_sendmsg(sock, &msg, &iv, 1, len);
}
static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci)
......@@ -905,7 +895,7 @@ static int rfcomm_send_fcon(struct rfcomm_session *s, int cr)
static int rfcomm_send_test(struct rfcomm_session *s, int cr, u8 *pattern, int len)
{
struct socket *sock = s->sock;
struct iovec iv[3];
struct kvec iv[3];
struct msghdr msg;
unsigned char hdr[5], crc[1];
......@@ -930,10 +920,8 @@ static int rfcomm_send_test(struct rfcomm_session *s, int cr, u8 *pattern, int l
iv[2].iov_len = 1;
memset(&msg, 0, sizeof(msg));
msg.msg_iovlen = 3;
msg.msg_iov = iv;
return sock_sendmsg(sock, &msg, 6 + len);
return kernel_sendmsg(sock, &msg, iv, 3, 6 + len);
}
static int rfcomm_send_credits(struct rfcomm_session *s, u8 addr, u8 credits)
......@@ -1749,10 +1737,10 @@ static void rfcomm_worker(void)
static int rfcomm_add_listener(bdaddr_t *ba)
{
struct sockaddr_l2 addr;
struct l2cap_options opts;
struct socket *sock;
struct sock *sk;
struct rfcomm_session *s;
int size, err = 0;
int err = 0;
/* Create socket */
err = rfcomm_l2sock_create(&sock);
......@@ -1772,11 +1760,10 @@ static int rfcomm_add_listener(bdaddr_t *ba)
}
/* Set L2CAP options */
size = sizeof(opts);
sock->ops->getsockopt(sock, SOL_L2CAP, L2CAP_OPTIONS, (void *)&opts, &size);
opts.imtu = RFCOMM_MAX_L2CAP_MTU;
sock->ops->setsockopt(sock, SOL_L2CAP, L2CAP_OPTIONS, (void *)&opts, size);
sk = sock->sk;
lock_sock(sk);
l2cap_pi(sk)->imtu = RFCOMM_MAX_L2CAP_MTU;
release_sock(sk);
/* Start listening on the socket */
err = sock->ops->listen(sock, 10);
......@@ -1820,8 +1807,6 @@ static int rfcomm_run(void *unused)
set_user_nice(current, -10);
current->flags |= PF_NOFREEZE;
set_fs(KERNEL_DS);
BT_DBG("");
rfcomm_add_listener(BDADDR_ANY);
......
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