vfs: remove unused i_op->rename
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 27 Sep 2016 09:03:58 +0000 (11:03 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Tue, 27 Sep 2016 09:03:58 +0000 (11:03 +0200)
No in-tree uses remain.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Documentation/filesystems/Locking
Documentation/filesystems/directory-locking
Documentation/filesystems/vfs.txt
fs/cachefiles/namei.c
fs/namei.c
include/linux/fs.h
security/tomoyo/realpath.c

index d30fb2c..da320bc 100644 (file)
@@ -50,8 +50,6 @@ prototypes:
        int (*mkdir) (struct inode *,struct dentry *,umode_t);
        int (*rmdir) (struct inode *,struct dentry *);
        int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
        int (*mkdir) (struct inode *,struct dentry *,umode_t);
        int (*rmdir) (struct inode *,struct dentry *);
        int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
-       int (*rename) (struct inode *, struct dentry *,
-                       struct inode *, struct dentry *);
        int (*rename2) (struct inode *, struct dentry *,
                        struct inode *, struct dentry *, unsigned int);
        int (*readlink) (struct dentry *, char __user *,int);
        int (*rename2) (struct inode *, struct dentry *,
                        struct inode *, struct dentry *, unsigned int);
        int (*readlink) (struct dentry *, char __user *,int);
@@ -83,7 +81,6 @@ symlink:      yes
 mkdir:         yes
 unlink:                yes (both)
 rmdir:         yes (both)      (see below)
 mkdir:         yes
 unlink:                yes (both)
 rmdir:         yes (both)      (see below)
-rename:                yes (all)       (see below)
 rename2:       yes (all)       (see below)
 readlink:      no
 get_link:      no
 rename2:       yes (all)       (see below)
 readlink:      no
 get_link:      no
@@ -102,8 +99,7 @@ tmpfile:     no
 
        Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
 victim.
 
        Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
 victim.
-       cross-directory ->rename() and rename2() has (per-superblock)
-->s_vfs_rename_sem.
+       cross-directory ->rename2() has (per-superblock) ->s_vfs_rename_sem.
 
 See Documentation/filesystems/directory-locking for more detailed discussion
 of the locking scheme for directory operations.
 
 See Documentation/filesystems/directory-locking for more detailed discussion
 of the locking scheme for directory operations.
index c314bad..4e32cb9 100644 (file)
@@ -19,7 +19,7 @@ locks victim and calls the method.  Locks are exclusive.
 
 4) rename() that is _not_ cross-directory.  Locking rules: caller locks
 the parent and finds source and target.  In case of exchange (with
 
 4) rename() that is _not_ cross-directory.  Locking rules: caller locks
 the parent and finds source and target.  In case of exchange (with
-RENAME_EXCHANGE in rename2() flags argument) lock both.  In any case,
+RENAME_EXCHANGE in flags argument) lock both.  In any case,
 if the target already exists, lock it.  If the source is a non-directory,
 lock it.  If we need to lock both, lock them in inode pointer order.
 Then call the method.  All locks are exclusive.
 if the target already exists, lock it.  If the source is a non-directory,
 lock it.  If we need to lock both, lock them in inode pointer order.
 Then call the method.  All locks are exclusive.
index 9ace359..c641e0c 100644 (file)
@@ -345,8 +345,6 @@ struct inode_operations {
        int (*mkdir) (struct inode *,struct dentry *,umode_t);
        int (*rmdir) (struct inode *,struct dentry *);
        int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
        int (*mkdir) (struct inode *,struct dentry *,umode_t);
        int (*rmdir) (struct inode *,struct dentry *);
        int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
-       int (*rename) (struct inode *, struct dentry *,
-                       struct inode *, struct dentry *);
        int (*rename2) (struct inode *, struct dentry *,
                        struct inode *, struct dentry *, unsigned int);
        int (*readlink) (struct dentry *, char __user *,int);
        int (*rename2) (struct inode *, struct dentry *,
                        struct inode *, struct dentry *, unsigned int);
        int (*readlink) (struct dentry *, char __user *,int);
@@ -416,11 +414,8 @@ otherwise noted.
   rename: called by the rename(2) system call to rename the object to
        have the parent and name given by the second inode and dentry.
 
   rename: called by the rename(2) system call to rename the object to
        have the parent and name given by the second inode and dentry.
 
-  rename2: this has an additional flags argument compared to rename.
-       If no flags are supported by the filesystem then this method
-       need not be implemented.  If some flags are supported then the
-       filesystem must return -EINVAL for any unsupported or unknown
-       flags.  Currently the following flags are implemented:
+       The filesystem must return -EINVAL for any unsupported or
+       unknown flags.  Currently the following flags are implemented:
        (1) RENAME_NOREPLACE: this flag indicates that if the target
        of the rename exists the rename should fail with -EEXIST
        instead of replacing the target.  The VFS already checks for
        (1) RENAME_NOREPLACE: this flag indicates that if the target
        of the rename exists the rename should fail with -EEXIST
        instead of replacing the target.  The VFS already checks for
index 3f7c2cd..02e1507 100644 (file)
@@ -804,8 +804,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
            !d_backing_inode(subdir)->i_op->lookup ||
            !d_backing_inode(subdir)->i_op->mkdir ||
            !d_backing_inode(subdir)->i_op->create ||
            !d_backing_inode(subdir)->i_op->lookup ||
            !d_backing_inode(subdir)->i_op->mkdir ||
            !d_backing_inode(subdir)->i_op->create ||
-           (!d_backing_inode(subdir)->i_op->rename &&
-            !d_backing_inode(subdir)->i_op->rename2) ||
+           !d_backing_inode(subdir)->i_op->rename2 ||
            !d_backing_inode(subdir)->i_op->rmdir ||
            !d_backing_inode(subdir)->i_op->unlink)
                goto check_error;
            !d_backing_inode(subdir)->i_op->rmdir ||
            !d_backing_inode(subdir)->i_op->unlink)
                goto check_error;
