Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103671
b: refs/heads/master
c: 3241ad8
h: refs/heads/master
i:
  103669: dcee462
  103667: d81fc89
  103663: ab0bb8a
v: v3
  • Loading branch information
Marcel Holtmann committed Jul 14, 2008
1 parent 7be0312 commit d5f3bbb
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 40be492fe4fab829951681860c2bb26fa1d5fe4a
refs/heads/master: 3241ad820dbb172021e0268b5611031991431626
1 change: 1 addition & 0 deletions trunk/include/net/bluetooth/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ void bt_sock_link(struct bt_sock_list *l, struct sock *s);
void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags);
uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait);
int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);

void bt_accept_enqueue(struct sock *parent, struct sock *sk);
Expand Down
28 changes: 28 additions & 0 deletions trunk/net/bluetooth/af_bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <linux/init.h>
#include <linux/poll.h>
#include <net/sock.h>
#include <asm/ioctls.h>

#if defined(CONFIG_KMOD)
#include <linux/kmod.h>
Expand Down Expand Up @@ -266,6 +267,8 @@ int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,

skb_reset_transport_header(skb);
err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
if (err == 0)
sock_recv_timestamp(msg, sk, skb);

skb_free_datagram(sk, skb);

Expand Down Expand Up @@ -329,6 +332,31 @@ unsigned int bt_sock_poll(struct file * file, struct socket *sock, poll_table *w
}
EXPORT_SYMBOL(bt_sock_poll);

int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
struct sock *sk = sock->sk;
int err;

BT_DBG("sk %p cmd %x arg %lx", sk, cmd, arg);

switch (cmd) {
case SIOCGSTAMP:
err = sock_get_timestamp(sk, (struct timeval __user *) arg);
break;

case SIOCGSTAMPNS:
err = sock_get_timestampns(sk, (struct timespec __user *) arg);
break;

default:
err = -ENOIOCTLCMD;
break;
}

return err;
}
EXPORT_SYMBOL(bt_sock_ioctl);

int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo)
{
DECLARE_WAITQUEUE(wait, current);
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/bluetooth/l2cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2388,9 +2388,9 @@ static const struct proto_ops l2cap_sock_ops = {
.sendmsg = l2cap_sock_sendmsg,
.recvmsg = bt_sock_recvmsg,
.poll = bt_sock_poll,
.ioctl = bt_sock_ioctl,
.mmap = sock_no_mmap,
.socketpair = sock_no_socketpair,
.ioctl = sock_no_ioctl,
.shutdown = l2cap_sock_shutdown,
.setsockopt = l2cap_sock_setsockopt,
.getsockopt = l2cap_sock_getsockopt
Expand Down
15 changes: 11 additions & 4 deletions trunk/net/bluetooth/rfcomm/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,8 @@ static int rfcomm_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
copied += chunk;
size -= chunk;

sock_recv_timestamp(msg, sk, skb);

if (!(flags & MSG_PEEK)) {
atomic_sub(chunk, &sk->sk_rmem_alloc);

Expand Down Expand Up @@ -795,15 +797,20 @@ static int rfcomm_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned lon
struct sock *sk = sock->sk;
int err;

lock_sock(sk);
BT_DBG("sk %p cmd %x arg %lx", sk, cmd, arg);

err = bt_sock_ioctl(sock, cmd, arg);

if (err == -ENOIOCTLCMD) {
#ifdef CONFIG_BT_RFCOMM_TTY
err = rfcomm_dev_ioctl(sk, cmd, (void __user *)arg);
lock_sock(sk);
err = rfcomm_dev_ioctl(sk, cmd, (void __user *) arg);
release_sock(sk);
#else
err = -EOPNOTSUPP;
err = -EOPNOTSUPP;
#endif
}

release_sock(sk);
return err;
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/net/bluetooth/sco.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ static const struct proto_ops sco_sock_ops = {
.sendmsg = sco_sock_sendmsg,
.recvmsg = bt_sock_recvmsg,
.poll = bt_sock_poll,
.ioctl = sock_no_ioctl,
.ioctl = bt_sock_ioctl,
.mmap = sock_no_mmap,
.socketpair = sock_no_socketpair,
.shutdown = sock_no_shutdown,
Expand Down

0 comments on commit d5f3bbb

Please sign in to comment.