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>
13 #include <linux/lustre_idl.h>
15 #include "smfs_internal.h"
17 static int smfs_readlink(struct dentry * dentry, char * buffer, int buflen)
19 struct inode *cache_inode = I2CI(dentry->d_inode);
20 struct inode *cache_dir = NULL;
21 struct dentry *cache_dentry;
27 if (dentry->d_parent && dentry->d_parent->d_inode){
28 cache_dir = I2CI(dentry->d_parent->d_inode);
29 prepare_parent_dentry(&parent, cache_dir);
31 cache_dentry = d_alloc(&parent, &dentry->d_name);
32 d_add(cache_dentry, cache_inode);
35 if (cache_inode->i_op && cache_inode->i_op->readlink)
36 rc = cache_inode->i_op->readlink(cache_dentry, buffer, buflen);
38 d_unalloc(cache_dentry);
42 static int smfs_follow_link(struct dentry *dentry, struct nameidata *nd)
44 struct inode *cache_inode = I2CI(dentry->d_inode);
45 struct inode *cache_dir = NULL;
46 struct dentry *cache_dentry;
52 if (dentry->d_parent && dentry->d_parent->d_inode){
53 cache_dir = I2CI(dentry->d_parent->d_inode);
54 prepare_parent_dentry(&parent, cache_dir);
57 cache_dentry = d_alloc(&parent, &dentry->d_name);
59 d_add(cache_dentry, cache_inode);
62 if (cache_inode->i_op && cache_inode->i_op->follow_link)
63 rc = cache_inode->i_op->follow_link(cache_dentry, nd);
65 d_unalloc(cache_dentry);
68 struct inode_operations smfs_sym_iops = {
69 readlink: smfs_readlink,
70 follow_link: smfs_follow_link,
71 setxattr: smfs_setxattr, /* BKL held */
72 getxattr: smfs_getxattr, /* BKL held */
73 listxattr: smfs_listxattr, /* BKL held */
74 removexattr: smfs_removexattr, /* BKL held */
77 struct file_operations smfs_sym_fops = {