Masatake YAMATO | 14 Jun 2012 19:18
Picon
Favicon

[PATCH 7/8] Added /proc/net/rfcomm via bt_procfs_init()

Added /proc/net/rfcomm via bt_procfs_init().

Signed-off-by: Masatake YAMATO <yamato <at> redhat.com>
---
 net/bluetooth/rfcomm/sock.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index e8707de..0d0a35f 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
 <at>  <at>  -1052,8 +1052,18  <at>  <at>  int __init rfcomm_init_sockets(void)
 		return err;

 	err = bt_sock_register(BTPROTO_RFCOMM, &rfcomm_sock_family_ops);
-	if (err < 0)
+	if (err < 0) {
+	  	BT_ERR("RFCOMM socket layer registration failed");
 		goto error;
+	}
+
+	err = bt_procfs_init(THIS_MODULE, &init_net, "rfcomm", &rfcomm_sk_list, NULL);
+	if (err < 0) {
+		BT_ERR("Failed to create RFCOMM proc file");
+		bt_sock_unregister(BTPROTO_RFCOMM);
+		goto error;
+	}
+

 	if (bt_debugfs) {
 		rfcomm_sock_debugfs = debugfs_create_file("rfcomm", 0444,
 <at>  <at>  -1067,13 +1077,14  <at>  <at>  int __init rfcomm_init_sockets(void)
 	return 0;

 error:
-	BT_ERR("RFCOMM socket layer registration failed");
 	proto_unregister(&rfcomm_proto);
 	return err;
 }

 void __exit rfcomm_cleanup_sockets(void)
 {
+  	bt_procfs_cleanup(&init_net, "rfcomm");
+
 	debugfs_remove(rfcomm_sock_debugfs);

 	if (bt_sock_unregister(BTPROTO_RFCOMM) < 0)
--

-- 
1.7.10.2


Gmane