aboutsummaryrefslogtreecommitdiff
path: root/fs/debugfs/file.c
diff options
context:
space:
mode:
authorPeter Oberparleiter <peter.oberparleiter@de.ibm.com>2007-02-13 12:13:54 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-16 15:19:17 -0800
commit66f5496393dcc9f9d05c46f00ed93d5040d6035b (patch)
treed5952a691e346b2715252d8b8cd2100d6c804a39 /fs/debugfs/file.c
parentb92be9f1ecd3c8b16e9bb22d55bb97b3d89f091a (diff)
downloadlinux-66f5496393dcc9f9d05c46f00ed93d5040d6035b.tar.gz
debugfs: implement symbolic links
debugfs: implement symbolic links Implement a new function debugfs_create_symlink() which can be used to create symbolic links in debugfs. This function can be useful for people moving functionality from /proc to debugfs (e.g. the gcov-kernel patch). Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/debugfs/file.c')
-rw-r--r--fs/debugfs/file.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 8d130cc8532..682f928b7f4 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -16,6 +16,7 @@
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/pagemap.h>
+#include <linux/namei.h>
#include <linux/debugfs.h>
static ssize_t default_read_file(struct file *file, char __user *buf,
@@ -44,6 +45,17 @@ const struct file_operations debugfs_file_operations = {
.open = default_open,
};
+static void *debugfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+{
+ nd_set_link(nd, dentry->d_inode->i_private);
+ return NULL;
+}
+
+const struct inode_operations debugfs_link_operations = {
+ .readlink = generic_readlink,
+ .follow_link = debugfs_follow_link,
+};
+
static void debugfs_u8_set(void *data, u64 val)
{
*(u8 *)data = val;