fs: support RENAME_NOREPLACE for local filesystems
This is trivial to do: - add flags argument to foo_rename() - check if flags doesn't have any other than RENAME_NOREPLACE - assign foo_rename() to .rename2 instead of .rename Filesystems converted: affs, bfs, exofs, ext2, hfs, hfsplus, jffs2, jfs, logfs, minix, msdos, nilfs2, omfs, reiserfs, sysvfs, ubifs, udf, ufs, vfat. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Acked-by: Boaz Harrosh <ooo@electrozaur.com> Acked-by: Richard Weinberger <richard@nod.at> Acked-by: Bob Copeland <me@bobcopeland.com> Acked-by: Jan Kara <jack@suse.cz> Cc: Theodore Ts'o <tytso@mit.edu> Cc: Jaegeuk Kim <jaegeuk@kernel.org> Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Cc: Mikulas Patocka <mpatocka@redhat.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Dave Kleikamp <shaggy@kernel.org> Cc: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Cc: Christoph Hellwig <hch@infradead.org>
This commit is contained in:
@@ -185,7 +185,8 @@ static int minix_rmdir(struct inode * dir, struct dentry *dentry)
|
||||
}
|
||||
|
||||
static int minix_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 inode * old_inode = d_inode(old_dentry);
|
||||
struct inode * new_inode = d_inode(new_dentry);
|
||||
@@ -195,6 +196,9 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
|
||||
struct minix_dir_entry * old_de;
|
||||
int err = -ENOENT;
|
||||
|
||||
if (flags & ~RENAME_NOREPLACE)
|
||||
return -EINVAL;
|
||||
|
||||
old_de = minix_find_entry(old_dentry, &old_page);
|
||||
if (!old_de)
|
||||
goto out;
|
||||
@@ -264,7 +268,7 @@ const struct inode_operations minix_dir_inode_operations = {
|
||||
.mkdir = minix_mkdir,
|
||||
.rmdir = minix_rmdir,
|
||||
.mknod = minix_mknod,
|
||||
.rename = minix_rename,
|
||||
.rename2 = minix_rename,
|
||||
.getattr = minix_getattr,
|
||||
.tmpfile = minix_tmpfile,
|
||||
};
|
||||
|
Reference in New Issue
Block a user