From b0de6c4c81099494d7863a31db06366f74395cda Mon Sep 17 00:00:00 2001 From: David Sterba Date: Thu, 1 Sep 2016 14:37:53 +0200 Subject: [PATCH] btrfs: create example debugfs file only in debugging build Reviewed-by: Eric Sandeen Signed-off-by: David Sterba --- fs/btrfs/sysfs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 804bd1c42e47..e498a472ac20 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -836,8 +836,17 @@ static int btrfs_init_debugfs(void) if (!btrfs_debugfs_root_dentry) return -ENOMEM; + /* + * Example code, how to export data through debugfs. + * + * file: /sys/kernel/debug/btrfs/test + * contents of: btrfs_debugfs_test + */ +#ifdef CONFIG_BTRFS_DEBUG debugfs_create_u64("test", S_IRUGO | S_IWUSR, btrfs_debugfs_root_dentry, &btrfs_debugfs_test); +#endif + #endif return 0; } -- GitLab