diff options
author | Tejun Heo <tj@kernel.org> | 2013-08-26 18:40:56 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-08-26 18:40:56 -0400 |
commit | 9fa4db334c7d9570aec7a5121e84fae99aae1d04 (patch) | |
tree | e9db3a75ec77038f68c1961e947346a33fabafcf | |
parent | ca8bdcaff0d77990fb69e0f946018c96a70851cc (diff) |
cgroup: implement CFTYPE_NO_PREFIX
When cgroup files are created, cgroup core automatically prepends the
name of the subsystem as prefix. This patch adds CFTYPE_NO_ which
disables the automatic prefix. This is to work around historical
baggages and shouldn't be used for new files.
This will be used to move "cgroup.event_control" from cgroup core to
memcg.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Glauber Costa <glommer@gmail.com>
-rw-r--r-- | include/linux/cgroup.h | 1 | ||||
-rw-r--r-- | kernel/cgroup.c | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 21ba29869eb8..3561d305b1e0 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -411,6 +411,7 @@ enum { | |||
411 | CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */ | 411 | CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */ |
412 | CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */ | 412 | CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */ |
413 | CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */ | 413 | CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */ |
414 | CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ | ||
414 | }; | 415 | }; |
415 | 416 | ||
416 | #define MAX_CFTYPE_NAME 64 | 417 | #define MAX_CFTYPE_NAME 64 |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 7516668d8325..a41dc87cd07e 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -2756,7 +2756,8 @@ static int cgroup_add_file(struct cgroup *cgrp, struct cftype *cft) | |||
2756 | umode_t mode; | 2756 | umode_t mode; |
2757 | char name[MAX_CGROUP_TYPE_NAMELEN + MAX_CFTYPE_NAME + 2] = { 0 }; | 2757 | char name[MAX_CGROUP_TYPE_NAMELEN + MAX_CFTYPE_NAME + 2] = { 0 }; |
2758 | 2758 | ||
2759 | if (cft->ss && !(cgrp->root->flags & CGRP_ROOT_NOPREFIX)) { | 2759 | if (cft->ss && !(cft->flags & CFTYPE_NO_PREFIX) && |
2760 | !(cgrp->root->flags & CGRP_ROOT_NOPREFIX)) { | ||
2760 | strcpy(name, cft->ss->name); | 2761 | strcpy(name, cft->ss->name); |
2761 | strcat(name, "."); | 2762 | strcat(name, "."); |
2762 | } | 2763 | } |