Skip to contentSkip to conversation

btrfs: create example debugfs file only in debugging build

PATCH In review David Sterba 2 participants 2 messages Sep 1, 2016 Btrfs file system

lore
Share & tools
lore

David Sterba

author maintainer
#0 lore raw

PATCH 1/1 btrfs: create example debugfs file only in debugging build

---
 fs/btrfs/sysfs.c | 9 +++++++++
 1 file changed, 9 insertions(+)
fs/btrfs/sysfs.c +9 -0
index 804bd1c42e47..31f09564e170 100644
@@ -836,9 +836,18 @@ static int btrfs_init_debugfs(void)
 	if (!btrfs_debugfs_root_dentry)
 		return -ENOMEM;
 
+	/*
+	 * Example code, how 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;
 }
 
Signature · 1 line
2.7.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · David Sterba
Quoted 28 lines
---
 fs/btrfs/sysfs.c | 9 +++++++++
 1 file changed, 9 insertions(+)
fs/btrfs/sysfs.c +9 -0
index 804bd1c42e47..31f09564e170 100644
@@ -836,9 +836,18 @@ static int btrfs_init_debugfs(void)
 	if (!btrfs_debugfs_root_dentry)
 		return -ENOMEM;
 
+	/*
+	 * Example code, how 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;
 }