index adb0414..02803bd 100644 (file)
@@ -4369,12 +4369,9 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        if (error)
                return error;
 
        if (error)
                return error;
 
-       if (!old_dir->i_op->rename && !old_dir->i_op->rename2)
+       if (!old_dir->i_op->rename2)
                return -EPERM;
 
                return -EPERM;
 
-       if (flags && !old_dir->i_op->rename2)
-               return -EINVAL;
-
        /*
         * If we are going to change the parent - check write permissions,
         * we'll need to flip '..'.
        /*
         * If we are going to change the parent - check write permissions,
         * we'll need to flip '..'.
@@ -4428,14 +4425,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                if (error)
                        goto out;
        }
                if (error)
                        goto out;
        }
-       if (!old_dir->i_op->rename2) {
-               error = old_dir->i_op->rename(old_dir, old_dentry,
-                                             new_dir, new_dentry);
-       } else {
-               WARN_ON(old_dir->i_op->rename != NULL);
-               error = old_dir->i_op->rename2(old_dir, old_dentry,
-                                              new_dir, new_dentry, flags);
-       }
+       error = old_dir->i_op->rename2(old_dir, old_dentry,
+                                      new_dir, new_dentry, flags);
        if (error)
                goto out;
 
        if (error)
                goto out;
 
index 2bd6754..6b14ceb 100644 (file)
@@ -1732,8 +1732,6 @@ struct inode_operations {
        int (*mkdir) (struct inode *,struct dentry *,umode_t);
        int (*rmdir) (struct inode *,struct dentry *);
        int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
        int (*mkdir) (struct inode *,struct dentry *,umode_t);
        int (*rmdir) (struct inode *,struct dentry *);
        int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
-       int (*rename) (struct inode *, struct dentry *,
-                       struct inode *, struct dentry *);
        int (*rename2) (struct inode *, struct dentry *,
                        struct inode *, struct dentry *, unsigned int);
        int (*setattr) (struct dentry *, struct iattr *);
        int (*rename2) (struct inode *, struct dentry *,
                        struct inode *, struct dentry *, unsigned int);
        int (*setattr) (struct dentry *, struct iattr *);
index 5077f19..38bcdbc 100644 (file)
@@ -173,7 +173,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer,
                 * Use filesystem name if filesystem does not support rename()
                 * operation.
                 */
                 * Use filesystem name if filesystem does not support rename()
                 * operation.
                 */
-               if (!inode->i_op->rename && !inode->i_op->rename2)
+               if (!inode->i_op->rename2)
                        goto prepend_filesystem_name;
        }
        /* Prepend device name. */
                        goto prepend_filesystem_name;
        }
        /* Prepend device name. */
@@ -283,7 +283,7 @@ char *tomoyo_realpath_from_path(const struct path *path)
                 * or dentry without vfsmount.
                 */
                if (!path->mnt ||
                 * or dentry without vfsmount.
                 */
                if (!path->mnt ||
-                   (!inode->i_op->rename && !inode->i_op->rename2))
+                   (!inode->i_op->rename2))
                        pos = tomoyo_get_local_path(path->dentry, buf,
                                                    buf_len - 1);
                /* Get absolute name for the rest. */
                        pos = tomoyo_get_local_path(path->dentry, buf,
                                                    buf_len - 1);
                /* Get absolute name for the rest. */