diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-27 05:03:57 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-27 05:03:57 -0400 |
commit | f03b8ad8d38634d13e802165cc15917481b47835 (patch) | |
tree | 4dc9c060684f242d1e6c07d28d1ff625db63fd6c /fs/hpfs/namei.c | |
parent | 9a232de4999666b2e8ea6775b2b0e3e4feb09b7a (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/hpfs/namei.c')
-rw-r--r-- | fs/hpfs/namei.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index bb8d67e2740a..3c5c1a75569d 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c | |||
@@ -507,7 +507,8 @@ const struct address_space_operations hpfs_symlink_aops = { | |||
507 | }; | 507 | }; |
508 | 508 | ||
509 | static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 509 | static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
510 | struct inode *new_dir, struct dentry *new_dentry) | 510 | struct inode *new_dir, struct dentry *new_dentry, |
511 | unsigned int flags) | ||
511 | { | 512 | { |
512 | const unsigned char *old_name = old_dentry->d_name.name; | 513 | const unsigned char *old_name = old_dentry->d_name.name; |
513 | unsigned old_len = old_dentry->d_name.len; | 514 | unsigned old_len = old_dentry->d_name.len; |
@@ -524,6 +525,9 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
524 | struct fnode *fnode; | 525 | struct fnode *fnode; |
525 | int err; | 526 | int err; |
526 | 527 | ||
528 | if (flags & ~RENAME_NOREPLACE) | ||
529 | return -EINVAL; | ||
530 | |||
527 | if ((err = hpfs_chk_name(new_name, &new_len))) return err; | 531 | if ((err = hpfs_chk_name(new_name, &new_len))) return err; |
528 | err = 0; | 532 | err = 0; |
529 | hpfs_adjust_length(old_name, &old_len); | 533 | hpfs_adjust_length(old_name, &old_len); |
@@ -618,6 +622,6 @@ const struct inode_operations hpfs_dir_iops = | |||
618 | .mkdir = hpfs_mkdir, | 622 | .mkdir = hpfs_mkdir, |
619 | .rmdir = hpfs_rmdir, | 623 | .rmdir = hpfs_rmdir, |
620 | .mknod = hpfs_mknod, | 624 | .mknod = hpfs_mknod, |
621 | .rename = hpfs_rename, | 625 | .rename2 = hpfs_rename, |
622 | .setattr = hpfs_setattr, | 626 | .setattr = hpfs_setattr, |
623 | }; | 627 | }; |