fs/affs: add rename2 to prepare multiple methods
authorFabian Frederick <fabf@skynet.be>
Fri, 5 May 2017 18:51:42 +0000 (20:51 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 5 May 2017 19:24:52 +0000 (15:24 -0400)
Currently AFFS only supports RENAME_NOREPLACE.
This patch isolates that method to a static function to
prepare RENAME_EXCHANGE addition.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/affs/affs.h
fs/affs/dir.c
fs/affs/namei.c

index ba26a316f46efa52b8648586db0fe98f56f513b9..773749be8290cb782324d341865861a2e64d199a 100644 (file)
@@ -173,7 +173,7 @@ extern int  affs_link(struct dentry *olddentry, struct inode *dir,
                          struct dentry *dentry);
 extern int     affs_symlink(struct inode *dir, struct dentry *dentry,
                             const char *symname);
-extern int     affs_rename(struct inode *old_dir, struct dentry *old_dentry,
+extern int     affs_rename2(struct inode *old_dir, struct dentry *old_dentry,
                            struct inode *new_dir, struct dentry *new_dentry,
                            unsigned int flags);
 
index f1e7294381c5aa48a386a3a7c0db7f4832c568ec..591ecd7f3063731d0eebe1435714e0be3949d455 100644 (file)
@@ -35,7 +35,7 @@ const struct inode_operations affs_dir_inode_operations = {
        .symlink        = affs_symlink,
        .mkdir          = affs_mkdir,
        .rmdir          = affs_rmdir,
-       .rename         = affs_rename,
+       .rename         = affs_rename2,
        .setattr        = affs_notify_change,
 };
 
index d9a40b5ca4d397564300bb73c5ab941b035f7735..49a8dc12d60434c2395b15a8553c8d8f2eef0ac0 100644 (file)
@@ -394,21 +394,14 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
        return affs_add_entry(dir, inode, dentry, ST_LINKFILE);
 }
 
-int
+static int
 affs_rename(struct inode *old_dir, struct dentry *old_dentry,
-           struct inode *new_dir, struct dentry *new_dentry,
-           unsigned int flags)
+           struct inode *new_dir, struct dentry *new_dentry)
 {
        struct super_block *sb = old_dir->i_sb;
        struct buffer_head *bh = NULL;
        int retval;
 
-       if (flags & ~RENAME_NOREPLACE)
-               return -EINVAL;
-
-       pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__,
-                old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry);
-
        retval = affs_check_name(new_dentry->d_name.name,
                                 new_dentry->d_name.len,
                                 affs_nofilenametruncate(old_dentry));
@@ -448,6 +441,20 @@ done:
        return retval;
 }
 
+int affs_rename2(struct inode *old_dir, struct dentry *old_dentry,
+                       struct inode *new_dir, struct dentry *new_dentry,
+                       unsigned int flags)
+{
+
+       if (flags & ~RENAME_NOREPLACE)
+               return -EINVAL;
+
+       pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__,
+                old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry);
+
+       return affs_rename(old_dir, old_dentry, new_dir, new_dentry);
+}
+
 static struct dentry *affs_get_parent(struct dentry *child)
 {
        struct inode *parent;