aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus
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/hfsplus
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/hfsplus')
-rw-r--r--fs/hfsplus/dir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 42e128661dc1..ca64a75f12b3 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -530,10 +530,14 @@ static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
530} 530}
531 531
532static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry, 532static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry,
533 struct inode *new_dir, struct dentry *new_dentry) 533 struct inode *new_dir, struct dentry *new_dentry,
534 unsigned int flags)
534{ 535{
535 int res; 536 int res;
536 537
538 if (flags & ~RENAME_NOREPLACE)
539 return -EINVAL;
540
537 /* Unlink destination if it already exists */ 541 /* Unlink destination if it already exists */
538 if (d_really_is_positive(new_dentry)) { 542 if (d_really_is_positive(new_dentry)) {
539 if (d_is_dir(new_dentry)) 543 if (d_is_dir(new_dentry))
@@ -561,7 +565,7 @@ const struct inode_operations hfsplus_dir_inode_operations = {
561 .rmdir = hfsplus_rmdir, 565 .rmdir = hfsplus_rmdir,
562 .symlink = hfsplus_symlink, 566 .symlink = hfsplus_symlink,
563 .mknod = hfsplus_mknod, 567 .mknod = hfsplus_mknod,
564 .rename = hfsplus_rename, 568 .rename2 = hfsplus_rename,
565 .setxattr = generic_setxattr, 569 .setxattr = generic_setxattr,
566 .getxattr = generic_getxattr, 570 .getxattr = generic_getxattr,
567 .listxattr = hfsplus_listxattr, 571 .listxattr = hfsplus_listxattr,