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
|
|
@ -35,7 +35,8 @@ static int jffs2_mkdir (struct inode *,struct dentry *,umode_t);
|
|||
static int jffs2_rmdir (struct inode *,struct dentry *);
|
||||
static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t);
|
||||
static int jffs2_rename (struct inode *, struct dentry *,
|
||||
struct inode *, struct dentry *);
|
||||
struct inode *, struct dentry *,
|
||||
unsigned int);
|
||||
|
||||
const struct file_operations jffs2_dir_operations =
|
||||
{
|
||||
|
|
@ -57,7 +58,7 @@ const struct inode_operations jffs2_dir_inode_operations =
|
|||
.mkdir = jffs2_mkdir,
|
||||
.rmdir = jffs2_rmdir,
|
||||
.mknod = jffs2_mknod,
|
||||
.rename = jffs2_rename,
|
||||
.rename2 = jffs2_rename,
|
||||
.get_acl = jffs2_get_acl,
|
||||
.set_acl = jffs2_set_acl,
|
||||
.setattr = jffs2_setattr,
|
||||
|
|
@ -759,7 +760,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
|
|||
}
|
||||
|
||||
static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
|
||||
struct inode *new_dir_i, struct dentry *new_dentry)
|
||||
struct inode *new_dir_i, struct dentry *new_dentry,
|
||||
unsigned int flags)
|
||||
{
|
||||
int ret;
|
||||
struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb);
|
||||
|
|
@ -767,6 +769,9 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
|
|||
uint8_t type;
|
||||
uint32_t now;
|
||||
|
||||
if (flags & ~RENAME_NOREPLACE)
|
||||
return -EINVAL;
|
||||
|
||||
/* The VFS will check for us and prevent trying to rename a
|
||||
* file over a directory and vice versa, but if it's a directory,
|
||||
* the VFS can't check whether the victim is empty. The filesystem
|
||||
|
|
|
|||
Loading…
Reference in a new issue