Commit 3b69ff51 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Al Viro

shmem: support RENAME_NOREPLACE

Implement ->rename2 instead of ->rename.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
Acked-by: default avatarHugh Dickins <hughd@google.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 80ace85c
...@@ -2054,11 +2054,14 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -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 * it exists so that the VFS layer correctly free's it when it
* gets overwritten. * 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; struct inode *inode = old_dentry->d_inode;
int they_are_dirs = S_ISDIR(inode->i_mode); int they_are_dirs = S_ISDIR(inode->i_mode);
if (flags & ~(RENAME_NOREPLACE))
return -EINVAL;
if (!simple_empty(new_dentry)) if (!simple_empty(new_dentry))
return -ENOTEMPTY; return -ENOTEMPTY;
...@@ -2741,7 +2744,7 @@ static const struct inode_operations shmem_dir_inode_operations = { ...@@ -2741,7 +2744,7 @@ static const struct inode_operations shmem_dir_inode_operations = {
.mkdir = shmem_mkdir, .mkdir = shmem_mkdir,
.rmdir = shmem_rmdir, .rmdir = shmem_rmdir,
.mknod = shmem_mknod, .mknod = shmem_mknod,
.rename = shmem_rename, .rename2 = shmem_rename2,
.tmpfile = shmem_tmpfile, .tmpfile = shmem_tmpfile,
#endif #endif
#ifdef CONFIG_TMPFS_XATTR #ifdef CONFIG_TMPFS_XATTR
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment