diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2014-07-10 04:50:19 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2014-07-10 04:50:19 -0400 |
commit | 4237ba43b65aa989674c89fc4f2fe46eebc501ee (patch) | |
tree | 6eb86a58677e14bb1d883d0675c9201c665eab17 /fs/fuse | |
parent | c55a01d360afafcd52bc405c044a6ebf5de436d5 (diff) |
fuse: restructure ->rename2()
Make ->rename2() universal, i.e. able to handle zero flags. This is to
make future change of the API easier.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dir.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 202a9721be93..0c6048247a34 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -815,13 +815,6 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent, | |||
815 | return err; | 815 | return err; |
816 | } | 816 | } |
817 | 817 | ||
818 | static int fuse_rename(struct inode *olddir, struct dentry *oldent, | ||
819 | struct inode *newdir, struct dentry *newent) | ||
820 | { | ||
821 | return fuse_rename_common(olddir, oldent, newdir, newent, 0, | ||
822 | FUSE_RENAME, sizeof(struct fuse_rename_in)); | ||
823 | } | ||
824 | |||
825 | static int fuse_rename2(struct inode *olddir, struct dentry *oldent, | 818 | static int fuse_rename2(struct inode *olddir, struct dentry *oldent, |
826 | struct inode *newdir, struct dentry *newent, | 819 | struct inode *newdir, struct dentry *newent, |
827 | unsigned int flags) | 820 | unsigned int flags) |
@@ -832,17 +825,30 @@ static int fuse_rename2(struct inode *olddir, struct dentry *oldent, | |||
832 | if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) | 825 | if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) |
833 | return -EINVAL; | 826 | return -EINVAL; |
834 | 827 | ||
835 | if (fc->no_rename2 || fc->minor < 23) | 828 | if (flags) { |
836 | return -EINVAL; | 829 | if (fc->no_rename2 || fc->minor < 23) |
830 | return -EINVAL; | ||
837 | 831 | ||
838 | err = fuse_rename_common(olddir, oldent, newdir, newent, flags, | 832 | err = fuse_rename_common(olddir, oldent, newdir, newent, flags, |
839 | FUSE_RENAME2, sizeof(struct fuse_rename2_in)); | 833 | FUSE_RENAME2, |
840 | if (err == -ENOSYS) { | 834 | sizeof(struct fuse_rename2_in)); |
841 | fc->no_rename2 = 1; | 835 | if (err == -ENOSYS) { |
842 | err = -EINVAL; | 836 | fc->no_rename2 = 1; |
837 | err = -EINVAL; | ||
838 | } | ||
839 | } else { | ||
840 | err = fuse_rename_common(olddir, oldent, newdir, newent, 0, | ||
841 | FUSE_RENAME, | ||
842 | sizeof(struct fuse_rename_in)); | ||
843 | } | 843 | } |
844 | |||
844 | return err; | 845 | return err; |
846 | } | ||
845 | 847 | ||
848 | static int fuse_rename(struct inode *olddir, struct dentry *oldent, | ||
849 | struct inode *newdir, struct dentry *newent) | ||
850 | { | ||
851 | return fuse_rename2(olddir, oldent, newdir, newent, 0); | ||
846 | } | 852 | } |
847 | 853 | ||
848 | static int fuse_link(struct dentry *entry, struct inode *newdir, | 854 | static int fuse_link(struct dentry *entry, struct inode *newdir, |