VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: Miklos Szeredi <mszeredi@redhat.com> 2016-09-27 11:03:57 +0200 committer: Miklos Szeredi <mszeredi@redhat.com> 2016-09-27 11:03:57 +0200 commit: f03b8ad8d38634d13e802165cc15917481b47835 parent: 9a232de4999666b2e8ea6775b2b0e3e4feb09b7a
Commit Summary:
fs: support RENAME_NOREPLACE for local filesystems
Diffstat:
1 file changed, 6 insertions, 2 deletions
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c
index c8cbf3b60645..417511bbe362 100644
--- a/fs/omfs/dir.c
+++ b/fs/omfs/dir.c
@@ -371,12 +371,16 @@ static bool omfs_fill_chain(struct inode *dir, struct dir_context *ctx,
 }
 
 static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry,
-		struct inode *new_dir, struct dentry *new_dentry)
+		       struct inode *new_dir, struct dentry *new_dentry,
+		       unsigned int flags)
 {
 	struct inode *new_inode = d_inode(new_dentry);
 	struct inode *old_inode = d_inode(old_dentry);
 	int err;
 
+	if (flags & ~RENAME_NOREPLACE)
+		return -EINVAL;
+
 	if (new_inode) {
 		/* overwriting existing file/dir */
 		err = omfs_remove(new_dir, new_dentry);
@@ -444,7 +448,7 @@ static int omfs_readdir(struct file *file, struct dir_context *ctx)
 const struct inode_operations omfs_dir_inops = {
 	.lookup = omfs_lookup,
 	.mkdir = omfs_mkdir,
-	.rename = omfs_rename,
+	.rename2 = omfs_rename,
 	.create = omfs_create,
 	.unlink = omfs_remove,
 	.rmdir = omfs_remove,