@@ -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)
@@ -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.
@@ -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).
@@ -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 *);
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@redhat.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(-)