Skip to content

Commit c618402

Browse files
Fabian FrederickAl Viro
authored andcommitted
fs/affs: add rename2 to prepare multiple methods
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>
1 parent deccf49 commit c618402

3 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎fs/affs/affs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ extern int affs_link(struct dentry *olddentry, struct inode *dir,
173173
struct dentry *dentry);
174174
extern int affs_symlink(struct inode *dir, struct dentry *dentry,
175175
const char *symname);
176-
extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry,
176+
extern int affs_rename2(struct inode *old_dir, struct dentry *old_dentry,
177177
struct inode *new_dir, struct dentry *new_dentry,
178178
unsigned int flags);
179179

‎fs/affs/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const struct inode_operations affs_dir_inode_operations = {
3535
.symlink = affs_symlink,
3636
.mkdir = affs_mkdir,
3737
.rmdir = affs_rmdir,
38-
.rename = affs_rename,
38+
.rename = affs_rename2,
3939
.setattr = affs_notify_change,
4040
};
4141

‎fs/affs/namei.c‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -394,21 +394,14 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
394394
return affs_add_entry(dir, inode, dentry, ST_LINKFILE);
395395
}
396396

397-
int
397+
static int
398398
affs_rename(struct inode *old_dir, struct dentry *old_dentry,
399-
struct inode *new_dir, struct dentry *new_dentry,
400-
unsigned int flags)
399+
struct inode *new_dir, struct dentry *new_dentry)
401400
{
402401
struct super_block *sb = old_dir->i_sb;
403402
struct buffer_head *bh = NULL;
404403
int retval;
405404

406-
if (flags & ~RENAME_NOREPLACE)
407-
return -EINVAL;
408-
409-
pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__,
410-
old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry);
411-
412405
retval = affs_check_name(new_dentry->d_name.name,
413406
new_dentry->d_name.len,
414407
affs_nofilenametruncate(old_dentry));
@@ -448,6 +441,20 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
448441
return retval;
449442
}
450443

444+
int affs_rename2(struct inode *old_dir, struct dentry *old_dentry,
445+
struct inode *new_dir, struct dentry *new_dentry,
446+
unsigned int flags)
447+
{
448+
449+
if (flags & ~RENAME_NOREPLACE)
450+
return -EINVAL;
451+
452+
pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__,
453+
old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry);
454+
455+
return affs_rename(old_dir, old_dentry, new_dir, new_dentry);
456+
}
457+
451458
static struct dentry *affs_get_parent(struct dentry *child)
452459
{
453460
struct inode *parent;

0 commit comments

Comments
 (0)