Commit c6184028 authored by Fabian Frederick's avatar Fabian Frederick Committed by Al Viro

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: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent deccf497
...@@ -173,7 +173,7 @@ extern int affs_link(struct dentry *olddentry, struct inode *dir, ...@@ -173,7 +173,7 @@ extern int affs_link(struct dentry *olddentry, struct inode *dir,
struct dentry *dentry); struct dentry *dentry);
extern int affs_symlink(struct inode *dir, struct dentry *dentry, extern int affs_symlink(struct inode *dir, struct dentry *dentry,
const char *symname); 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, struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags); unsigned int flags);
......
...@@ -35,7 +35,7 @@ const struct inode_operations affs_dir_inode_operations = { ...@@ -35,7 +35,7 @@ const struct inode_operations affs_dir_inode_operations = {
.symlink = affs_symlink, .symlink = affs_symlink,
.mkdir = affs_mkdir, .mkdir = affs_mkdir,
.rmdir = affs_rmdir, .rmdir = affs_rmdir,
.rename = affs_rename, .rename = affs_rename2,
.setattr = affs_notify_change, .setattr = affs_notify_change,
}; };
......
...@@ -394,21 +394,14 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) ...@@ -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); return affs_add_entry(dir, inode, dentry, ST_LINKFILE);
} }
int static int
affs_rename(struct inode *old_dir, struct dentry *old_dentry, affs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry, struct inode *new_dir, struct dentry *new_dentry)
unsigned int flags)
{ {
struct super_block *sb = old_dir->i_sb; struct super_block *sb = old_dir->i_sb;
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
int retval; 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, retval = affs_check_name(new_dentry->d_name.name,
new_dentry->d_name.len, new_dentry->d_name.len,
affs_nofilenametruncate(old_dentry)); affs_nofilenametruncate(old_dentry));
...@@ -448,6 +441,20 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -448,6 +441,20 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
return retval; 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) static struct dentry *affs_get_parent(struct dentry *child)
{ {
struct inode *parent; struct inode *parent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment