diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2014-07-23 15:15:33 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-07-24 06:18:44 -0400 |
commit | cb7b2772845bcfe7d84769e195f13e1b9a55a490 (patch) | |
tree | 66e02b4b09f9fbd0bea1ccfd7e3eab232891cdba /mm | |
parent | 1bd00d04f161ff0d4176055b4c1d5723a6449a60 (diff) |
shmem: support RENAME_NOREPLACE
Expand noreplace_rename2() because next patch will implement one more flag.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/shmem.c | 7 |
1 files changed, 5 insertions, 2 deletions
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 |