cgroup: separate out cgroup1_kf_syscall_ops

Currently, cgroup_kf_syscall_ops is shared by v1 and v2 and the
specific methods test the version and take different actions.  Split
out v1 functions and put them in cgroup1_kf_syscall_ops and remove the
now unnecessary explicit branches in specific methods.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Acked-by: Zefan Li <lizefan@huawei.com>
This commit is contained in:
Tejun Heo
2016-12-27 14:49:07 -05:00
parent 633feee310
commit fa069904dd
3 changed files with 32 additions and 27 deletions

View File

@@ -800,8 +800,8 @@ out_free:
/*
* cgroup_rename - Only allow simple rename of directories in place.
*/
int cgroup_rename(struct kernfs_node *kn, struct kernfs_node *new_parent,
const char *new_name_str)
int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent,
const char *new_name_str)
{
struct cgroup *cgrp = kn->priv;
int ret;
@@ -811,13 +811,6 @@ int cgroup_rename(struct kernfs_node *kn, struct kernfs_node *new_parent,
if (kn->parent != new_parent)
return -EIO;
/*
* This isn't a proper migration and its usefulness is very
* limited. Disallow on the default hierarchy.
*/
if (cgroup_on_dfl(cgrp))
return -EPERM;
/*
* We're gonna grab cgroup_mutex which nests outside kernfs
* active_ref. kernfs_rename() doesn't require active_ref