aboutsummaryrefslogtreecommitdiffstats
path: root/fs/affs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-09-27 05:03:57 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2016-09-27 05:03:57 -0400
commitf03b8ad8d38634d13e802165cc15917481b47835 (patch)
tree4dc9c060684f242d1e6c07d28d1ff625db63fd6c /fs/affs
parent9a232de4999666b2e8ea6775b2b0e3e4feb09b7a (diff)
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>
Diffstat (limited to 'fs/affs')
-rw-r--r--fs/affs/affs.h3
-rw-r--r--fs/affs/dir.c2
-rw-r--r--fs/affs/namei.c6
3 files changed, 8 insertions, 3 deletions
diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index cc2b2efc9211..2f088773f1c0 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -173,7 +173,8 @@ extern int affs_link(struct dentry *olddentry, struct inode *dir,
173extern int affs_symlink(struct inode *dir, struct dentry *dentry, 173extern int affs_symlink(struct inode *dir, struct dentry *dentry,
174 const char *symname); 174 const char *symname);
175extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry, 175extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry,
176 struct inode *new_dir, struct dentry *new_dentry); 176 struct inode *new_dir, struct dentry *new_dentry,
177 unsigned int flags);
177 178
178/* inode.c */ 179/* inode.c */
179 180
diff --git a/fs/affs/dir.c b/fs/affs/dir.c
index f1e7294381c5..8f127c239472 100644
--- a/fs/affs/dir.c
+++ b/fs/affs/dir.c
@@ -35,7 +35,7 @@ const struct inode_operations affs_dir_inode_operations = {
35 .symlink = affs_symlink, 35 .symlink = affs_symlink,
36 .mkdir = affs_mkdir, 36 .mkdir = affs_mkdir,
37 .rmdir = affs_rmdir, 37 .rmdir = affs_rmdir,
38 .rename = affs_rename, 38 .rename2 = affs_rename,
39 .setattr = affs_notify_change, 39 .setattr = affs_notify_change,
40}; 40};
41 41
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index a2d68f828d53..29186d29a3b6 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -414,12 +414,16 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
414 414
415int 415int
416affs_rename(struct inode *old_dir, struct dentry *old_dentry, 416affs_rename(struct inode *old_dir, struct dentry *old_dentry,
417 struct inode *new_dir, struct dentry *new_dentry) 417 struct inode *new_dir, struct dentry *new_dentry,
418 unsigned int flags)
418{ 419{
419 struct super_block *sb = old_dir->i_sb; 420 struct super_block *sb = old_dir->i_sb;
420 struct buffer_head *bh = NULL; 421 struct buffer_head *bh = NULL;
421 int retval; 422 int retval;
422 423
424 if (flags & ~RENAME_NOREPLACE)
425 return -EINVAL;
426
423 pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__, 427 pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__,
424 old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry); 428 old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry);
425 429