diff options
author | Peter Oberparleiter <peter.oberparleiter@de.ibm.com> | 2007-02-13 06:13:54 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-16 18:19:17 -0500 |
commit | 66f5496393dcc9f9d05c46f00ed93d5040d6035b (patch) | |
tree | d5952a691e346b2715252d8b8cd2100d6c804a39 /fs/debugfs/file.c | |
parent | b92be9f1ecd3c8b16e9bb22d55bb97b3d89f091a (diff) |
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.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 8d130cc85322..682f928b7f4d 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
19 | #include <linux/namei.h> | ||
19 | #include <linux/debugfs.h> | 20 | #include <linux/debugfs.h> |
20 | 21 | ||
21 | static ssize_t default_read_file(struct file *file, char __user *buf, | 22 | static ssize_t default_read_file(struct file *file, char __user *buf, |
@@ -44,6 +45,17 @@ const struct file_operations debugfs_file_operations = { | |||
44 | .open = default_open, | 45 | .open = default_open, |
45 | }; | 46 | }; |
46 | 47 | ||
48 | static void *debugfs_follow_link(struct dentry *dentry, struct nameidata *nd) | ||
49 | { | ||
50 | nd_set_link(nd, dentry->d_inode->i_private); | ||
51 | return NULL; | ||
52 | } | ||
53 | |||
54 | const struct inode_operations debugfs_link_operations = { | ||
55 | .readlink = generic_readlink, | ||
56 | .follow_link = debugfs_follow_link, | ||
57 | }; | ||
58 | |||
47 | static void debugfs_u8_set(void *data, u64 val) | 59 | static void debugfs_u8_set(void *data, u64 val) |
48 | { | 60 | { |
49 | *(u8 *)data = val; | 61 | *(u8 *)data = val; |