diff options
author | James Bottomley <jejb@titanic.(none)> | 2005-11-10 09:29:07 -0500 |
---|---|---|
committer | James Bottomley <jejb@titanic.(none)> | 2005-11-10 09:29:07 -0500 |
commit | 8a87a0b6313109d2fea87b1271d497c954ce2ca8 (patch) | |
tree | 1b7ae51ff681e27118590e9cab4bf0ce38f5d80e /net/bluetooth/sco.c | |
parent | e6a04466ba965875a6132700fabb2f2c0249c41a (diff) | |
parent | 3b44f137b9a846c5452d9e6e1271b79b1dbcc942 (diff) |
Merge by hand (whitespace conflicts in libata.h)
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'net/bluetooth/sco.c')
-rw-r--r-- | net/bluetooth/sco.c | 92 |
1 files changed, 13 insertions, 79 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 997e42df115c..9cb00dc6c08c 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -38,8 +38,7 @@ | |||
38 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
39 | #include <linux/socket.h> | 39 | #include <linux/socket.h> |
40 | #include <linux/skbuff.h> | 40 | #include <linux/skbuff.h> |
41 | #include <linux/proc_fs.h> | 41 | #include <linux/device.h> |
42 | #include <linux/seq_file.h> | ||
43 | #include <linux/list.h> | 42 | #include <linux/list.h> |
44 | #include <net/sock.h> | 43 | #include <net/sock.h> |
45 | 44 | ||
@@ -55,7 +54,7 @@ | |||
55 | #define BT_DBG(D...) | 54 | #define BT_DBG(D...) |
56 | #endif | 55 | #endif |
57 | 56 | ||
58 | #define VERSION "0.4" | 57 | #define VERSION "0.5" |
59 | 58 | ||
60 | static struct proto_ops sco_sock_ops; | 59 | static struct proto_ops sco_sock_ops; |
61 | 60 | ||
@@ -893,91 +892,26 @@ drop: | |||
893 | return 0; | 892 | return 0; |
894 | } | 893 | } |
895 | 894 | ||
896 | /* ---- Proc fs support ---- */ | 895 | static ssize_t sco_sysfs_show(struct class *dev, char *buf) |
897 | #ifdef CONFIG_PROC_FS | ||
898 | static void *sco_seq_start(struct seq_file *seq, loff_t *pos) | ||
899 | { | 896 | { |
900 | struct sock *sk; | 897 | struct sock *sk; |
901 | struct hlist_node *node; | 898 | struct hlist_node *node; |
902 | loff_t l = *pos; | 899 | char *str = buf; |
903 | 900 | ||
904 | read_lock_bh(&sco_sk_list.lock); | 901 | read_lock_bh(&sco_sk_list.lock); |
905 | 902 | ||
906 | sk_for_each(sk, node, &sco_sk_list.head) | 903 | sk_for_each(sk, node, &sco_sk_list.head) { |
907 | if (!l--) | 904 | str += sprintf(str, "%s %s %d\n", |
908 | goto found; | 905 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), |
909 | sk = NULL; | 906 | sk->sk_state); |
910 | found: | 907 | } |
911 | return sk; | ||
912 | } | ||
913 | |||
914 | static void *sco_seq_next(struct seq_file *seq, void *e, loff_t *pos) | ||
915 | { | ||
916 | struct sock *sk = e; | ||
917 | (*pos)++; | ||
918 | return sk_next(sk); | ||
919 | } | ||
920 | 908 | ||
921 | static void sco_seq_stop(struct seq_file *seq, void *e) | ||
922 | { | ||
923 | read_unlock_bh(&sco_sk_list.lock); | 909 | read_unlock_bh(&sco_sk_list.lock); |
924 | } | ||
925 | |||
926 | static int sco_seq_show(struct seq_file *seq, void *e) | ||
927 | { | ||
928 | struct sock *sk = e; | ||
929 | seq_printf(seq, "%s %s %d\n", | ||
930 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), sk->sk_state); | ||
931 | return 0; | ||
932 | } | ||
933 | 910 | ||
934 | static struct seq_operations sco_seq_ops = { | 911 | return (str - buf); |
935 | .start = sco_seq_start, | ||
936 | .next = sco_seq_next, | ||
937 | .stop = sco_seq_stop, | ||
938 | .show = sco_seq_show | ||
939 | }; | ||
940 | |||
941 | static int sco_seq_open(struct inode *inode, struct file *file) | ||
942 | { | ||
943 | return seq_open(file, &sco_seq_ops); | ||
944 | } | 912 | } |
945 | 913 | ||
946 | static struct file_operations sco_seq_fops = { | 914 | static CLASS_ATTR(sco, S_IRUGO, sco_sysfs_show, NULL); |
947 | .owner = THIS_MODULE, | ||
948 | .open = sco_seq_open, | ||
949 | .read = seq_read, | ||
950 | .llseek = seq_lseek, | ||
951 | .release = seq_release, | ||
952 | }; | ||
953 | |||
954 | static int __init sco_proc_init(void) | ||
955 | { | ||
956 | struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt); | ||
957 | if (!p) | ||
958 | return -ENOMEM; | ||
959 | p->owner = THIS_MODULE; | ||
960 | p->proc_fops = &sco_seq_fops; | ||
961 | return 0; | ||
962 | } | ||
963 | |||
964 | static void __exit sco_proc_cleanup(void) | ||
965 | { | ||
966 | remove_proc_entry("sco", proc_bt); | ||
967 | } | ||
968 | |||
969 | #else /* CONFIG_PROC_FS */ | ||
970 | |||
971 | static int __init sco_proc_init(void) | ||
972 | { | ||
973 | return 0; | ||
974 | } | ||
975 | |||
976 | static void __exit sco_proc_cleanup(void) | ||
977 | { | ||
978 | return; | ||
979 | } | ||
980 | #endif /* CONFIG_PROC_FS */ | ||
981 | 915 | ||
982 | static struct proto_ops sco_sock_ops = { | 916 | static struct proto_ops sco_sock_ops = { |
983 | .family = PF_BLUETOOTH, | 917 | .family = PF_BLUETOOTH, |
@@ -1035,7 +969,7 @@ static int __init sco_init(void) | |||
1035 | goto error; | 969 | goto error; |
1036 | } | 970 | } |
1037 | 971 | ||
1038 | sco_proc_init(); | 972 | class_create_file(&bt_class, &class_attr_sco); |
1039 | 973 | ||
1040 | BT_INFO("SCO (Voice Link) ver %s", VERSION); | 974 | BT_INFO("SCO (Voice Link) ver %s", VERSION); |
1041 | BT_INFO("SCO socket layer initialized"); | 975 | BT_INFO("SCO socket layer initialized"); |
@@ -1049,7 +983,7 @@ error: | |||
1049 | 983 | ||
1050 | static void __exit sco_exit(void) | 984 | static void __exit sco_exit(void) |
1051 | { | 985 | { |
1052 | sco_proc_cleanup(); | 986 | class_remove_file(&bt_class, &class_attr_sco); |
1053 | 987 | ||
1054 | if (bt_sock_unregister(BTPROTO_SCO) < 0) | 988 | if (bt_sock_unregister(BTPROTO_SCO) < 0) |
1055 | BT_ERR("SCO socket unregistration failed"); | 989 | BT_ERR("SCO socket unregistration failed"); |