aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/vfs_inode_dotl.c58
1 files changed, 22 insertions, 36 deletions
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index b6f3977545f7..b7f8dcbabdb2 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -755,30 +755,6 @@ error:
755 return err; 755 return err;
756} 756}
757 757
758static int
759v9fs_vfs_readlink_dotl(struct dentry *dentry, char *buffer, int buflen)
760{
761 int retval;
762 struct p9_fid *fid;
763 char *target = NULL;
764
765 P9_DPRINTK(P9_DEBUG_VFS, " %s\n", dentry->d_name.name);
766 retval = -EPERM;
767 fid = v9fs_fid_lookup(dentry);
768 if (IS_ERR(fid))
769 return PTR_ERR(fid);
770
771 retval = p9_client_readlink(fid, &target);
772 if (retval < 0)
773 return retval;
774
775 strncpy(buffer, target, buflen);
776 P9_DPRINTK(P9_DEBUG_VFS, "%s -> %s\n", dentry->d_name.name, buffer);
777
778 retval = strnlen(buffer, buflen);
779 return retval;
780}
781
782/** 758/**
783 * v9fs_vfs_follow_link_dotl - follow a symlink path 759 * v9fs_vfs_follow_link_dotl - follow a symlink path
784 * @dentry: dentry for symlink 760 * @dentry: dentry for symlink
@@ -789,23 +765,33 @@ v9fs_vfs_readlink_dotl(struct dentry *dentry, char *buffer, int buflen)
789static void * 765static void *
790v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd) 766v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd)
791{ 767{
792 int len = 0; 768 int retval;
769 struct p9_fid *fid;
793 char *link = __getname(); 770 char *link = __getname();
771 char *target;
794 772
795 P9_DPRINTK(P9_DEBUG_VFS, "%s n", dentry->d_name.name); 773 P9_DPRINTK(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
796 774
797 if (!link) 775 if (!link) {
798 link = ERR_PTR(-ENOMEM); 776 link = ERR_PTR(-ENOMEM);
799 else { 777 goto ndset;
800 len = v9fs_vfs_readlink_dotl(dentry, link, PATH_MAX);
801 if (len < 0) {
802 __putname(link);
803 link = ERR_PTR(len);
804 } else
805 link[min(len, PATH_MAX-1)] = 0;
806 } 778 }
779 fid = v9fs_fid_lookup(dentry);
780 if (IS_ERR(fid)) {
781 __putname(link);
782 link = ERR_PTR(PTR_ERR(fid));
783 goto ndset;
784 }
785 retval = p9_client_readlink(fid, &target);
786 if (!retval) {
787 strcpy(link, target);
788 kfree(target);
789 goto ndset;
790 }
791 __putname(link);
792 link = ERR_PTR(retval);
793ndset:
807 nd_set_link(nd, link); 794 nd_set_link(nd, link);
808
809 return NULL; 795 return NULL;
810} 796}
811 797
@@ -839,7 +825,7 @@ const struct inode_operations v9fs_file_inode_operations_dotl = {
839}; 825};
840 826
841const struct inode_operations v9fs_symlink_inode_operations_dotl = { 827const struct inode_operations v9fs_symlink_inode_operations_dotl = {
842 .readlink = v9fs_vfs_readlink_dotl, 828 .readlink = generic_readlink,
843 .follow_link = v9fs_vfs_follow_link_dotl, 829 .follow_link = v9fs_vfs_follow_link_dotl,
844 .put_link = v9fs_vfs_put_link, 830 .put_link = v9fs_vfs_put_link,
845 .getattr = v9fs_vfs_getattr_dotl, 831 .getattr = v9fs_vfs_getattr_dotl,