aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-09-27 05:03:57 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2016-09-27 05:03:57 -0400
commitf03b8ad8d38634d13e802165cc15917481b47835 (patch)
tree4dc9c060684f242d1e6c07d28d1ff625db63fd6c /fs/jffs2
parent9a232de4999666b2e8ea6775b2b0e3e4feb09b7a (diff)
fs: support RENAME_NOREPLACE for local filesystems
This is trivial to do: - add flags argument to foo_rename() - check if flags doesn't have any other than RENAME_NOREPLACE - assign foo_rename() to .rename2 instead of .rename Filesystems converted: affs, bfs, exofs, ext2, hfs, hfsplus, jffs2, jfs, logfs, minix, msdos, nilfs2, omfs, reiserfs, sysvfs, ubifs, udf, ufs, vfat. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Acked-by: Boaz Harrosh <ooo@electrozaur.com> Acked-by: Richard Weinberger <richard@nod.at> Acked-by: Bob Copeland <me@bobcopeland.com> Acked-by: Jan Kara <jack@suse.cz> Cc: Theodore Ts'o <tytso@mit.edu> Cc: Jaegeuk Kim <jaegeuk@kernel.org> Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Cc: Mikulas Patocka <mpatocka@redhat.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Dave Kleikamp <shaggy@kernel.org> Cc: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Cc: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/dir.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index 30eb33ff8189..11e711b12ccf 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -35,7 +35,8 @@ static int jffs2_mkdir (struct inode *,struct dentry *,umode_t);
35static int jffs2_rmdir (struct inode *,struct dentry *); 35static int jffs2_rmdir (struct inode *,struct dentry *);
36static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t); 36static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t);
37static int jffs2_rename (struct inode *, struct dentry *, 37static int jffs2_rename (struct inode *, struct dentry *,
38 struct inode *, struct dentry *); 38 struct inode *, struct dentry *,
39 unsigned int);
39 40
40const struct file_operations jffs2_dir_operations = 41const struct file_operations jffs2_dir_operations =
41{ 42{
@@ -57,7 +58,7 @@ const struct inode_operations jffs2_dir_inode_operations =
57 .mkdir = jffs2_mkdir, 58 .mkdir = jffs2_mkdir,
58 .rmdir = jffs2_rmdir, 59 .rmdir = jffs2_rmdir,
59 .mknod = jffs2_mknod, 60 .mknod = jffs2_mknod,
60 .rename = jffs2_rename, 61 .rename2 = jffs2_rename,
61 .get_acl = jffs2_get_acl, 62 .get_acl = jffs2_get_acl,
62 .set_acl = jffs2_set_acl, 63 .set_acl = jffs2_set_acl,
63 .setattr = jffs2_setattr, 64 .setattr = jffs2_setattr,
@@ -759,7 +760,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
759} 760}
760 761
761static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, 762static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
762 struct inode *new_dir_i, struct dentry *new_dentry) 763 struct inode *new_dir_i, struct dentry *new_dentry,
764 unsigned int flags)
763{ 765{
764 int ret; 766 int ret;
765 struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); 767 struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb);
@@ -767,6 +769,9 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
767 uint8_t type; 769 uint8_t type;
768 uint32_t now; 770 uint32_t now;
769 771
772 if (flags & ~RENAME_NOREPLACE)
773 return -EINVAL;
774
770 /* The VFS will check for us and prevent trying to rename a 775 /* The VFS will check for us and prevent trying to rename a
771 * file over a directory and vice versa, but if it's a directory, 776 * file over a directory and vice versa, but if it's a directory,
772 * the VFS can't check whether the victim is empty. The filesystem 777 * the VFS can't check whether the victim is empty. The filesystem