[14/17] vfs: remove unused generic_readlink()
diff mbox

Message ID 1473708559-12714-15-git-send-email-mszeredi@redhat.com
State New
Headers show

Commit Message

Miklos Szeredi Sept. 12, 2016, 7:29 p.m. UTC
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(-)

Patch
diff mbox

diff --git a/fs/namei.c b/fs/namei.c
index a93424178634..76d1f061de3c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 31e940cb7a4f..f71e70e3017b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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,