提交 4237ba43 编写于 作者: M Miklos Szeredi

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: NMiklos Szeredi <mszeredi@suse.cz>
上级 c55a01d3
...@@ -815,13 +815,6 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent, ...@@ -815,13 +815,6 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
return err; return err;
} }
static int fuse_rename(struct inode *olddir, struct dentry *oldent,
struct inode *newdir, struct dentry *newent)
{
return fuse_rename_common(olddir, oldent, newdir, newent, 0,
FUSE_RENAME, sizeof(struct fuse_rename_in));
}
static int fuse_rename2(struct inode *olddir, struct dentry *oldent, static int fuse_rename2(struct inode *olddir, struct dentry *oldent,
struct inode *newdir, struct dentry *newent, struct inode *newdir, struct dentry *newent,
unsigned int flags) unsigned int flags)
...@@ -832,17 +825,30 @@ static int fuse_rename2(struct inode *olddir, struct dentry *oldent, ...@@ -832,17 +825,30 @@ static int fuse_rename2(struct inode *olddir, struct dentry *oldent,
if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE))
return -EINVAL; return -EINVAL;
if (fc->no_rename2 || fc->minor < 23) if (flags) {
return -EINVAL; if (fc->no_rename2 || fc->minor < 23)
return -EINVAL;
err = fuse_rename_common(olddir, oldent, newdir, newent, flags, err = fuse_rename_common(olddir, oldent, newdir, newent, flags,
FUSE_RENAME2, sizeof(struct fuse_rename2_in)); FUSE_RENAME2,
if (err == -ENOSYS) { sizeof(struct fuse_rename2_in));
fc->no_rename2 = 1; if (err == -ENOSYS) {
err = -EINVAL; fc->no_rename2 = 1;
err = -EINVAL;
}
} else {
err = fuse_rename_common(olddir, oldent, newdir, newent, 0,
FUSE_RENAME,
sizeof(struct fuse_rename_in));
} }
return err; return err;
}
static int fuse_rename(struct inode *olddir, struct dentry *oldent,
struct inode *newdir, struct dentry *newent)
{
return fuse_rename2(olddir, oldent, newdir, newent, 0);
} }
static int fuse_link(struct dentry *entry, struct inode *newdir, static int fuse_link(struct dentry *entry, struct inode *newdir,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册