[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1473708559-12714-14-git-send-email-mszeredi@redhat.com>
Date: Mon, 12 Sep 2016 21:29:15 +0200
From: Miklos Szeredi <mszeredi@...hat.com>
To: linux-fsdevel@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>
Subject: [PATCH 13/17] vfs: remove unused i_op->readlink
This removes the iop->readlink method, which is now completely unused.
Documentation is updated and a note added to "porting".
Signed-off-by: Miklos Szeredi <mszeredi@...hat.com>
---
Documentation/filesystems/Locking | 2 --
Documentation/filesystems/porting | 15 +++++++++++++++
Documentation/filesystems/vfs.txt | 25 ++++++++++++-------------
include/linux/fs.h | 3 ---
4 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index d30fb2cb5066..1aa8894ef551 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -54,7 +54,6 @@ prototypes:
struct inode *, struct dentry *);
int (*rename2) (struct inode *, struct dentry *,
struct inode *, struct dentry *, unsigned int);
- int (*readlink) (struct dentry *, char __user *,int);
const char *(*get_link) (struct dentry *, struct inode *, void **);
void (*truncate) (struct inode *);
int (*permission) (struct inode *, int, unsigned int);
@@ -85,7 +84,6 @@ unlink: yes (both)
rmdir: yes (both) (see below)
rename: yes (all) (see below)
rename2: yes (all) (see below)
-readlink: no
get_link: no
setattr: yes
permission: no (may not block if called in rcu-walk mode)
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index b1bd05ea66b2..dcd2b77a9f90 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -592,3 +592,18 @@ in your dentry operations instead.
work just as well; if it's something more complicated, use dentry->d_parent.
Just be careful not to assume that fetching it more than once will yield
the same value - in RCU mode it could change under you.
+--
+[mandatory]
+ ->readlink() i_op is gone, all of its functionality taken over by
+ ->get_link(). If the filesystem set .readlink to generic_readlink,
+ then it doesn't need to do anything besides removing this
+ assignment.
+
+ In the unlikely case that ->get_link() calls nd_jump_link(), then
+ it needs to do that conditionally, only if is_following_link()
+ returns true. Otherwise it should return the string representation
+ of the symlink, as the old ->readlink() implementation did.
+
+ If the filesystem set .readlink but not .get_link, then it needs to
+ port the readlink implementation to the get_link interface and set
+ IOP_NOFOLLOW in inode->i_opflags to prevent following the symlink.
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 9ace359d6cc5..3914dc728151 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -349,7 +349,6 @@ struct inode_operations {
struct inode *, struct dentry *);
int (*rename2) (struct inode *, struct dentry *,
struct inode *, struct dentry *, unsigned int);
- int (*readlink) (struct dentry *, char __user *,int);
const char *(*get_link) (struct dentry *, struct inode *,
struct delayed_call *);
int (*permission) (struct inode *, int);
@@ -430,19 +429,19 @@ otherwise noted.
exist; this is checked by the VFS. Unlike plain rename,
source and target may be of different type.
- readlink: called by the readlink(2) system call. Only required if
- you want to support reading symbolic links
-
- get_link: called by the VFS to follow a symbolic link to the
+ get_link: called by the VFS to read or follow a symbolic link to the
inode it points to. Only required if you want to support
- symbolic links. This method returns the symlink body
- to traverse (and possibly resets the current position with
- nd_jump_link()). If the body won't go away until the inode
- is gone, nothing else is needed; if it needs to be otherwise
- pinned, arrange for its release by having get_link(..., ..., done)
- do set_delayed_call(done, destructor, argument).
- In that case destructor(argument) will be called once VFS is
- done with the body you've returned.
+ symbolic links. This method returns the symlink body (and if
+ is_following_link() is true, then possibly resets the current
+ position with nd_jump_link()).
+
+ If the body won't go away until the inode is gone, nothing else
+ is needed; if it needs to be otherwise pinned, arrange for its
+ release by having get_link(..., ..., done) do
+ set_delayed_call(done, destructor, argument). In that case
+ destructor(argument) will be called once VFS is done with the
+ body you've returned.
+
May be called in RCU mode; that is indicated by NULL dentry
argument. If request can't be handled without leaving RCU mode,
have it return ERR_PTR(-ECHILD).
diff --git a/include/linux/fs.h b/include/linux/fs.h
index bcb0bc774cb6..31e940cb7a4f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1722,9 +1722,6 @@ struct inode_operations {
const char * (*get_link) (struct dentry *, struct inode *, struct delayed_call *);
int (*permission) (struct inode *, int);
struct posix_acl * (*get_acl)(struct inode *, int);
-
- int (*readlink) (struct dentry *, char __user *,int);
-
int (*create) (struct inode *,struct dentry *, umode_t, bool);
int (*link) (struct dentry *,struct inode *,struct dentry *);
int (*unlink) (struct inode *,struct dentry *);
--
2.5.5
Powered by blists - more mailing lists