linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: linux-kernel@vger.kernel.org, hch@infradead.org,
	viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org
Cc: Miklos Szeredi <mszeredi@suse.cz>, Hugh Dickins <hughd@google.com>
Subject: [PATCH 4/7] shmem: support RENAME_NOREPLACE
Date: Wed, 23 Jul 2014 15:15:33 +0200	[thread overview]
Message-ID: <1406121336-1379-5-git-send-email-miklos@szeredi.hu> (raw)
In-Reply-To: <1406121336-1379-1-git-send-email-miklos@szeredi.hu>

From: Miklos Szeredi <mszeredi@suse.cz>

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>
---
 mm/shmem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 1140f49b6ded..791b05514f9a 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2022,11 +2022,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;
 
@@ -2709,7 +2712,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
-- 
1.8.1.4


  parent reply	other threads:[~2014-07-23 13:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 13:15 [PATCH 0/7] first iteration of rename2 support Miklos Szeredi
2014-07-23 13:15 ` [PATCH 1/7] vfs: call rename2 if exists Miklos Szeredi
2014-07-23 13:15 ` [PATCH 2/7] bad_inode: add ->rename2() Miklos Szeredi
2014-07-23 13:15 ` [PATCH 3/7] btrfs: add RENAME_NOREPLACE Miklos Szeredi
2014-07-23 13:15 ` Miklos Szeredi [this message]
2014-07-24 11:08   ` [PATCH 4/7] shmem: support RENAME_NOREPLACE Hugh Dickins
2014-07-24 11:21     ` Miklos Szeredi
2014-07-23 13:15 ` [PATCH 5/7] shmem: support RENAME_EXCHANGE Miklos Szeredi
2014-07-24 11:09   ` Hugh Dickins
2014-07-23 13:15 ` [PATCH 6/7] hostfs: support rename flags Miklos Szeredi
2014-07-23 13:15 ` [PATCH 7/7] cifs: support RENAME_NOREPLACE Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406121336-1379-5-git-send-email-miklos@szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=hch@infradead.org \
    --cc=hughd@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).