X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Fafs%2FLINUX%2Fosi_vnodeops.c;h=e115ae4f8f772a2166effef19fa1b2740446f4fa;hp=3da1aa684473eb3b81b41596203e75860d030b86;hb=2d18bd1777b8d18a3b855685928dcdafcbe609b8;hpb=9943fe1fd71fc29331dcac7cd6a51bd37f307876 diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 3da1aa6..e115ae4 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1317,7 +1317,7 @@ afs_linux_ireadlink(struct inode *ip, char *target, int maxlen, uio_seg_t seg) return -code; } -#if !defined(AFS_LINUX24_ENV) +#if !defined(USABLE_KERNEL_PAGE_SYMLINK_CACHE) /* afs_linux_readlink * Fill target (which is in user space) with contents of symlink. */ @@ -1337,6 +1337,36 @@ afs_linux_readlink(struct dentry *dp, char *target, int maxlen) /* afs_linux_follow_link * a file system dependent link following routine. */ +#if defined(AFS_LINUX24_ENV) +static int afs_linux_follow_link(struct dentry *dentry, struct nameidata *nd) +{ + int code; + char *name; + + name = osi_Alloc(PATH_MAX); + if (!name) { + return -EIO; + } + + AFS_GLOCK(); + code = afs_linux_ireadlink(dentry->d_inode, name, PATH_MAX - 1, AFS_UIOSYS); + AFS_GUNLOCK(); + + if (code < 0) { + goto out; + } + + name[code] = '\0'; + code = vfs_follow_link(nd, name); + +out: + osi_Free(name, PATH_MAX); + + return code; +} + +#else /* !defined(AFS_LINUX24_ENV) */ + static struct dentry * afs_linux_follow_link(struct dentry *dp, struct dentry *basep, unsigned int follow) @@ -1370,7 +1400,8 @@ afs_linux_follow_link(struct dentry *dp, struct dentry *basep, AFS_GUNLOCK(); return res; } -#endif +#endif /* AFS_LINUX24_ENV */ +#endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */ /* afs_linux_readpage * all reads come through here. A strategy-like read call. @@ -1735,7 +1766,7 @@ static struct inode_operations afs_dir_iops = { /* We really need a separate symlink set of ops, since do_follow_link() * determines if it _is_ a link by checking if the follow_link op is set. */ -#if defined(AFS_LINUX24_ENV) +#if defined(USABLE_KERNEL_PAGE_SYMLINK_CACHE) static int afs_symlink_filler(struct file *file, struct page *page) { @@ -1770,10 +1801,10 @@ afs_symlink_filler(struct file *file, struct page *page) static struct address_space_operations afs_symlink_aops = { .readpage = afs_symlink_filler }; -#endif +#endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */ static struct inode_operations afs_symlink_iops = { -#if defined(AFS_LINUX24_ENV) +#if defined(USABLE_KERNEL_PAGE_SYMLINK_CACHE) .readlink = page_readlink, #if defined(HAVE_KERNEL_PAGE_FOLLOW_LINK) .follow_link = page_follow_link, @@ -1781,13 +1812,17 @@ static struct inode_operations afs_symlink_iops = { .follow_link = page_follow_link_light, .put_link = page_put_link, #endif - .setattr = afs_notify_change, -#else +#else /* !defined(USABLE_KERNEL_PAGE_SYMLINK_CACHE) */ .readlink = afs_linux_readlink, .follow_link = afs_linux_follow_link, +#if !defined(AFS_LINUX24_ENV) .permission = afs_linux_permission, .revalidate = afs_linux_revalidate, #endif +#endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */ +#if defined(AFS_LINUX24_ENV) + .setattr = afs_notify_change, +#endif }; void @@ -1813,7 +1848,7 @@ afs_fill_inode(struct inode *ip, struct vattr *vattr) } else if (S_ISLNK(ip->i_mode)) { ip->i_op = &afs_symlink_iops; -#if defined(AFS_LINUX24_ENV) +#if defined(USABLE_KERNEL_PAGE_SYMLINK_CACHE) ip->i_data.a_ops = &afs_symlink_aops; ip->i_mapping = &ip->i_data; #endif