diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-27 11:03:57 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-27 11:03:57 +0200 |
commit | f03b8ad8d38634d13e802165cc15917481b47835 (patch) | |
tree | 4dc9c060684f242d1e6c07d28d1ff625db63fd6c /fs/bfs | |
parent | 9a232de4999666b2e8ea6775b2b0e3e4feb09b7a (diff) | |
download | linux-f03b8ad8d38634d13e802165cc15917481b47835.tar.gz linux-f03b8ad8d38634d13e802165cc15917481b47835.tar.bz2 linux-f03b8ad8d38634d13e802165cc15917481b47835.zip |
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/bfs')
-rw-r--r-- | fs/bfs/dir.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 34a5bc2f1290..9d5f875e85d0 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c @@ -207,7 +207,8 @@ out_brelse: } static int bfs_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, *new_inode; struct buffer_head *old_bh, *new_bh; @@ -215,6 +216,9 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct bfs_sb_info *info; int error = -ENOENT; + if (flags & ~RENAME_NOREPLACE) + return -EINVAL; + old_bh = new_bh = NULL; old_inode = d_inode(old_dentry); if (S_ISDIR(old_inode->i_mode)) @@ -270,7 +274,7 @@ const struct inode_operations bfs_dir_inops = { .lookup = bfs_lookup, .link = bfs_link, .unlink = bfs_unlink, - .rename = bfs_rename, + .rename2 = bfs_rename, }; static int bfs_add_entry(struct inode *dir, const unsigned char *name, |