From: Miklos Szeredi Date: Wed, 23 Jul 2014 13:15:33 +0000 (+0200) Subject: shmem: support RENAME_NOREPLACE X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3b69ff51d087d265aa4af3a532fc4f20bf33e718;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git shmem: support RENAME_NOREPLACE Implement ->rename2 instead of ->rename. Signed-off-by: Miklos Szeredi Acked-by: Hugh Dickins Signed-off-by: Christoph Hellwig Signed-off-by: Al Viro --- diff --git a/mm/shmem.c b/mm/shmem.c index af68b15a8fc1..fe959181f995 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2054,11 +2054,14 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry) * it exists so that the VFS layer correctly free's it when it * gets overwritten. */ -static int shmem_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) +static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) { struct inode *inode = old_dentry->d_inode; int they_are_dirs = S_ISDIR(inode->i_mode); + if (flags & ~(RENAME_NOREPLACE)) + return -EINVAL; + if (!simple_empty(new_dentry)) return -ENOTEMPTY; @@ -2741,7 +2744,7 @@ static const struct inode_operations shmem_dir_inode_operations = { .mkdir = shmem_mkdir, .rmdir = shmem_rmdir, .mknod = shmem_mknod, - .rename = shmem_rename, + .rename2 = shmem_rename2, .tmpfile = shmem_tmpfile, #endif #ifdef CONFIG_TMPFS_XATTR