Commit 84c64df6 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Marcel Holtmann

[Bluetooth] Add some COMPATIBLE_IOCTL for SPARC64

This patch adds the needed COMPATIBLE_IOCTL for SPARC64 to let
the HCIUART, RFCOMM and BNEP part of the Bluetooth subsystem
work correctly on this architecture.
parent 138c23e2
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
#include <net/bluetooth/bluetooth.h> #include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci.h> #include <net/bluetooth/hci.h>
#include <net/bluetooth/rfcomm.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usbdevice_fs.h> #include <linux/usbdevice_fs.h>
...@@ -3797,6 +3798,14 @@ static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) ...@@ -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); 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 { struct usbdevfs_ctrltransfer32 {
__u8 bRequestType; __u8 bRequestType;
__u8 bRequest; __u8 bRequest;
...@@ -4973,6 +4982,17 @@ COMPATIBLE_IOCTL(HCISETLINKMODE) ...@@ -4973,6 +4982,17 @@ COMPATIBLE_IOCTL(HCISETLINKMODE)
COMPATIBLE_IOCTL(HCISETACLMTU) COMPATIBLE_IOCTL(HCISETACLMTU)
COMPATIBLE_IOCTL(HCISETSCOMTU) COMPATIBLE_IOCTL(HCISETSCOMTU)
COMPATIBLE_IOCTL(HCIINQUIRY) 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. */ /* Misc. */
COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */ COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */
COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */ COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */
......
...@@ -111,25 +111,31 @@ struct bnep_ext_hdr { ...@@ -111,25 +111,31 @@ struct bnep_ext_hdr {
__u8 data[0]; __u8 data[0];
} __attribute__((packed)); } __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 // Ioctl interface
#define BNEPCONADD 1 #define BNEPCONADD 1
#define BNEPCONDEL 2 #define BNEPCONDEL 2
#define BNEPGETCONLIST 3 #define BNEPGETCONLIST 3
#define BNEPGETCONINFO 4 #define BNEPGETCONINFO 4
struct bnep_conadd_req { struct bnep_connadd_req {
int sock; // Connected socket int sock; // Connected socket
__u32 flags; __u32 flags;
__u16 role; __u16 role;
char device[16]; // Name of the Ethernet device char device[16]; // Name of the Ethernet device
}; };
struct bnep_condel_req { struct bnep_conndel_req {
__u32 flags; __u32 flags;
__u8 dst[ETH_ALEN]; __u8 dst[ETH_ALEN];
}; };
struct bnep_coninfo { struct bnep_conninfo {
__u32 flags; __u32 flags;
__u16 role; __u16 role;
__u16 state; __u16 state;
...@@ -137,9 +143,9 @@ struct bnep_coninfo { ...@@ -137,9 +143,9 @@ struct bnep_coninfo {
char device[16]; char device[16];
}; };
struct bnep_conlist_req { struct bnep_connlist_req {
__u32 cnum; __u32 cnum;
struct bnep_coninfo *ci; struct bnep_conninfo *ci;
}; };
struct bnep_proto_filter { struct bnep_proto_filter {
...@@ -147,10 +153,10 @@ struct bnep_proto_filter { ...@@ -147,10 +153,10 @@ struct bnep_proto_filter {
__u16 end; __u16 end;
}; };
int bnep_add_connection(struct bnep_conadd_req *req, struct socket *sock); int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock);
int bnep_del_connection(struct bnep_condel_req *req); int bnep_del_connection(struct bnep_conndel_req *req);
int bnep_get_conlist(struct bnep_conlist_req *req); int bnep_get_connlist(struct bnep_connlist_req *req);
int bnep_get_coninfo(struct bnep_coninfo *ci); int bnep_get_conninfo(struct bnep_conninfo *ci);
// BNEP sessions // BNEP sessions
struct bnep_session { struct bnep_session {
......
...@@ -531,7 +531,7 @@ static int bnep_session(void *arg) ...@@ -531,7 +531,7 @@ static int bnep_session(void *arg)
return 0; 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 net_device *dev;
struct bnep_session *s, *ss; struct bnep_session *s, *ss;
...@@ -622,7 +622,7 @@ int bnep_add_connection(struct bnep_conadd_req *req, struct socket *sock) ...@@ -622,7 +622,7 @@ int bnep_add_connection(struct bnep_conadd_req *req, struct socket *sock)
return err; return err;
} }
int bnep_del_connection(struct bnep_condel_req *req) int bnep_del_connection(struct bnep_conndel_req *req)
{ {
struct bnep_session *s; struct bnep_session *s;
int err = 0; int err = 0;
...@@ -647,7 +647,7 @@ int bnep_del_connection(struct bnep_condel_req *req) ...@@ -647,7 +647,7 @@ int bnep_del_connection(struct bnep_condel_req *req)
return err; 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); memcpy(ci->dst, s->eh.h_source, ETH_ALEN);
strcpy(ci->device, s->dev.name); strcpy(ci->device, s->dev.name);
...@@ -656,7 +656,7 @@ static void __bnep_copy_ci(struct bnep_coninfo *ci, struct bnep_session *s) ...@@ -656,7 +656,7 @@ static void __bnep_copy_ci(struct bnep_coninfo *ci, struct bnep_session *s)
ci->role = s->role; 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; struct list_head *p;
int err = 0, n = 0; int err = 0, n = 0;
...@@ -665,7 +665,7 @@ int bnep_get_conlist(struct bnep_conlist_req *req) ...@@ -665,7 +665,7 @@ int bnep_get_conlist(struct bnep_conlist_req *req)
list_for_each(p, &bnep_session_list) { list_for_each(p, &bnep_session_list) {
struct bnep_session *s; struct bnep_session *s;
struct bnep_coninfo ci; struct bnep_conninfo ci;
s = list_entry(p, struct bnep_session, list); s = list_entry(p, struct bnep_session, list);
...@@ -687,7 +687,7 @@ int bnep_get_conlist(struct bnep_conlist_req *req) ...@@ -687,7 +687,7 @@ int bnep_get_conlist(struct bnep_conlist_req *req)
return err; return err;
} }
int bnep_get_coninfo(struct bnep_coninfo *ci) int bnep_get_conninfo(struct bnep_conninfo *ci)
{ {
struct bnep_session *s; struct bnep_session *s;
int err = 0; int err = 0;
......
...@@ -73,10 +73,10 @@ static int bnep_sock_release(struct socket *sock) ...@@ -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) static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{ {
struct bnep_conlist_req cl; struct bnep_connlist_req cl;
struct bnep_conadd_req ca; struct bnep_connadd_req ca;
struct bnep_condel_req cd; struct bnep_conndel_req cd;
struct bnep_coninfo ci; struct bnep_conninfo ci;
struct socket *nsock; struct socket *nsock;
int err; int err;
...@@ -84,6 +84,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long ...@@ -84,6 +84,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
switch (cmd) { switch (cmd) {
case BNEPCONADD: case BNEPCONADD:
case BNEPCONNADD:
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EACCES; return -EACCES;
...@@ -107,6 +108,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long ...@@ -107,6 +108,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
return err; return err;
case BNEPCONDEL: case BNEPCONDEL:
case BNEPCONNDEL:
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EACCES; return -EACCES;
...@@ -116,23 +118,25 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long ...@@ -116,23 +118,25 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
return bnep_del_connection(&cd); return bnep_del_connection(&cd);
case BNEPGETCONLIST: case BNEPGETCONLIST:
case BNEPGETCONNLIST:
if (copy_from_user(&cl, (void *) arg, sizeof(cl))) if (copy_from_user(&cl, (void *) arg, sizeof(cl)))
return -EFAULT; return -EFAULT;
if (cl.cnum <= 0) if (cl.cnum <= 0)
return -EINVAL; return -EINVAL;
err = bnep_get_conlist(&cl); err = bnep_get_connlist(&cl);
if (!err && copy_to_user((void *) arg, &cl, sizeof(cl))) if (!err && copy_to_user((void *) arg, &cl, sizeof(cl)))
return -EFAULT; return -EFAULT;
return err; return err;
case BNEPGETCONINFO: case BNEPGETCONINFO:
case BNEPGETCONNINFO:
if (copy_from_user(&ci, (void *) arg, sizeof(ci))) if (copy_from_user(&ci, (void *) arg, sizeof(ci)))
return -EFAULT; return -EFAULT;
err = bnep_get_coninfo(&ci); err = bnep_get_conninfo(&ci);
if (!err && copy_to_user((void *) arg, &ci, sizeof(ci))) if (!err && copy_to_user((void *) arg, &ci, sizeof(ci)))
return -EFAULT; return -EFAULT;
......
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