aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/bluetooth.h2
-rw-r--r--net/bluetooth/hci_sysfs.c3
-rw-r--r--net/bluetooth/l2cap.c51
-rw-r--r--net/bluetooth/rfcomm/core.c52
-rw-r--r--net/bluetooth/rfcomm/sock.c47
-rw-r--r--net/bluetooth/sco.c47
6 files changed, 114 insertions, 88 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 04a6908e38d..ff77e8f882f 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -176,6 +176,6 @@ extern void hci_sock_cleanup(void);
176extern int bt_sysfs_init(void); 176extern int bt_sysfs_init(void);
177extern void bt_sysfs_cleanup(void); 177extern void bt_sysfs_cleanup(void);
178 178
179extern struct class *bt_class; 179extern struct dentry *bt_debugfs;
180 180
181#endif /* __BLUETOOTH_H */ 181#endif /* __BLUETOOTH_H */
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index cafb55b0cea..05fd125f74f 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -8,8 +8,7 @@
8#include <net/bluetooth/bluetooth.h> 8#include <net/bluetooth/bluetooth.h>
9#include <net/bluetooth/hci_core.h> 9#include <net/bluetooth/hci_core.h>
10 10
11struct class *bt_class = NULL; 11static struct class *bt_class;
12EXPORT_SYMBOL_GPL(bt_class);
13 12
14struct dentry *bt_debugfs = NULL; 13struct dentry *bt_debugfs = NULL;
15EXPORT_SYMBOL_GPL(bt_debugfs); 14EXPORT_SYMBOL_GPL(bt_debugfs);
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 27551820741..43e17f7d7ec 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -40,6 +40,8 @@
40#include <linux/skbuff.h> 40#include <linux/skbuff.h>
41#include <linux/list.h> 41#include <linux/list.h>
42#include <linux/device.h> 42#include <linux/device.h>
43#include <linux/debugfs.h>
44#include <linux/seq_file.h>
43#include <linux/uaccess.h> 45#include <linux/uaccess.h>
44#include <linux/crc16.h> 46#include <linux/crc16.h>
45#include <net/sock.h> 47#include <net/sock.h>
@@ -3937,39 +3939,42 @@ drop:
3937 return 0; 3939 return 0;
3938} 3940}
3939 3941
3940static ssize_t l2cap_sysfs_show(struct class *dev, 3942static int l2cap_debugfs_show(struct seq_file *f, void *p)
3941 struct class_attribute *attr,
3942 char *buf)
3943{ 3943{
3944 struct sock *sk; 3944 struct sock *sk;
3945 struct hlist_node *node; 3945 struct hlist_node *node;
3946 char *str = buf;
3947 int size = PAGE_SIZE;
3948 3946
3949 read_lock_bh(&l2cap_sk_list.lock); 3947 read_lock_bh(&l2cap_sk_list.lock);
3950 3948
3951 sk_for_each(sk, node, &l2cap_sk_list.head) { 3949 sk_for_each(sk, node, &l2cap_sk_list.head) {
3952 struct l2cap_pinfo *pi = l2cap_pi(sk); 3950 struct l2cap_pinfo *pi = l2cap_pi(sk);
3953 int len;
3954
3955 len = snprintf(str, size, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d\n",
3956 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst),
3957 sk->sk_state, __le16_to_cpu(pi->psm), pi->scid,
3958 pi->dcid, pi->imtu, pi->omtu, pi->sec_level);
3959
3960 size -= len;
3961 if (size <= 0)
3962 break;
3963 3951
3964 str += len; 3952 seq_printf(f, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d\n",
3953 batostr(&bt_sk(sk)->src),
3954 batostr(&bt_sk(sk)->dst),
3955 sk->sk_state, __le16_to_cpu(pi->psm),
3956 pi->scid, pi->dcid,
3957 pi->imtu, pi->omtu, pi->sec_level);
3965 } 3958 }
3966 3959
3967 read_unlock_bh(&l2cap_sk_list.lock); 3960 read_unlock_bh(&l2cap_sk_list.lock);
3968 3961
3969 return str - buf; 3962 return 0;
3970} 3963}
3971 3964
3972static CLASS_ATTR(l2cap, S_IRUGO, l2cap_sysfs_show, NULL); 3965static int l2cap_debugfs_open(struct inode *inode, struct file *file)
3966{
3967 return single_open(file, l2cap_debugfs_show, inode->i_private);
3968}
3969
3970static const struct file_operations l2cap_debugfs_fops = {
3971 .open = l2cap_debugfs_open,
3972 .read = seq_read,
3973 .llseek = seq_lseek,
3974 .release = single_release,
3975};
3976
3977static struct dentry *l2cap_debugfs;
3973 3978
3974static const struct proto_ops l2cap_sock_ops = { 3979static const struct proto_ops l2cap_sock_ops = {
3975 .family = PF_BLUETOOTH, 3980 .family = PF_BLUETOOTH,
@@ -4029,8 +4034,12 @@ static int __init l2cap_init(void)
4029 goto error; 4034 goto error;
4030 } 4035 }
4031 4036
4032 if (class_create_file(bt_class, &class_attr_l2cap) < 0) 4037 if (bt_debugfs) {
4033 BT_ERR("Failed to create L2CAP info file"); 4038 l2cap_debugfs = debugfs_create_file("l2cap", 0444,
4039 bt_debugfs, NULL, &l2cap_debugfs_fops);
4040 if (!l2cap_debugfs)
4041 BT_ERR("Failed to create L2CAP debug file");
4042 }
4034 4043
4035 BT_INFO("L2CAP ver %s", VERSION); 4044 BT_INFO("L2CAP ver %s", VERSION);
4036 BT_INFO("L2CAP socket layer initialized"); 4045 BT_INFO("L2CAP socket layer initialized");
@@ -4044,7 +4053,7 @@ error:
4044 4053
4045static void __exit l2cap_exit(void) 4054static void __exit l2cap_exit(void)
4046{ 4055{
4047 class_remove_file(bt_class, &class_attr_l2cap); 4056 debugfs_remove(l2cap_debugfs);
4048 4057
4049 if (bt_sock_unregister(BTPROTO_L2CAP) < 0) 4058 if (bt_sock_unregister(BTPROTO_L2CAP) < 0)
4050 BT_ERR("L2CAP socket unregistration failed"); 4059 BT_ERR("L2CAP socket unregistration failed");
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index cf164073269..13f114e8b0f 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -33,6 +33,8 @@
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/wait.h> 34#include <linux/wait.h>
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/debugfs.h>
37#include <linux/seq_file.h>
36#include <linux/net.h> 38#include <linux/net.h>
37#include <linux/mutex.h> 39#include <linux/mutex.h>
38#include <linux/kthread.h> 40#include <linux/kthread.h>
@@ -2098,14 +2100,10 @@ static struct hci_cb rfcomm_cb = {
2098 .security_cfm = rfcomm_security_cfm 2100 .security_cfm = rfcomm_security_cfm
2099}; 2101};
2100 2102
2101static ssize_t rfcomm_dlc_sysfs_show(struct class *dev, 2103static int rfcomm_dlc_debugfs_show(struct seq_file *f, void *x)
2102 struct class_attribute *attr,
2103 char *buf)
2104{ 2104{
2105 struct rfcomm_session *s; 2105 struct rfcomm_session *s;
2106 struct list_head *pp, *p; 2106 struct list_head *pp, *p;
2107 char *str = buf;
2108 int size = PAGE_SIZE;
2109 2107
2110 rfcomm_lock(); 2108 rfcomm_lock();
2111 2109
@@ -2114,29 +2112,33 @@ static ssize_t rfcomm_dlc_sysfs_show(struct class *dev,
2114 list_for_each(pp, &s->dlcs) { 2112 list_for_each(pp, &s->dlcs) {
2115 struct sock *sk = s->sock->sk; 2113 struct sock *sk = s->sock->sk;
2116 struct rfcomm_dlc *d = list_entry(pp, struct rfcomm_dlc, list); 2114 struct rfcomm_dlc *d = list_entry(pp, struct rfcomm_dlc, list);
2117 int len;
2118 2115
2119 len = snprintf(str, size, "%s %s %ld %d %d %d %d\n", 2116 seq_printf(f, "%s %s %ld %d %d %d %d\n",
2120 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 2117 batostr(&bt_sk(sk)->src),
2121 d->state, d->dlci, d->mtu, d->rx_credits, d->tx_credits); 2118 batostr(&bt_sk(sk)->dst),
2122 2119 d->state, d->dlci, d->mtu,
2123 size -= len; 2120 d->rx_credits, d->tx_credits);
2124 if (size <= 0)
2125 break;
2126
2127 str += len;
2128 } 2121 }
2129
2130 if (size <= 0)
2131 break;
2132 } 2122 }
2133 2123
2134 rfcomm_unlock(); 2124 rfcomm_unlock();
2135 2125
2136 return (str - buf); 2126 return 0;
2127}
2128
2129static int rfcomm_dlc_debugfs_open(struct