@@ -4659,12 +4659,22 @@ out:
return len;
}
-/*
- * A helper for ->readlink(). This should be used *ONLY* for symlinks that
- * have ->get_link() not calling nd_jump_link(). Using (or not using) it
- * for any given inode is up to filesystem.
+/**
+ * vfs_readlink - read symlink body
+ * @dentry: read symlink from this dentry
+ * @buffer: userspace buffer
+ * @buflen: size of userspace buffer
+ *
+ * Copy contents of symlink to userspace buffer. If the buffer is smaller than
+ * the length of the symlink, then the symlink is truncated. On success the
+ * function returns the number of bytes actually copied to the buffer. The
+ * terminating null character is never copied.
+ *
+ * The inode's access time is not updated. That's up to the caller if
+ * necessary. The caller also needs to make sure that i_op->get_link is
+ * non-NULL before calling this helper.
*/
-int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen)
+int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
{
DEFINE_DELAYED_CALL(done);
struct inode *inode = d_inode(dentry);
@@ -4684,7 +4694,7 @@ int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen)
do_delayed_call(&done);
return res;
}
-EXPORT_SYMBOL(generic_readlink);
+EXPORT_SYMBOL(vfs_readlink);
/* get the link contents into pagecache */
const char *page_get_link(struct dentry *dentry, struct inode *inode,
@@ -2895,7 +2895,6 @@ extern int __page_symlink(struct inode *inode, const char *symname, int len,
extern int page_symlink(struct inode *inode, const char *symname, int len);
extern const struct inode_operations page_symlink_inode_operations;
extern void kfree_link(void *);
-extern int generic_readlink(struct dentry *, char __user *, int);
extern void generic_fillattr(struct inode *, struct kstat *);
int vfs_getattr_nosec(struct path *path, struct kstat *stat);
extern int vfs_getattr(struct path *, struct kstat *);
@@ -2916,11 +2915,7 @@ extern int vfs_lstat(const char __user *, struct kstat *);
extern int vfs_fstat(unsigned int, struct kstat *);
extern int vfs_fstatat(int , const char __user *, struct kstat *, int);
-static inline int vfs_readlink(struct dentry *dentry, char __user *buffer,
- int buflen)
-{
- return generic_readlink(dentry, buffer, buflen);
-}
+extern int vfs_readlink(struct dentry *, char __user *, int);
extern int __generic_block_fiemap(struct inode *inode,
struct fiemap_extent_info *fieinfo,
Which is now known as vfs_readlink(). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> --- fs/namei.c | 22 ++++++++++++++++------ include/linux/fs.h | 7 +------ 2 files changed, 17 insertions(+), 12 deletions(-)