1
2
3
4
5
6
7
8
9
10
11
12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
14#include <linux/kernel.h>
15#include <linux/fs.h>
16#include <linux/namei.h>
17#include "nodelist.h"
18
19static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd);
20
21const struct inode_operations jffs2_symlink_inode_operations =
22{
23 .readlink = generic_readlink,
24 .follow_link = jffs2_follow_link,
25 .get_acl = jffs2_get_acl,
26 .setattr = jffs2_setattr,
27 .setxattr = jffs2_setxattr,
28 .getxattr = jffs2_getxattr,
29 .listxattr = jffs2_listxattr,
30 .removexattr = jffs2_removexattr
31};
32
33static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd)
34{
35 struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode);
36 char *p = (char *)f->target;
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 if (!p) {
52 pr_err("%s(): can't find symlink target\n", __func__);
53 p = ERR_PTR(-EIO);
54 }
55 jffs2_dbg(1, "%s(): target path is '%s'\n",
56 __func__, (char *)f->target);
57
58 nd_set_link(nd, p);
59
60
61
62
63
64
65 return NULL;
66}
67
68