mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 <[email protected]> Acked-by: Boaz Harrosh <[email protected]> Acked-by: Richard Weinberger <[email protected]> Acked-by: Bob Copeland <[email protected]> Acked-by: Jan Kara <[email protected]> Cc: Theodore Ts'o <[email protected]> Cc: Jaegeuk Kim <[email protected]> Cc: OGAWA Hirofumi <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Dave Kleikamp <[email protected]> Cc: Ryusuke Konishi <[email protected]> Cc: Christoph Hellwig <[email protected]>
This commit is contained in:
parent
9a232de499
commit
f03b8ad8d3
22 changed files with 123 additions and 42 deletions
|
|
@ -350,7 +350,8 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry)
|
|||
}
|
||||
|
||||
static int nilfs_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 = d_inode(old_dentry);
|
||||
struct inode *new_inode = d_inode(new_dentry);
|
||||
|
|
@ -361,6 +362,9 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
|||
struct nilfs_transaction_info ti;
|
||||
int err;
|
||||
|
||||
if (flags & ~RENAME_NOREPLACE)
|
||||
return -EINVAL;
|
||||
|
||||
err = nilfs_transaction_begin(old_dir->i_sb, &ti, 1);
|
||||
if (unlikely(err))
|
||||
return err;
|
||||
|
|
@ -552,7 +556,7 @@ const struct inode_operations nilfs_dir_inode_operations = {
|
|||
.mkdir = nilfs_mkdir,
|
||||
.rmdir = nilfs_rmdir,
|
||||
.mknod = nilfs_mknod,
|
||||
.rename = nilfs_rename,
|
||||
.rename2 = nilfs_rename,
|
||||
.setattr = nilfs_setattr,
|
||||
.permission = nilfs_permission,
|
||||
.fiemap = nilfs_fiemap,
|
||||
|
|
|
|||
Loading…
Reference in a new issue