aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/rfcomm/sock.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-11-08 12:57:38 -0500
committerDavid S. Miller <davem@davemloft.net>2005-11-08 12:57:38 -0500
commitbe9d122730c878baafe11e70d1436faac229f2fc (patch)
treed6644129b56d7cff9fb9781154eebf97746f296b /net/bluetooth/rfcomm/sock.c
parent1ebb92521d0bc2d4ef772730d29333c06b807191 (diff)
[Bluetooth]: Remove the usage of /proc completely
This patch removes all relics of the /proc usage from the Bluetooth subsystem core and its upper layers. All the previous information are now available via /sys/class/bluetooth through appropriate functions. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bluetooth/rfcomm/sock.c')
-rw-r--r--net/bluetooth/rfcomm/sock.c90
1 files changed, 13 insertions, 77 deletions
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index a2b30f0aedb7..6c34261b232e 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -42,8 +42,7 @@
42#include <linux/socket.h> 42#include <linux/socket.h>
43#include <linux/skbuff.h> 43#include <linux/skbuff.h>
44#include <linux/list.h> 44#include <linux/list.h>
45#include <linux/proc_fs.h> 45#include <linux/device.h>
46#include <linux/seq_file.h>
47#include <net/sock.h> 46#include <net/sock.h>
48 47
49#include <asm/system.h> 48#include <asm/system.h>
@@ -887,89 +886,26 @@ done:
887 return result; 886 return result;
888} 887}
889 888
890/* ---- Proc fs support ---- */ 889static ssize_t rfcomm_sock_sysfs_show(struct class *dev, char *buf)
891#ifdef CONFIG_PROC_FS
892static void *rfcomm_seq_start(struct seq_file *seq, loff_t *pos)
893{ 890{
894 struct sock *sk; 891 struct sock *sk;
895 struct hlist_node *node; 892 struct hlist_node *node;
896 loff_t l = *pos; 893 char *str = buf;
897 894
898 read_lock_bh(&rfcomm_sk_list.lock); 895 read_lock_bh(&rfcomm_sk_list.lock);
899 896
900 sk_for_each(sk, node, &rfcomm_sk_list.head) 897 sk_for_each(sk, node, &rfcomm_sk_list.head) {
901 if (!l--) 898 str += sprintf(str, "%s %s %d %d\n",
902 return sk; 899 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst),
903 return NULL; 900 sk->sk_state, rfcomm_pi(sk)->channel);
904} 901 }
905
906static void *rfcomm_seq_next(struct seq_file *seq, void *e, loff_t *pos)
907{
908 struct sock *sk = e;
909 (*pos)++;
910 return sk_next(sk);
911}
912 902
913static void rfcomm_seq_stop(struct seq_file *seq, void *e)
914{
915 read_unlock_bh(&rfcomm_sk_list.lock); 903 read_unlock_bh(&rfcomm_sk_list.lock);
916}
917 904
918static int rfcomm_seq_show(struct seq_file *seq, void *e) 905 return (str - buf);
919{
920 struct sock *sk = e;
921 seq_printf(seq, "%s %s %d %d\n",
922 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst),
923 sk->sk_state, rfcomm_pi(sk)->channel);
924 return 0;
925}
926
927static struct seq_operations rfcomm_seq_ops = {
928 .start = rfcomm_seq_start,
929 .next = rfcomm_seq_next,
930 .stop = rfcomm_seq_stop,
931 .show = rfcomm_seq_show
932};
933
934static int rfcomm_seq_open(struct inode *inode, struct file *file)
935{
936 return seq_open(file, &rfcomm_seq_ops);
937} 906}
938 907
939static struct file_operations rfcomm_seq_fops = { 908static CLASS_ATTR(rfcomm, S_IRUGO, rfcomm_sock_sysfs_show, NULL);
940 .owner = THIS_MODULE,
941 .open = rfcomm_seq_open,
942 .read = seq_read,
943 .llseek = seq_lseek,
944 .release = seq_release,
945};
946
947static int __init rfcomm_sock_proc_init(void)
948{
949 struct proc_dir_entry *p = create_proc_entry("sock", S_IRUGO, proc_bt_rfcomm);
950 if (!p)
951 return -ENOMEM;
952 p->proc_fops = &rfcomm_seq_fops;
953 return 0;
954}
955
956static void __exit rfcomm_sock_proc_cleanup(void)
957{
958 remove_proc_entry("sock", proc_bt_rfcomm);
959}
960
961#else /* CONFIG_PROC_FS */
962
963static int __init rfcomm_sock_proc_init(void)
964{
965 return 0;
966}
967
968static void __exit rfcomm_sock_proc_cleanup(void)
969{
970 return;
971}
972#endif /* CONFIG_PROC_FS */
973 909
974static struct proto_ops rfcomm_sock_ops = { 910static struct proto_ops rfcomm_sock_ops = {
975 .family = PF_BLUETOOTH, 911 .family = PF_BLUETOOTH,
@@ -997,7 +933,7 @@ static struct net_proto_family rfcomm_sock_family_ops = {
997 .create = rfcomm_sock_create 933 .create = rfcomm_sock_create
998}; 934};
999 935
1000int __init rfcomm_init_sockets(void) 936int __init rfcomm_init_sockets(void)
1001{ 937{
1002 int err; 938 int err;
1003 939
@@ -1009,7 +945,7 @@ int __init rfcomm_init_sockets(void)
1009 if (err < 0) 945 if (err < 0)
1010 goto error; 946 goto error;
1011 947
1012 rfcomm_sock_proc_init(); 948 class_create_file(&bt_class, &class_attr_rfcomm);
1013 949
1014 BT_INFO("RFCOMM socket layer initialized"); 950 BT_INFO("RFCOMM socket layer initialized");
1015 951
@@ -1023,7 +959,7 @@ error:
1023 959
1024void __exit rfcomm_cleanup_sockets(void) 960void __exit rfcomm_cleanup_sockets(void)
1025{ 961{
1026 rfcomm_sock_proc_cleanup(); 962 class_remove_file(&bt_class, &class_attr_rfcomm);
1027 963
1028 if (bt_sock_unregister(BTPROTO_RFCOMM) < 0) 964 if (bt_sock_unregister(BTPROTO_RFCOMM) < 0)
1029 BT_ERR("RFCOMM socket layer unregistration failed"); 965 BT_ERR("RFCOMM socket layer unregistration failed");