* [PATCH 5/8] Added /proc/net/hidp via bt_procfs_init()
@ 2012-06-14 17:17 Masatake YAMATO
2012-06-15 7:50 ` Andrei Emeltchenko
0 siblings, 1 reply; 2+ messages in thread
From: Masatake YAMATO @ 2012-06-14 17:17 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-bluetooth
Added /proc/net/hidp via bt_procfs_init().
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
net/bluetooth/hidp/sock.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c
index 73a32d7..dd31d8f 100644
--- a/net/bluetooth/hidp/sock.c
+++ b/net/bluetooth/hidp/sock.c
@@ -39,6 +39,11 @@
#include "hidp.h"
+
+static struct bt_sock_list hidp_sk_list = {
+ .lock = __RW_LOCK_UNLOCKED(hidp_sk_list.lock)
+};
+
static int hidp_sock_release(struct socket *sock)
{
struct sock *sk = sock->sk;
@@ -48,6 +53,8 @@ static int hidp_sock_release(struct socket *sock)
if (!sk)
return 0;
+ bt_sock_unlink(&hidp_sk_list, sk);
+
sock_orphan(sk);
sock_put(sk);
@@ -267,6 +274,8 @@ static int hidp_sock_create(struct net *net, struct socket *sock, int protocol,
sk->sk_protocol = protocol;
sk->sk_state = BT_OPEN;
+ bt_sock_link(&hidp_sk_list, sk);
+
return 0;
}
@@ -285,19 +294,30 @@ int __init hidp_init_sockets(void)
return err;
err = bt_sock_register(BTPROTO_HIDP, &hidp_sock_family_ops);
- if (err < 0)
+ if (err < 0) {
+ BT_ERR("Can't register HIDP socket");
goto error;
+ }
+
+ err = bt_procfs_init(THIS_MODULE, &init_net, "hidp", &hidp_sk_list, NULL);
+ if (err < 0) {
+ BT_ERR("Failed to create HIDP proc file");
+ bt_sock_unregister(BTPROTO_HIDP);
+ goto error;
+ }
+
+ BT_INFO("HIDP socket layer initialized");
return 0;
error:
- BT_ERR("Can't register HIDP socket");
proto_unregister(&hidp_proto);
return err;
}
void __exit hidp_cleanup_sockets(void)
{
+ bt_procfs_cleanup(&init_net, "hidp");
if (bt_sock_unregister(BTPROTO_HIDP) < 0)
BT_ERR("Can't unregister HIDP socket");
--
1.7.10.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 5/8] Added /proc/net/hidp via bt_procfs_init()
2012-06-14 17:17 [PATCH 5/8] Added /proc/net/hidp via bt_procfs_init() Masatake YAMATO
@ 2012-06-15 7:50 ` Andrei Emeltchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andrei Emeltchenko @ 2012-06-15 7:50 UTC (permalink / raw)
To: Masatake YAMATO; +Cc: linux-kernel, linux-bluetooth
Hi Masatake,
On Fri, Jun 15, 2012 at 02:17:42AM +0900, Masatake YAMATO wrote:
> Added /proc/net/hidp via bt_procfs_init().
>
> Signed-off-by: Masatake YAMATO <yamato@redhat.com>
> ---
> net/bluetooth/hidp/sock.c | 24 ++++++++++++++++++++++--
> 1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c
> index 73a32d7..dd31d8f 100644
> --- a/net/bluetooth/hidp/sock.c
> +++ b/net/bluetooth/hidp/sock.c
> @@ -39,6 +39,11 @@
>
> #include "hidp.h"
>
> +
Extra space here
Best regards
Andrei Emeltchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-15 7:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-14 17:17 [PATCH 5/8] Added /proc/net/hidp via bt_procfs_init() Masatake YAMATO
2012-06-15 7:50 ` Andrei Emeltchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.