Commit 3a4cabeb authored by Marcel Holtmann's avatar Marcel Holtmann

Merge hostme.bitkeeper.com:/ua/repos/l/linux-bt/bt-2.5

into hostme.bitkeeper.com:/ua/repos/l/linux-bt/marcel-2.5
parents 735fe7c5 84c64df6
......@@ -97,6 +97,7 @@
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci.h>
#include <net/bluetooth/rfcomm.h>
#include <linux/usb.h>
#include <linux/usbdevice_fs.h>
......@@ -3797,6 +3798,14 @@ static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg)
return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg);
}
#define HCIUARTSETPROTO _IOW('U', 200, int)
#define HCIUARTGETPROTO _IOR('U', 201, int)
#define BNEPCONNADD _IOW('B', 200, int)
#define BNEPCONNDEL _IOW('B', 201, int)
#define BNEPGETCONNLIST _IOR('B', 210, int)
#define BNEPGETCONNINFO _IOR('B', 211, int)
struct usbdevfs_ctrltransfer32 {
__u8 bRequestType;
__u8 bRequest;
......@@ -4973,6 +4982,17 @@ COMPATIBLE_IOCTL(HCISETLINKMODE)
COMPATIBLE_IOCTL(HCISETACLMTU)
COMPATIBLE_IOCTL(HCISETSCOMTU)
COMPATIBLE_IOCTL(HCIINQUIRY)
COMPATIBLE_IOCTL(HCIUARTSETPROTO)
COMPATIBLE_IOCTL(HCIUARTGETPROTO)
COMPATIBLE_IOCTL(RFCOMMCREATEDEV)
COMPATIBLE_IOCTL(RFCOMMRELEASEDEV)
COMPATIBLE_IOCTL(RFCOMMGETDEVLIST)
COMPATIBLE_IOCTL(RFCOMMGETDEVINFO)
COMPATIBLE_IOCTL(RFCOMMSTEALDLC)
COMPATIBLE_IOCTL(BNEPCONNADD)
COMPATIBLE_IOCTL(BNEPCONNDEL)
COMPATIBLE_IOCTL(BNEPGETCONNLIST)
COMPATIBLE_IOCTL(BNEPGETCONNINFO)
/* Misc. */
COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */
COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */
......
......@@ -903,5 +903,3 @@ void __exit exit_btuart_cs(void)
module_init(init_btuart_cs);
module_exit(exit_btuart_cs);
EXPORT_NO_SYMBOLS;
......@@ -111,25 +111,31 @@ struct bnep_ext_hdr {
__u8 data[0];
} __attribute__((packed));
/* BNEP ioctl defines */
#define BNEPCONNADD _IOW('B', 200, int)
#define BNEPCONNDEL _IOW('B', 201, int)
#define BNEPGETCONNLIST _IOR('B', 210, int)
#define BNEPGETCONNINFO _IOR('B', 211, int)
// Ioctl interface
#define BNEPCONADD 1
#define BNEPCONDEL 2
#define BNEPGETCONLIST 3
#define BNEPGETCONINFO 4
struct bnep_conadd_req {
struct bnep_connadd_req {
int sock; // Connected socket
__u32 flags;
__u16 role;
char device[16]; // Name of the Ethernet device
};
struct bnep_condel_req {
struct bnep_conndel_req {
__u32 flags;
__u8 dst[ETH_ALEN];
};
struct bnep_coninfo {
struct bnep_conninfo {
__u32 flags;
__u16 role;
__u16 state;
......@@ -137,9 +143,9 @@ struct bnep_coninfo {
char device[16];
};
struct bnep_conlist_req {
struct bnep_connlist_req {
__u32 cnum;
struct bnep_coninfo *ci;
struct bnep_conninfo *ci;
};
struct bnep_proto_filter {
......@@ -147,10 +153,10 @@ struct bnep_proto_filter {
__u16 end;
};
int bnep_add_connection(struct bnep_conadd_req *req, struct socket *sock);
int bnep_del_connection(struct bnep_condel_req *req);
int bnep_get_conlist(struct bnep_conlist_req *req);
int bnep_get_coninfo(struct bnep_coninfo *ci);
int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock);
int bnep_del_connection(struct bnep_conndel_req *req);
int bnep_get_connlist(struct bnep_connlist_req *req);
int bnep_get_conninfo(struct bnep_conninfo *ci);
// BNEP sessions
struct bnep_session {
......
......@@ -531,7 +531,7 @@ static int bnep_session(void *arg)
return 0;
}
int bnep_add_connection(struct bnep_conadd_req *req, struct socket *sock)
int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
{
struct net_device *dev;
struct bnep_session *s, *ss;
......@@ -622,7 +622,7 @@ int bnep_add_connection(struct bnep_conadd_req *req, struct socket *sock)
return err;
}
int bnep_del_connection(struct bnep_condel_req *req)
int bnep_del_connection(struct bnep_conndel_req *req)
{
struct bnep_session *s;
int err = 0;
......@@ -647,7 +647,7 @@ int bnep_del_connection(struct bnep_condel_req *req)
return err;
}
static void __bnep_copy_ci(struct bnep_coninfo *ci, struct bnep_session *s)
static void __bnep_copy_ci(struct bnep_conninfo *ci, struct bnep_session *s)
{
memcpy(ci->dst, s->eh.h_source, ETH_ALEN);
strcpy(ci->device, s->dev.name);
......@@ -656,7 +656,7 @@ static void __bnep_copy_ci(struct bnep_coninfo *ci, struct bnep_session *s)
ci->role = s->role;
}
int bnep_get_conlist(struct bnep_conlist_req *req)
int bnep_get_connlist(struct bnep_connlist_req *req)
{
struct list_head *p;
int err = 0, n = 0;
......@@ -665,7 +665,7 @@ int bnep_get_conlist(struct bnep_conlist_req *req)
list_for_each(p, &bnep_session_list) {
struct bnep_session *s;
struct bnep_coninfo ci;
struct bnep_conninfo ci;
s = list_entry(p, struct bnep_session, list);
......@@ -687,7 +687,7 @@ int bnep_get_conlist(struct bnep_conlist_req *req)
return err;
}
int bnep_get_coninfo(struct bnep_coninfo *ci)
int bnep_get_conninfo(struct bnep_conninfo *ci)
{
struct bnep_session *s;
int err = 0;
......
......@@ -73,10 +73,10 @@ static int bnep_sock_release(struct socket *sock)
static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
struct bnep_conlist_req cl;
struct bnep_conadd_req ca;
struct bnep_condel_req cd;
struct bnep_coninfo ci;
struct bnep_connlist_req cl;
struct bnep_connadd_req ca;
struct bnep_conndel_req cd;
struct bnep_conninfo ci;
struct socket *nsock;
int err;
......@@ -84,6 +84,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
switch (cmd) {
case BNEPCONADD:
case BNEPCONNADD:
if (!capable(CAP_NET_ADMIN))
return -EACCES;
......@@ -107,6 +108,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
return err;
case BNEPCONDEL:
case BNEPCONNDEL:
if (!capable(CAP_NET_ADMIN))
return -EACCES;
......@@ -116,23 +118,25 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
return bnep_del_connection(&cd);
case BNEPGETCONLIST:
case BNEPGETCONNLIST:
if (copy_from_user(&cl, (void *) arg, sizeof(cl)))
return -EFAULT;
if (cl.cnum <= 0)
return -EINVAL;
err = bnep_get_conlist(&cl);
err = bnep_get_connlist(&cl);
if (!err && copy_to_user((void *) arg, &cl, sizeof(cl)))
return -EFAULT;
return err;
case BNEPGETCONINFO:
case BNEPGETCONNINFO:
if (copy_from_user(&ci, (void *) arg, sizeof(ci)))
return -EFAULT;
err = bnep_get_coninfo(&ci);
err = bnep_get_conninfo(&ci);
if (!err && copy_to_user((void *) arg, &ci, sizeof(ci)))
return -EFAULT;
......
......@@ -263,7 +263,7 @@ static void rfcomm_dlc_unlink(struct rfcomm_dlc *d)
rfcomm_session_put(s);
}
static struct rfcomm_dlc *rfcomm_dlc_get(struct rfcomm_session *s, int dlci)
static struct rfcomm_dlc *rfcomm_dlc_get(struct rfcomm_session *s, u8 dlci)
{
struct rfcomm_dlc *d;
struct list_head *p;
......@@ -279,7 +279,8 @@ static struct rfcomm_dlc *rfcomm_dlc_get(struct rfcomm_session *s, int dlci)
static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel)
{
struct rfcomm_session *s;
int err = 0, dlci = __dlci(0, channel);
u8 dlci = __dlci(0, channel);
int err = 0;
BT_DBG("dlc %p state %ld %s %s channel %d dlci %d",
d, d->state, batostr(src), batostr(dst), channel, dlci);
......@@ -923,7 +924,7 @@ static void rfcomm_make_uih(struct sk_buff *skb, u8 addr)
}
/* ---- RFCOMM frame reception ---- */
static int rfcomm_recv_ua(struct rfcomm_session *s, int dlci)
static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci)
{
BT_DBG("session %p state %ld dlci %d", s, s->state, dlci);
......@@ -964,7 +965,7 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, int dlci)
return 0;
}
static int rfcomm_recv_dm(struct rfcomm_session *s, int dlci)
static int rfcomm_recv_dm(struct rfcomm_session *s, u8 dlci)
{
int err = 0;
......@@ -994,7 +995,7 @@ static int rfcomm_recv_dm(struct rfcomm_session *s, int dlci)
return 0;
}
static int rfcomm_recv_disc(struct rfcomm_session *s, int dlci)
static int rfcomm_recv_disc(struct rfcomm_session *s, u8 dlci)
{
int err = 0;
......@@ -1030,10 +1031,10 @@ static int rfcomm_recv_disc(struct rfcomm_session *s, int dlci)
return 0;
}
static int rfcomm_recv_sabm(struct rfcomm_session *s, int dlci)
static int rfcomm_recv_sabm(struct rfcomm_session *s, u8 dlci)
{
struct rfcomm_dlc *d;
int channel;
u8 channel;
BT_DBG("session %p state %ld dlci %d", s, s->state, dlci);
......@@ -1116,7 +1117,7 @@ static int rfcomm_recv_pn(struct rfcomm_session *s, int cr, struct sk_buff *skb)
{
struct rfcomm_pn *pn = (void *) skb->data;
struct rfcomm_dlc *d;
int dlci = pn->dlci;
u8 dlci = pn->dlci;
BT_DBG("session %p state %ld dlci %d", s, s->state, dlci);
......@@ -1141,7 +1142,7 @@ static int rfcomm_recv_pn(struct rfcomm_session *s, int cr, struct sk_buff *skb)
}
}
} else {
int channel = __srv_channel(dlci);
u8 channel = __srv_channel(dlci);
if (!cr)
return 0;
......@@ -1167,7 +1168,7 @@ static int rfcomm_recv_pn(struct rfcomm_session *s, int cr, struct sk_buff *skb)
static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_buff *skb)
{
struct rfcomm_rpn *rpn = (void *) skb->data;
int dlci = __get_dlci(rpn->dlci);
u8 dlci = __get_dlci(rpn->dlci);
u8 bit_rate = 0;
u8 data_bits = 0;
......@@ -1257,7 +1258,7 @@ static int rfcomm_recv_msc(struct rfcomm_session *s, int cr, struct sk_buff *skb
{
struct rfcomm_msc *msc = (void *) skb->data;
struct rfcomm_dlc *d;
int dlci = __get_dlci(msc->dlci);
u8 dlci = __get_dlci(msc->dlci);
BT_DBG("dlci %d cr %d v24 0x%x", dlci, cr, msc->v24_sig);
......@@ -1323,7 +1324,7 @@ static int rfcomm_recv_mcc(struct rfcomm_session *s, struct sk_buff *skb)
return 0;
}
static int rfcomm_recv_data(struct rfcomm_session *s, int dlci, int pf, struct sk_buff *skb)
static int rfcomm_recv_data(struct rfcomm_session *s, u8 dlci, int pf, struct sk_buff *skb)
{
struct rfcomm_dlc *d;
......
......@@ -112,7 +112,7 @@ static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err)
}
/* ---- Socket functions ---- */
static struct sock *__rfcomm_get_sock_by_addr(int channel, bdaddr_t *src)
static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src)
{
struct sock *sk;
......@@ -128,7 +128,7 @@ static struct sock *__rfcomm_get_sock_by_addr(int channel, bdaddr_t *src)
/* Find socket with channel and source bdaddr.
* Returns closest match.
*/
static struct sock *__rfcomm_get_sock_by_channel(int state, __u16 channel, bdaddr_t *src)
static struct sock *__rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src)
{
struct sock *sk, *sk1 = NULL;
......@@ -151,7 +151,7 @@ static struct sock *__rfcomm_get_sock_by_channel(int state, __u16 channel, bdadd
/* Find socket with given address (channel, src).
* Returns locked socket */
static inline struct sock *rfcomm_get_sock_by_channel(int state, __u16 channel, bdaddr_t *src)
static inline struct sock *rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src)
{
struct sock *s;
read_lock(&rfcomm_sk_list.lock);
......
......@@ -854,7 +854,7 @@ static struct tty_driver rfcomm_tty_driver = {
#ifdef CONFIG_DEVFS_FS
.name = "bluetooth/rfcomm/%d",
#else
.name = "rfcomm%d",
.name = "rfcomm",
#endif
.major = RFCOMM_TTY_MAJOR,
.minor_start = RFCOMM_TTY_MINOR,
......
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