summaryrefslogtreecommitdiff
path: root/backport/backport-include/linux/debugfs.h
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2018-03-04 23:57:10 +0100
committerJohannes Berg <johannes.berg@intel.com>2018-03-21 09:19:32 +0100
commitc2df02c2e024b6e10a0d34e4de98324f5f3ca00b (patch)
treeebc09b251ba8dafdcba3145f3fce9ef572c08288 /backport/backport-include/linux/debugfs.h
parentb35b2767cae23ad2fe9ad04d7c72df3e789c7ac6 (diff)
header: debugfs.h: add DEFINE_DEBUGFS_ATTRIBUTE
DEFINE_DEBUGFS_ATTRIBUTE and debugfs_create_file_unsafe() were introduced in mainline commit c6468808149 ("debugfs: add support for self-protecting attribute file fops"), but on older kernel versions where we do not have this extra security in debugfs we can use the older functions instead. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'backport/backport-include/linux/debugfs.h')
-rw-r--r--backport/backport-include/linux/debugfs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/backport/backport-include/linux/debugfs.h b/backport/backport-include/linux/debugfs.h
index 11670388..fb50c4f5 100644
--- a/backport/backport-include/linux/debugfs.h
+++ b/backport/backport-include/linux/debugfs.h
@@ -53,4 +53,11 @@ debugfs_real_fops(const struct file *filp)
}
#endif /* <4.9.0 but not >= 4.8.4, 4.7.10 */
+#ifndef DEFINE_DEBUGFS_ATTRIBUTE
+#define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt) \
+ DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt)
+#define debugfs_create_file_unsafe(name, mode, parent, data, fops) \
+ debugfs_create_file(name, mode, parent, data, fops)
+#endif
+
#endif /* __BACKPORT_DEBUGFS_H_ */