summaryrefslogtreecommitdiffstats
path: root/fs/ufs/namei.c
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/ufs/namei.c
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/ufs/namei.c')
-rw-r--r--fs/ufs/namei.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index a1559f762805..719c9c9b83d8 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -245,7 +245,8 @@ static int ufs_rmdir (struct inode * dir, struct dentry *dentry)
245} 245}
246 246
247static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, 247static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
248 struct inode *new_dir, struct dentry *new_dentry) 248 struct inode *new_dir, struct dentry *new_dentry,
249 unsigned int flags)
249{ 250{
250 struct inode *old_inode = d_inode(old_dentry); 251 struct inode *old_inode = d_inode(old_dentry);
251 struct inode *new_inode = d_inode(new_dentry); 252 struct inode *new_inode = d_inode(new_dentry);
@@ -255,6 +256,9 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
255 struct ufs_dir_entry *old_de; 256 struct ufs_dir_entry *old_de;
256 int err = -ENOENT; 257 int err = -ENOENT;
257 258
259 if (flags & ~RENAME_NOREPLACE)
260 return -EINVAL;
261
258 old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); 262 old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page);
259 if (!old_de) 263 if (!old_de)
260 goto out; 264 goto out;
@@ -333,5 +337,5 @@ const struct inode_operations ufs_dir_inode_operations = {
333 .mkdir = ufs_mkdir, 337 .mkdir = ufs_mkdir,
334 .rmdir = ufs_rmdir, 338 .rmdir = ufs_rmdir,
335 .mknod = ufs_mknod, 339 .mknod = ufs_mknod,
336 .rename = ufs_rename, 340 .rename2 = ufs_rename,
337}; 341};