Expose /proc/lttng file
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 16 Sep 2011 21:51:02 +0000 (17:51 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 16 Sep 2011 21:51:20 +0000 (17:51 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ltt-debugfs-abi.c

index 81afdbdbae28f13459fc84f9e3ed7dbe97137945..3d231c0d211c10f01a1542b02615f2ab0e2bf2ec 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <linux/module.h>
 #include <linux/debugfs.h>
+#include <linux/proc_fs.h>
 #include <linux/anon_inodes.h>
 #include <linux/file.h>
 #include <linux/uaccess.h>
@@ -43,6 +44,7 @@
  */
 
 static struct dentry *lttng_dentry;
+static struct proc_dir_entry *lttng_proc_dentry;
 static const struct file_operations lttng_fops;
 static const struct file_operations lttng_session_fops;
 static const struct file_operations lttng_channel_fops;
@@ -745,8 +747,14 @@ int __init ltt_debugfs_abi_init(void)
 
        wrapper_vmalloc_sync_all();
        lttng_dentry = debugfs_create_file("lttng", S_IWUSR, NULL, NULL,
-                                          &lttng_fops);
-       if (IS_ERR(lttng_dentry) || !lttng_dentry) {
+                                       &lttng_fops);
+       if (IS_ERR(lttng_dentry))
+               lttng_dentry = NULL;
+
+       lttng_proc_dentry = proc_create_data("lttng", S_IWUSR, NULL,
+                                       &lttng_fops, NULL);
+       
+       if (!lttng_dentry && !lttng_proc_dentry) {
                printk(KERN_ERR "Error creating LTTng control file\n");
                ret = -ENOMEM;
                goto error;
@@ -757,5 +765,8 @@ error:
 
 void __exit ltt_debugfs_abi_exit(void)
 {
-       debugfs_remove(lttng_dentry);
+       if (lttng_dentry)
+               debugfs_remove(lttng_dentry);
+       if (lttng_proc_dentry)
+               remove_proc_entry("lttng", NULL);
 }
This page took 0.02871 seconds and 4 git commands to generate.