Skip to content

Commit 4237ba4

Browse files
author
Miklos Szeredi
committed
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>
1 parent c55a01d commit 4237ba4

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

‎fs/fuse/dir.c‎

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -815,13 +815,6 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
815815
return err;
816816
}
817817

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-
825818
static int fuse_rename2(struct inode *olddir, struct dentry *oldent,
826819
struct inode *newdir, struct dentry *newent,
827820
unsigned int flags)
@@ -832,17 +825,30 @@ static int fuse_rename2(struct inode *olddir, struct dentry *oldent,
832825
if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE))
833826
return -EINVAL;
834827

835-
if (fc->no_rename2 || fc->minor < 23)
836-
return -EINVAL;
828+
if (flags) {
829+
if (fc->no_rename2 || fc->minor < 23)
830+
return -EINVAL;
837831

838-
err = fuse_rename_common(olddir, oldent, newdir, newent, flags,
839-
FUSE_RENAME2, sizeof(struct fuse_rename2_in));
840-
if (err == -ENOSYS) {
841-
fc->no_rename2 = 1;
842-
err = -EINVAL;
832+
err = fuse_rename_common(olddir, oldent, newdir, newent, flags,
833+
FUSE_RENAME2,
834+
sizeof(struct fuse_rename2_in));
835+
if (err == -ENOSYS) {
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));
843843
}
844+
844845
return err;
846+
}
845847

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);
846852
}
847853

848854
static int fuse_link(struct dentry *entry, struct inode *newdir,

0 commit comments

Comments
 (0)