Bluetooth: Added /proc/net/cmtp via bt_procfs_init()
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sat Sep 29 10:59:22 EDT 2012
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=8c8de589cedd375934d96e073d2b9077a00f10c2
Commit: 8c8de589cedd375934d96e073d2b9077a00f10c2
Parent: 77cf5585a31fdad48c16ddae9be154f5afe22c1c
Author: Masatake YAMATO <yamato at redhat.com>
AuthorDate: Thu Jul 26 01:28:07 2012 +0900
Committer: Gustavo Padovan <gustavo.padovan at collabora.co.uk>
CommitDate: Mon Aug 6 15:02:59 2012 -0300
Bluetooth: Added /proc/net/cmtp via bt_procfs_init()
Added /proc/net/cmtp via bt_procfs_init().
Signed-off-by: Masatake YAMATO <yamato at redhat.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan at collabora.co.uk>
---
net/bluetooth/cmtp/sock.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
index 311668d..d5cacef 100644
--- a/net/bluetooth/cmtp/sock.c
+++ b/net/bluetooth/cmtp/sock.c
@@ -42,6 +42,10 @@
#include "cmtp.h"
+static struct bt_sock_list cmtp_sk_list = {
+ .lock = __RW_LOCK_UNLOCKED(cmtp_sk_list.lock)
+};
+
static int cmtp_sock_release(struct socket *sock)
{
struct sock *sk = sock->sk;
@@ -51,6 +55,8 @@ static int cmtp_sock_release(struct socket *sock)
if (!sk)
return 0;
+ bt_sock_unlink(&cmtp_sk_list, sk);
+
sock_orphan(sk);
sock_put(sk);
@@ -214,6 +220,8 @@ static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol,
sk->sk_protocol = protocol;
sk->sk_state = BT_OPEN;
+ bt_sock_link(&cmtp_sk_list, sk);
+
return 0;
}
@@ -232,19 +240,30 @@ int cmtp_init_sockets(void)
return err;
err = bt_sock_register(BTPROTO_CMTP, &cmtp_sock_family_ops);
- if (err < 0)
+ if (err < 0) {
+ BT_ERR("Can't register CMTP socket");
goto error;
+ }
+
+ err = bt_procfs_init(THIS_MODULE, &init_net, "cmtp", &cmtp_sk_list, NULL);
+ if (err < 0) {
+ BT_ERR("Failed to create CMTP proc file");
+ bt_sock_unregister(BTPROTO_HIDP);
+ goto error;
+ }
+
+ BT_INFO("CMTP socket layer initialized");
return 0;
error:
- BT_ERR("Can't register CMTP socket");
proto_unregister(&cmtp_proto);
return err;
}
void cmtp_cleanup_sockets(void)
{
+ bt_procfs_cleanup(&init_net, "cmtp");
if (bt_sock_unregister(BTPROTO_CMTP) < 0)
BT_ERR("Can't unregister CMTP socket");
More information about the linux-mtd-cvs
mailing list