6 #define DEBUG_SUBSYSTEM S_SNAP
8 #include <linux/kmod.h>
9 #include <linux/init.h>
11 #include <linux/slab.h>
12 #include <linux/string.h>
14 #include "smfs_internal.h"
16 static int smfs_readlink(struct dentry * dentry, char * buffer, int buflen)
18 struct inode *cache_inode = I2CI(dentry->d_inode);
19 struct dentry cache_dentry;
25 smfs_prepare_dentry(&cache_dentry, NULL, &dentry->d_name);
26 d_add(&cache_dentry, cache_inode);
28 if (cache_inode->i_op && cache_inode->i_op->readlink)
29 rc = cache_inode->i_op->readlink(&cache_dentry, buffer, buflen);
31 smfs_clear_dentry(&cache_dentry);
35 static int smfs_follow_link(struct dentry *dentry, struct nameidata *nd)
37 struct inode *cache_inode = I2CI(dentry->d_inode);
38 struct dentry cache_dentry;
43 smfs_prepare_dentry(&cache_dentry, NULL, &dentry->d_name);
44 d_add(&cache_dentry, cache_inode);
46 if (cache_inode->i_op && cache_inode->i_op->follow_link)
47 rc = cache_inode->i_op->follow_link(&cache_dentry, nd);
49 smfs_clear_dentry(&cache_dentry);
53 struct inode_operations smfs_sym_iops = {
54 readlink: smfs_readlink,
55 follow_link: smfs_follow_link,
56 setxattr: smfs_setxattr, /* BKL held */
57 getxattr: smfs_getxattr, /* BKL held */
58 listxattr: smfs_listxattr, /* BKL held */
59 removexattr: smfs_removexattr, /* BKL held */
62 struct file_operations smfs_sym_fops = {