From e6a17f26e9b344e9d2349a81f9dcee09e96593d6 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 16 Sep 2011 17:51:02 -0400 Subject: [PATCH] Expose /proc/lttng file Signed-off-by: Mathieu Desnoyers --- ltt-debugfs-abi.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ltt-debugfs-abi.c b/ltt-debugfs-abi.c index 81afdbdb..3d231c0d 100644 --- a/ltt-debugfs-abi.c +++ b/ltt-debugfs-abi.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -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, - <tng_fops); - if (IS_ERR(lttng_dentry) || !lttng_dentry) { + <tng_fops); + if (IS_ERR(lttng_dentry)) + lttng_dentry = NULL; + + lttng_proc_dentry = proc_create_data("lttng", S_IWUSR, NULL, + <tng_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); } -- 2.34.1